partition
stringclasses
3 values
func_name
stringlengths
1
134
docstring
stringlengths
1
46.9k
path
stringlengths
4
223
original_string
stringlengths
75
104k
code
stringlengths
75
104k
docstring_tokens
listlengths
1
1.97k
repo
stringlengths
7
55
language
stringclasses
1 value
url
stringlengths
87
315
code_tokens
listlengths
19
28.4k
sha
stringlengths
40
40
valid
login
Retrieves and stores an OAuth2 personal auth token.
tower_cli/cli/misc.py
def login(username, password, scope, client_id, client_secret, verbose): """ Retrieves and stores an OAuth2 personal auth token. """ if not supports_oauth(): raise exc.TowerCLIError( 'This version of Tower does not support OAuth2.0. Set credentials using tower-cli config.' ) ...
def login(username, password, scope, client_id, client_secret, verbose): """ Retrieves and stores an OAuth2 personal auth token. """ if not supports_oauth(): raise exc.TowerCLIError( 'This version of Tower does not support OAuth2.0. Set credentials using tower-cli config.' ) ...
[ "Retrieves", "and", "stores", "an", "OAuth2", "personal", "auth", "token", "." ]
ansible/tower-cli
python
https://github.com/ansible/tower-cli/blob/a2b151fed93c47725018d3034848cb3a1814bed7/tower_cli/cli/misc.py#L226-L285
[ "def", "login", "(", "username", ",", "password", ",", "scope", ",", "client_id", ",", "client_secret", ",", "verbose", ")", ":", "if", "not", "supports_oauth", "(", ")", ":", "raise", "exc", ".", "TowerCLIError", "(", "'This version of Tower does not support OA...
a2b151fed93c47725018d3034848cb3a1814bed7
valid
receive
Export assets from Tower. 'tower receive' exports one or more assets from a Tower instance For all of the possible assets types the TEXT can either be the assets name (or username for the case of a user) or the keyword all. Specifying all will export all of the assets of that type.
tower_cli/cli/misc.py
def receive(organization=None, user=None, team=None, credential_type=None, credential=None, notification_template=None, inventory_script=None, inventory=None, project=None, job_template=None, workflow=None, all=None): """Export assets from Tower. 'tower receive' exports one or more asse...
def receive(organization=None, user=None, team=None, credential_type=None, credential=None, notification_template=None, inventory_script=None, inventory=None, project=None, job_template=None, workflow=None, all=None): """Export assets from Tower. 'tower receive' exports one or more asse...
[ "Export", "assets", "from", "Tower", "." ]
ansible/tower-cli
python
https://github.com/ansible/tower-cli/blob/a2b151fed93c47725018d3034848cb3a1814bed7/tower_cli/cli/misc.py#L314-L332
[ "def", "receive", "(", "organization", "=", "None", ",", "user", "=", "None", ",", "team", "=", "None", ",", "credential_type", "=", "None", ",", "credential", "=", "None", ",", "notification_template", "=", "None", ",", "inventory_script", "=", "None", ",...
a2b151fed93c47725018d3034848cb3a1814bed7
valid
send
Import assets into Tower. 'tower send' imports one or more assets into a Tower instance The import can take either JSON or YAML. Data can be sent on stdin (i.e. from tower-cli receive pipe) and/or from files or directories passed as parameters. If a directory is specified only files that end in ....
tower_cli/cli/misc.py
def send(source=None, prevent=None, exclude=None, secret_management='default', no_color=False): """Import assets into Tower. 'tower send' imports one or more assets into a Tower instance The import can take either JSON or YAML. Data can be sent on stdin (i.e. from tower-cli receive pipe) and/or from f...
def send(source=None, prevent=None, exclude=None, secret_management='default', no_color=False): """Import assets into Tower. 'tower send' imports one or more assets into a Tower instance The import can take either JSON or YAML. Data can be sent on stdin (i.e. from tower-cli receive pipe) and/or from f...
[ "Import", "assets", "into", "Tower", "." ]
ansible/tower-cli
python
https://github.com/ansible/tower-cli/blob/a2b151fed93c47725018d3034848cb3a1814bed7/tower_cli/cli/misc.py#L355-L370
[ "def", "send", "(", "source", "=", "None", ",", "prevent", "=", "None", ",", "exclude", "=", "None", ",", "secret_management", "=", "'default'", ",", "no_color", "=", "False", ")", ":", "from", "tower_cli", ".", "cli", ".", "transfer", ".", "send", "im...
a2b151fed93c47725018d3034848cb3a1814bed7
valid
empty
Empties assets from Tower. 'tower empty' removes all assets from Tower
tower_cli/cli/misc.py
def empty(organization=None, user=None, team=None, credential_type=None, credential=None, notification_template=None, inventory_script=None, inventory=None, project=None, job_template=None, workflow=None, all=None, no_color=False): """Empties assets from Tower. 'tower empty' removes all ass...
def empty(organization=None, user=None, team=None, credential_type=None, credential=None, notification_template=None, inventory_script=None, inventory=None, project=None, job_template=None, workflow=None, all=None, no_color=False): """Empties assets from Tower. 'tower empty' removes all ass...
[ "Empties", "assets", "from", "Tower", "." ]
ansible/tower-cli
python
https://github.com/ansible/tower-cli/blob/a2b151fed93c47725018d3034848cb3a1814bed7/tower_cli/cli/misc.py#L390-L405
[ "def", "empty", "(", "organization", "=", "None", ",", "user", "=", "None", ",", "team", "=", "None", ",", "credential_type", "=", "None", ",", "credential", "=", "None", ",", "notification_template", "=", "None", ",", "inventory_script", "=", "None", ",",...
a2b151fed93c47725018d3034848cb3a1814bed7
valid
parse_requirements
Parse out a list of requirements from the given requirements requirements file.
setup.py
def parse_requirements(filename): """Parse out a list of requirements from the given requirements requirements file. """ reqs = [] version_spec_in_play = None # Iterate over each line in the requirements file. for line in open(filename, 'r').read().strip().split('\n'): # Sanity chec...
def parse_requirements(filename): """Parse out a list of requirements from the given requirements requirements file. """ reqs = [] version_spec_in_play = None # Iterate over each line in the requirements file. for line in open(filename, 'r').read().strip().split('\n'): # Sanity chec...
[ "Parse", "out", "a", "list", "of", "requirements", "from", "the", "given", "requirements", "requirements", "file", "." ]
ansible/tower-cli
python
https://github.com/ansible/tower-cli/blob/a2b151fed93c47725018d3034848cb3a1814bed7/setup.py#L70-L122
[ "def", "parse_requirements", "(", "filename", ")", ":", "reqs", "=", "[", "]", "version_spec_in_play", "=", "None", "# Iterate over each line in the requirements file.", "for", "line", "in", "open", "(", "filename", ",", "'r'", ")", ".", "read", "(", ")", ".", ...
a2b151fed93c47725018d3034848cb3a1814bed7
valid
combine_files
returns a string of all the strings in *args combined together, with two line breaks between them
setup.py
def combine_files(*args): """returns a string of all the strings in *args combined together, with two line breaks between them""" file_contents = [] for filename in args: with codecs.open(filename, mode='r', encoding='utf8') as f: file_contents.append(f.read()) return "\n\n".join...
def combine_files(*args): """returns a string of all the strings in *args combined together, with two line breaks between them""" file_contents = [] for filename in args: with codecs.open(filename, mode='r', encoding='utf8') as f: file_contents.append(f.read()) return "\n\n".join...
[ "returns", "a", "string", "of", "all", "the", "strings", "in", "*", "args", "combined", "together", "with", "two", "line", "breaks", "between", "them" ]
ansible/tower-cli
python
https://github.com/ansible/tower-cli/blob/a2b151fed93c47725018d3034848cb3a1814bed7/setup.py#L125-L132
[ "def", "combine_files", "(", "*", "args", ")", ":", "file_contents", "=", "[", "]", "for", "filename", "in", "args", ":", "with", "codecs", ".", "open", "(", "filename", ",", "mode", "=", "'r'", ",", "encoding", "=", "'utf8'", ")", "as", "f", ":", ...
a2b151fed93c47725018d3034848cb3a1814bed7
valid
Resource.create
Create a new item of resource, with or w/o org. This would be a shared class with user, but it needs the ability to monitor if the flag is set. =====API DOCS===== Create a project and, if related flags are set, monitor or wait the triggered initial project update. :param monito...
tower_cli/resources/project.py
def create(self, organization=None, monitor=False, wait=False, timeout=None, fail_on_found=False, force_on_exists=False, **kwargs): """Create a new item of resource, with or w/o org. This would be a shared class with user, but it needs the ability to monitor if the ...
def create(self, organization=None, monitor=False, wait=False, timeout=None, fail_on_found=False, force_on_exists=False, **kwargs): """Create a new item of resource, with or w/o org. This would be a shared class with user, but it needs the ability to monitor if the ...
[ "Create", "a", "new", "item", "of", "resource", "with", "or", "w", "/", "o", "org", ".", "This", "would", "be", "a", "shared", "class", "with", "user", "but", "it", "needs", "the", "ability", "to", "monitor", "if", "the", "flag", "is", "set", "." ]
ansible/tower-cli
python
https://github.com/ansible/tower-cli/blob/a2b151fed93c47725018d3034848cb3a1814bed7/tower_cli/resources/project.py#L75-L149
[ "def", "create", "(", "self", ",", "organization", "=", "None", ",", "monitor", "=", "False", ",", "wait", "=", "False", ",", "timeout", "=", "None", ",", "fail_on_found", "=", "False", ",", "force_on_exists", "=", "False", ",", "*", "*", "kwargs", ")"...
a2b151fed93c47725018d3034848cb3a1814bed7
valid
Resource.modify
Modify an already existing. To edit the project's organizations, see help for organizations. Fields in the resource's `identity` tuple can be used in lieu of a primary key for a lookup; in such a case, only other fields are written. To modify unique fields, you must use the pr...
tower_cli/resources/project.py
def modify(self, pk=None, create_on_missing=False, **kwargs): """Modify an already existing. To edit the project's organizations, see help for organizations. Fields in the resource's `identity` tuple can be used in lieu of a primary key for a lookup; in such a case, only other fields a...
def modify(self, pk=None, create_on_missing=False, **kwargs): """Modify an already existing. To edit the project's organizations, see help for organizations. Fields in the resource's `identity` tuple can be used in lieu of a primary key for a lookup; in such a case, only other fields a...
[ "Modify", "an", "already", "existing", "." ]
ansible/tower-cli
python
https://github.com/ansible/tower-cli/blob/a2b151fed93c47725018d3034848cb3a1814bed7/tower_cli/resources/project.py#L156-L193
[ "def", "modify", "(", "self", ",", "pk", "=", "None", ",", "create_on_missing", "=", "False", ",", "*", "*", "kwargs", ")", ":", "# Associated with issue #52, the organization can't be modified", "# with the 'modify' command. This would create confusion about", "# wheth...
a2b151fed93c47725018d3034848cb3a1814bed7
valid
Resource.update
Trigger a project update job within Ansible Tower. Only meaningful on non-manual projects. =====API DOCS===== Update the given project. :param pk: Primary key of the project to be updated. :type pk: int :param monitor: Flag that if set, immediately calls ``monitor`` on ...
tower_cli/resources/project.py
def update(self, pk=None, create_on_missing=False, monitor=False, wait=False, timeout=None, name=None, organization=None): """Trigger a project update job within Ansible Tower. Only meaningful on non-manual projects. =====API DOCS===== Update the given project. :...
def update(self, pk=None, create_on_missing=False, monitor=False, wait=False, timeout=None, name=None, organization=None): """Trigger a project update job within Ansible Tower. Only meaningful on non-manual projects. =====API DOCS===== Update the given project. :...
[ "Trigger", "a", "project", "update", "job", "within", "Ansible", "Tower", ".", "Only", "meaningful", "on", "non", "-", "manual", "projects", "." ]
ansible/tower-cli
python
https://github.com/ansible/tower-cli/blob/a2b151fed93c47725018d3034848cb3a1814bed7/tower_cli/resources/project.py#L205-L267
[ "def", "update", "(", "self", ",", "pk", "=", "None", ",", "create_on_missing", "=", "False", ",", "monitor", "=", "False", ",", "wait", "=", "False", ",", "timeout", "=", "None", ",", "name", "=", "None", ",", "organization", "=", "None", ")", ":", ...
a2b151fed93c47725018d3034848cb3a1814bed7
valid
Resource.status
Print the status of the most recent update. =====API DOCS===== Print the status of the most recent update. :param pk: Primary key of the resource to retrieve status from. :type pk: int :param detail: Flag that if set, return the full JSON of the job resource rather than a statu...
tower_cli/resources/project.py
def status(self, pk=None, detail=False, **kwargs): """Print the status of the most recent update. =====API DOCS===== Print the status of the most recent update. :param pk: Primary key of the resource to retrieve status from. :type pk: int :param detail: Flag that if set...
def status(self, pk=None, detail=False, **kwargs): """Print the status of the most recent update. =====API DOCS===== Print the status of the most recent update. :param pk: Primary key of the resource to retrieve status from. :type pk: int :param detail: Flag that if set...
[ "Print", "the", "status", "of", "the", "most", "recent", "update", "." ]
ansible/tower-cli
python
https://github.com/ansible/tower-cli/blob/a2b151fed93c47725018d3034848cb3a1814bed7/tower_cli/resources/project.py#L272-L303
[ "def", "status", "(", "self", ",", "pk", "=", "None", ",", "detail", "=", "False", ",", "*", "*", "kwargs", ")", ":", "# Obtain the most recent project update", "job", "=", "self", ".", "last_job_data", "(", "pk", ",", "*", "*", "kwargs", ")", "# In most...
a2b151fed93c47725018d3034848cb3a1814bed7
valid
Variables.convert
Return file content if file, else, return value as-is
tower_cli/cli/types.py
def convert(self, value, param, ctx): """Return file content if file, else, return value as-is """ # Protect against corner cases of invalid inputs if not isinstance(value, str): return value if isinstance(value, six.binary_type): value = value.decode('UTF...
def convert(self, value, param, ctx): """Return file content if file, else, return value as-is """ # Protect against corner cases of invalid inputs if not isinstance(value, str): return value if isinstance(value, six.binary_type): value = value.decode('UTF...
[ "Return", "file", "content", "if", "file", "else", "return", "value", "as", "-", "is" ]
ansible/tower-cli
python
https://github.com/ansible/tower-cli/blob/a2b151fed93c47725018d3034848cb3a1814bed7/tower_cli/cli/types.py#L49-L67
[ "def", "convert", "(", "self", ",", "value", ",", "param", ",", "ctx", ")", ":", "# Protect against corner cases of invalid inputs", "if", "not", "isinstance", "(", "value", ",", "str", ")", ":", "return", "value", "if", "isinstance", "(", "value", ",", "six...
a2b151fed93c47725018d3034848cb3a1814bed7
valid
MappedChoice.convert
Match against the appropriate choice value using the superclass implementation, and then return the actual choice.
tower_cli/cli/types.py
def convert(self, value, param, ctx): """Match against the appropriate choice value using the superclass implementation, and then return the actual choice. """ choice = super(MappedChoice, self).convert(value, param, ctx) ix = self.choices.index(choice) return self.actual...
def convert(self, value, param, ctx): """Match against the appropriate choice value using the superclass implementation, and then return the actual choice. """ choice = super(MappedChoice, self).convert(value, param, ctx) ix = self.choices.index(choice) return self.actual...
[ "Match", "against", "the", "appropriate", "choice", "value", "using", "the", "superclass", "implementation", "and", "then", "return", "the", "actual", "choice", "." ]
ansible/tower-cli
python
https://github.com/ansible/tower-cli/blob/a2b151fed93c47725018d3034848cb3a1814bed7/tower_cli/cli/types.py#L104-L110
[ "def", "convert", "(", "self", ",", "value", ",", "param", ",", "ctx", ")", ":", "choice", "=", "super", "(", "MappedChoice", ",", "self", ")", ".", "convert", "(", "value", ",", "param", ",", "ctx", ")", "ix", "=", "self", ".", "choices", ".", "...
a2b151fed93c47725018d3034848cb3a1814bed7
valid
Related.convert
Return the appropriate integer value. If a non-integer is provided, attempt a name-based lookup and return the primary key.
tower_cli/cli/types.py
def convert(self, value, param, ctx): """Return the appropriate integer value. If a non-integer is provided, attempt a name-based lookup and return the primary key. """ resource = tower_cli.get_resource(self.resource_name) # Ensure that None is passed through without trying to ...
def convert(self, value, param, ctx): """Return the appropriate integer value. If a non-integer is provided, attempt a name-based lookup and return the primary key. """ resource = tower_cli.get_resource(self.resource_name) # Ensure that None is passed through without trying to ...
[ "Return", "the", "appropriate", "integer", "value", ".", "If", "a", "non", "-", "integer", "is", "provided", "attempt", "a", "name", "-", "based", "lookup", "and", "return", "the", "primary", "key", "." ]
ansible/tower-cli
python
https://github.com/ansible/tower-cli/blob/a2b151fed93c47725018d3034848cb3a1814bed7/tower_cli/cli/types.py#L124-L172
[ "def", "convert", "(", "self", ",", "value", ",", "param", ",", "ctx", ")", ":", "resource", "=", "tower_cli", ".", "get_resource", "(", "self", ".", "resource_name", ")", "# Ensure that None is passed through without trying to", "# do anything.", "if", "value", "...
a2b151fed93c47725018d3034848cb3a1814bed7
valid
Resource._parent_filter
Returns filtering parameters to limit a search to the children of a particular node by a particular relationship.
tower_cli/resources/node.py
def _parent_filter(self, parent, relationship, **kwargs): """ Returns filtering parameters to limit a search to the children of a particular node by a particular relationship. """ if parent is None or relationship is None: return {} parent_filter_kwargs = {} ...
def _parent_filter(self, parent, relationship, **kwargs): """ Returns filtering parameters to limit a search to the children of a particular node by a particular relationship. """ if parent is None or relationship is None: return {} parent_filter_kwargs = {} ...
[ "Returns", "filtering", "parameters", "to", "limit", "a", "search", "to", "the", "children", "of", "a", "particular", "node", "by", "a", "particular", "relationship", "." ]
ansible/tower-cli
python
https://github.com/ansible/tower-cli/blob/a2b151fed93c47725018d3034848cb3a1814bed7/tower_cli/resources/node.py#L98-L112
[ "def", "_parent_filter", "(", "self", ",", "parent", ",", "relationship", ",", "*", "*", "kwargs", ")", ":", "if", "parent", "is", "None", "or", "relationship", "is", "None", ":", "return", "{", "}", "parent_filter_kwargs", "=", "{", "}", "query_params", ...
a2b151fed93c47725018d3034848cb3a1814bed7
valid
Resource.associate_success_node
Add a node to run on success. =====API DOCS===== Add a node to run on success. :param parent: Primary key of parent node to associate success node to. :type parent: int :param child: Primary key of child node to be associated. :type child: int :param `**kwargs`:...
tower_cli/resources/node.py
def associate_success_node(self, parent, child=None, **kwargs): """Add a node to run on success. =====API DOCS===== Add a node to run on success. :param parent: Primary key of parent node to associate success node to. :type parent: int :param child: Primary key of child...
def associate_success_node(self, parent, child=None, **kwargs): """Add a node to run on success. =====API DOCS===== Add a node to run on success. :param parent: Primary key of parent node to associate success node to. :type parent: int :param child: Primary key of child...
[ "Add", "a", "node", "to", "run", "on", "success", "." ]
ansible/tower-cli
python
https://github.com/ansible/tower-cli/blob/a2b151fed93c47725018d3034848cb3a1814bed7/tower_cli/resources/node.py#L141-L157
[ "def", "associate_success_node", "(", "self", ",", "parent", ",", "child", "=", "None", ",", "*", "*", "kwargs", ")", ":", "return", "self", ".", "_assoc_or_create", "(", "'success'", ",", "parent", ",", "child", ",", "*", "*", "kwargs", ")" ]
a2b151fed93c47725018d3034848cb3a1814bed7
valid
Resource.disassociate_success_node
Remove success node. The resulatant 2 nodes will both become root nodes. =====API DOCS===== Remove success node. :param parent: Primary key of parent node to disassociate success node from. :type parent: int :param child: Primary key of child node to be disassociated. ...
tower_cli/resources/node.py
def disassociate_success_node(self, parent, child): """Remove success node. The resulatant 2 nodes will both become root nodes. =====API DOCS===== Remove success node. :param parent: Primary key of parent node to disassociate success node from. :type parent: int ...
def disassociate_success_node(self, parent, child): """Remove success node. The resulatant 2 nodes will both become root nodes. =====API DOCS===== Remove success node. :param parent: Primary key of parent node to disassociate success node from. :type parent: int ...
[ "Remove", "success", "node", ".", "The", "resulatant", "2", "nodes", "will", "both", "become", "root", "nodes", "." ]
ansible/tower-cli
python
https://github.com/ansible/tower-cli/blob/a2b151fed93c47725018d3034848cb3a1814bed7/tower_cli/resources/node.py#L162-L179
[ "def", "disassociate_success_node", "(", "self", ",", "parent", ",", "child", ")", ":", "return", "self", ".", "_disassoc", "(", "self", ".", "_forward_rel_name", "(", "'success'", ")", ",", "parent", ",", "child", ")" ]
a2b151fed93c47725018d3034848cb3a1814bed7
valid
Resource.associate_failure_node
Add a node to run on failure. =====API DOCS===== Add a node to run on failure. :param parent: Primary key of parent node to associate failure node to. :type parent: int :param child: Primary key of child node to be associated. :type child: int :param `**kwargs`:...
tower_cli/resources/node.py
def associate_failure_node(self, parent, child=None, **kwargs): """Add a node to run on failure. =====API DOCS===== Add a node to run on failure. :param parent: Primary key of parent node to associate failure node to. :type parent: int :param child: Primary key of child...
def associate_failure_node(self, parent, child=None, **kwargs): """Add a node to run on failure. =====API DOCS===== Add a node to run on failure. :param parent: Primary key of parent node to associate failure node to. :type parent: int :param child: Primary key of child...
[ "Add", "a", "node", "to", "run", "on", "failure", "." ]
ansible/tower-cli
python
https://github.com/ansible/tower-cli/blob/a2b151fed93c47725018d3034848cb3a1814bed7/tower_cli/resources/node.py#L185-L201
[ "def", "associate_failure_node", "(", "self", ",", "parent", ",", "child", "=", "None", ",", "*", "*", "kwargs", ")", ":", "return", "self", ".", "_assoc_or_create", "(", "'failure'", ",", "parent", ",", "child", ",", "*", "*", "kwargs", ")" ]
a2b151fed93c47725018d3034848cb3a1814bed7
valid
Resource.disassociate_failure_node
Remove a failure node link. The resulatant 2 nodes will both become root nodes. =====API DOCS===== Remove a failure node link. :param parent: Primary key of parent node to disassociate failure node from. :type parent: int :param child: Primary key of child node to be di...
tower_cli/resources/node.py
def disassociate_failure_node(self, parent, child): """Remove a failure node link. The resulatant 2 nodes will both become root nodes. =====API DOCS===== Remove a failure node link. :param parent: Primary key of parent node to disassociate failure node from. :type paren...
def disassociate_failure_node(self, parent, child): """Remove a failure node link. The resulatant 2 nodes will both become root nodes. =====API DOCS===== Remove a failure node link. :param parent: Primary key of parent node to disassociate failure node from. :type paren...
[ "Remove", "a", "failure", "node", "link", ".", "The", "resulatant", "2", "nodes", "will", "both", "become", "root", "nodes", "." ]
ansible/tower-cli
python
https://github.com/ansible/tower-cli/blob/a2b151fed93c47725018d3034848cb3a1814bed7/tower_cli/resources/node.py#L206-L223
[ "def", "disassociate_failure_node", "(", "self", ",", "parent", ",", "child", ")", ":", "return", "self", ".", "_disassoc", "(", "self", ".", "_forward_rel_name", "(", "'failure'", ")", ",", "parent", ",", "child", ")" ]
a2b151fed93c47725018d3034848cb3a1814bed7
valid
Resource.associate_always_node
Add a node to always run after the parent is finished. =====API DOCS===== Add a node to always run after the parent is finished. :param parent: Primary key of parent node to associate always node to. :type parent: int :param child: Primary key of child node to be associated. ...
tower_cli/resources/node.py
def associate_always_node(self, parent, child=None, **kwargs): """Add a node to always run after the parent is finished. =====API DOCS===== Add a node to always run after the parent is finished. :param parent: Primary key of parent node to associate always node to. :type parent...
def associate_always_node(self, parent, child=None, **kwargs): """Add a node to always run after the parent is finished. =====API DOCS===== Add a node to always run after the parent is finished. :param parent: Primary key of parent node to associate always node to. :type parent...
[ "Add", "a", "node", "to", "always", "run", "after", "the", "parent", "is", "finished", "." ]
ansible/tower-cli
python
https://github.com/ansible/tower-cli/blob/a2b151fed93c47725018d3034848cb3a1814bed7/tower_cli/resources/node.py#L229-L245
[ "def", "associate_always_node", "(", "self", ",", "parent", ",", "child", "=", "None", ",", "*", "*", "kwargs", ")", ":", "return", "self", ".", "_assoc_or_create", "(", "'always'", ",", "parent", ",", "child", ",", "*", "*", "kwargs", ")" ]
a2b151fed93c47725018d3034848cb3a1814bed7
valid
Resource.disassociate_always_node
Remove an always node link. The resultant 2 nodes will both become root nodes. =====API DOCS===== Remove an always node link. :param parent: Primary key of parent node to disassociate always node from. :type parent: int :param child: Primary key of child node to be disa...
tower_cli/resources/node.py
def disassociate_always_node(self, parent, child): """Remove an always node link. The resultant 2 nodes will both become root nodes. =====API DOCS===== Remove an always node link. :param parent: Primary key of parent node to disassociate always node from. :type parent: ...
def disassociate_always_node(self, parent, child): """Remove an always node link. The resultant 2 nodes will both become root nodes. =====API DOCS===== Remove an always node link. :param parent: Primary key of parent node to disassociate always node from. :type parent: ...
[ "Remove", "an", "always", "node", "link", ".", "The", "resultant", "2", "nodes", "will", "both", "become", "root", "nodes", "." ]
ansible/tower-cli
python
https://github.com/ansible/tower-cli/blob/a2b151fed93c47725018d3034848cb3a1814bed7/tower_cli/resources/node.py#L250-L267
[ "def", "disassociate_always_node", "(", "self", ",", "parent", ",", "child", ")", ":", "return", "self", ".", "_disassoc", "(", "self", ".", "_forward_rel_name", "(", "'always'", ")", ",", "parent", ",", "child", ")" ]
a2b151fed93c47725018d3034848cb3a1814bed7
valid
Resource.obj_res
Given some CLI input data, Returns the following and their types: obj - the role grantee res - the resource that the role applies to
tower_cli/resources/role.py
def obj_res(data, fail_on=['type', 'obj', 'res']): """ Given some CLI input data, Returns the following and their types: obj - the role grantee res - the resource that the role applies to """ errors = [] if not data.get('type', None) and 'type' in fail_on:...
def obj_res(data, fail_on=['type', 'obj', 'res']): """ Given some CLI input data, Returns the following and their types: obj - the role grantee res - the resource that the role applies to """ errors = [] if not data.get('type', None) and 'type' in fail_on:...
[ "Given", "some", "CLI", "input", "data", "Returns", "the", "following", "and", "their", "types", ":", "obj", "-", "the", "role", "grantee", "res", "-", "the", "resource", "that", "the", "role", "applies", "to" ]
ansible/tower-cli
python
https://github.com/ansible/tower-cli/blob/a2b151fed93c47725018d3034848cb3a1814bed7/tower_cli/resources/role.py#L95-L142
[ "def", "obj_res", "(", "data", ",", "fail_on", "=", "[", "'type'", ",", "'obj'", ",", "'res'", "]", ")", ":", "errors", "=", "[", "]", "if", "not", "data", ".", "get", "(", "'type'", ",", "None", ")", "and", "'type'", "in", "fail_on", ":", "error...
a2b151fed93c47725018d3034848cb3a1814bed7
valid
Resource.data_endpoint
Converts a set of CLI input arguments, `in_data`, into request data and an endpoint that can be used to look up a role or list of roles. Also changes the format of `type` in data to what the server expects for the role model, as it exists in the database.
tower_cli/resources/role.py
def data_endpoint(cls, in_data, ignore=[]): """ Converts a set of CLI input arguments, `in_data`, into request data and an endpoint that can be used to look up a role or list of roles. Also changes the format of `type` in data to what the server expects for the role mode...
def data_endpoint(cls, in_data, ignore=[]): """ Converts a set of CLI input arguments, `in_data`, into request data and an endpoint that can be used to look up a role or list of roles. Also changes the format of `type` in data to what the server expects for the role mode...
[ "Converts", "a", "set", "of", "CLI", "input", "arguments", "in_data", "into", "request", "data", "and", "an", "endpoint", "that", "can", "be", "used", "to", "look", "up", "a", "role", "or", "list", "of", "roles", "." ]
ansible/tower-cli
python
https://github.com/ansible/tower-cli/blob/a2b151fed93c47725018d3034848cb3a1814bed7/tower_cli/resources/role.py#L145-L180
[ "def", "data_endpoint", "(", "cls", ",", "in_data", ",", "ignore", "=", "[", "]", ")", ":", "obj", ",", "obj_type", ",", "res", ",", "res_type", "=", "cls", ".", "obj_res", "(", "in_data", ",", "fail_on", "=", "[", "]", ")", "data", "=", "{", "}"...
a2b151fed93c47725018d3034848cb3a1814bed7
valid
Resource.populate_resource_columns
Operates on item_dict Promotes the resource_name and resource_type fields to the top-level of the serialization so they can be printed as columns. Also makes a copies name field to type, which is a default column.
tower_cli/resources/role.py
def populate_resource_columns(item_dict): """Operates on item_dict Promotes the resource_name and resource_type fields to the top-level of the serialization so they can be printed as columns. Also makes a copies name field to type, which is a default column.""" item_dict['type']...
def populate_resource_columns(item_dict): """Operates on item_dict Promotes the resource_name and resource_type fields to the top-level of the serialization so they can be printed as columns. Also makes a copies name field to type, which is a default column.""" item_dict['type']...
[ "Operates", "on", "item_dict" ]
ansible/tower-cli
python
https://github.com/ansible/tower-cli/blob/a2b151fed93c47725018d3034848cb3a1814bed7/tower_cli/resources/role.py#L183-L201
[ "def", "populate_resource_columns", "(", "item_dict", ")", ":", "item_dict", "[", "'type'", "]", "=", "item_dict", "[", "'name'", "]", "if", "len", "(", "item_dict", "[", "'summary_fields'", "]", ")", "==", "0", ":", "# Singleton roles omit these fields", "item_...
a2b151fed93c47725018d3034848cb3a1814bed7
valid
Resource.set_display_columns
Add or remove columns from the output.
tower_cli/resources/role.py
def set_display_columns(self, set_true=[], set_false=[]): """Add or remove columns from the output.""" for i in range(len(self.fields)): if self.fields[i].name in set_true: self.fields[i].display = True elif self.fields[i].name in set_false: self.f...
def set_display_columns(self, set_true=[], set_false=[]): """Add or remove columns from the output.""" for i in range(len(self.fields)): if self.fields[i].name in set_true: self.fields[i].display = True elif self.fields[i].name in set_false: self.f...
[ "Add", "or", "remove", "columns", "from", "the", "output", "." ]
ansible/tower-cli
python
https://github.com/ansible/tower-cli/blob/a2b151fed93c47725018d3034848cb3a1814bed7/tower_cli/resources/role.py#L203-L209
[ "def", "set_display_columns", "(", "self", ",", "set_true", "=", "[", "]", ",", "set_false", "=", "[", "]", ")", ":", "for", "i", "in", "range", "(", "len", "(", "self", ".", "fields", ")", ")", ":", "if", "self", ".", "fields", "[", "i", "]", ...
a2b151fed93c47725018d3034848cb3a1814bed7
valid
Resource.configure_display
Populates columns and sets display attribute as needed. Operates on data.
tower_cli/resources/role.py
def configure_display(self, data, kwargs=None, write=False): """Populates columns and sets display attribute as needed. Operates on data.""" if settings.format != 'human': return # This is only used for human format if write: obj, obj_type, res, res_type = self.o...
def configure_display(self, data, kwargs=None, write=False): """Populates columns and sets display attribute as needed. Operates on data.""" if settings.format != 'human': return # This is only used for human format if write: obj, obj_type, res, res_type = self.o...
[ "Populates", "columns", "and", "sets", "display", "attribute", "as", "needed", ".", "Operates", "on", "data", "." ]
ansible/tower-cli
python
https://github.com/ansible/tower-cli/blob/a2b151fed93c47725018d3034848cb3a1814bed7/tower_cli/resources/role.py#L211-L232
[ "def", "configure_display", "(", "self", ",", "data", ",", "kwargs", "=", "None", ",", "write", "=", "False", ")", ":", "if", "settings", ".", "format", "!=", "'human'", ":", "return", "# This is only used for human format", "if", "write", ":", "obj", ",", ...
a2b151fed93c47725018d3034848cb3a1814bed7
valid
Resource.role_write
Re-implementation of the parent `write` method specific to roles. Adds a grantee (user or team) to the resource's role.
tower_cli/resources/role.py
def role_write(self, fail_on_found=False, disassociate=False, **kwargs): """Re-implementation of the parent `write` method specific to roles. Adds a grantee (user or team) to the resource's role.""" # Get the role, using only the resource data data, self.endpoint = self.data_endpoint(kw...
def role_write(self, fail_on_found=False, disassociate=False, **kwargs): """Re-implementation of the parent `write` method specific to roles. Adds a grantee (user or team) to the resource's role.""" # Get the role, using only the resource data data, self.endpoint = self.data_endpoint(kw...
[ "Re", "-", "implementation", "of", "the", "parent", "write", "method", "specific", "to", "roles", ".", "Adds", "a", "grantee", "(", "user", "or", "team", ")", "to", "the", "resource", "s", "role", "." ]
ansible/tower-cli
python
https://github.com/ansible/tower-cli/blob/a2b151fed93c47725018d3034848cb3a1814bed7/tower_cli/resources/role.py#L234-L282
[ "def", "role_write", "(", "self", ",", "fail_on_found", "=", "False", ",", "disassociate", "=", "False", ",", "*", "*", "kwargs", ")", ":", "# Get the role, using only the resource data", "data", ",", "self", ".", "endpoint", "=", "self", ".", "data_endpoint", ...
a2b151fed93c47725018d3034848cb3a1814bed7
valid
Resource.list
Return a list of roles. =====API DOCS===== Retrieve a list of objects. :param all_pages: Flag that if set, collect all pages of content from the API when returning results. :type all_pages: bool :param page: The page to show. Ignored if all_pages is set. :type page: int...
tower_cli/resources/role.py
def list(self, **kwargs): """Return a list of roles. =====API DOCS===== Retrieve a list of objects. :param all_pages: Flag that if set, collect all pages of content from the API when returning results. :type all_pages: bool :param page: The page to show. Ignored if all_...
def list(self, **kwargs): """Return a list of roles. =====API DOCS===== Retrieve a list of objects. :param all_pages: Flag that if set, collect all pages of content from the API when returning results. :type all_pages: bool :param page: The page to show. Ignored if all_...
[ "Return", "a", "list", "of", "roles", "." ]
ansible/tower-cli
python
https://github.com/ansible/tower-cli/blob/a2b151fed93c47725018d3034848cb3a1814bed7/tower_cli/resources/role.py#L288-L311
[ "def", "list", "(", "self", ",", "*", "*", "kwargs", ")", ":", "data", ",", "self", ".", "endpoint", "=", "self", ".", "data_endpoint", "(", "kwargs", ")", "r", "=", "super", "(", "Resource", ",", "self", ")", ".", "list", "(", "*", "*", "data", ...
a2b151fed93c47725018d3034848cb3a1814bed7
valid
Resource.get
Get information about a role. =====API DOCS===== Retrieve one and exactly one object. :param pk: Primary key of the resource to be read. Tower CLI will only attempt to read *that* object if ``pk`` is provided (not ``None``). :type pk: int :param `**kwargs`: K...
tower_cli/resources/role.py
def get(self, pk=None, **kwargs): """Get information about a role. =====API DOCS===== Retrieve one and exactly one object. :param pk: Primary key of the resource to be read. Tower CLI will only attempt to read *that* object if ``pk`` is provided (not ``None``). ...
def get(self, pk=None, **kwargs): """Get information about a role. =====API DOCS===== Retrieve one and exactly one object. :param pk: Primary key of the resource to be read. Tower CLI will only attempt to read *that* object if ``pk`` is provided (not ``None``). ...
[ "Get", "information", "about", "a", "role", "." ]
ansible/tower-cli
python
https://github.com/ansible/tower-cli/blob/a2b151fed93c47725018d3034848cb3a1814bed7/tower_cli/resources/role.py#L315-L337
[ "def", "get", "(", "self", ",", "pk", "=", "None", ",", "*", "*", "kwargs", ")", ":", "if", "kwargs", ".", "pop", "(", "'include_debug_header'", ",", "True", ")", ":", "debug", ".", "log", "(", "'Getting the role record.'", ",", "header", "=", "'detail...
a2b151fed93c47725018d3034848cb3a1814bed7
valid
Resource.grant
Add a user or a team to a role. Required information: 1) Type of the role 2) Resource of the role, inventory, credential, or any other 3) A user or a team to add to the role =====API DOCS===== Add a user or a team to a role. Required information: * Type of the role. ...
tower_cli/resources/role.py
def grant(self, fail_on_found=False, **kwargs): """Add a user or a team to a role. Required information: 1) Type of the role 2) Resource of the role, inventory, credential, or any other 3) A user or a team to add to the role =====API DOCS===== Add a user or a team to a r...
def grant(self, fail_on_found=False, **kwargs): """Add a user or a team to a role. Required information: 1) Type of the role 2) Resource of the role, inventory, credential, or any other 3) A user or a team to add to the role =====API DOCS===== Add a user or a team to a r...
[ "Add", "a", "user", "or", "a", "team", "to", "a", "role", ".", "Required", "information", ":", "1", ")", "Type", "of", "the", "role", "2", ")", "Resource", "of", "the", "role", "inventory", "credential", "or", "any", "other", "3", ")", "A", "user", ...
ansible/tower-cli
python
https://github.com/ansible/tower-cli/blob/a2b151fed93c47725018d3034848cb3a1814bed7/tower_cli/resources/role.py#L345-L365
[ "def", "grant", "(", "self", ",", "fail_on_found", "=", "False", ",", "*", "*", "kwargs", ")", ":", "return", "self", ".", "role_write", "(", "fail_on_found", "=", "fail_on_found", ",", "*", "*", "kwargs", ")" ]
a2b151fed93c47725018d3034848cb3a1814bed7
valid
Resource.revoke
Remove a user or a team from a role. Required information: 1) Type of the role 2) Resource of the role, inventory, credential, or any other 3) A user or a team to add to the role =====API DOCS===== Remove a user or a team from a role. Required information: * Type of the ...
tower_cli/resources/role.py
def revoke(self, fail_on_found=False, **kwargs): """Remove a user or a team from a role. Required information: 1) Type of the role 2) Resource of the role, inventory, credential, or any other 3) A user or a team to add to the role =====API DOCS===== Remove a user or a te...
def revoke(self, fail_on_found=False, **kwargs): """Remove a user or a team from a role. Required information: 1) Type of the role 2) Resource of the role, inventory, credential, or any other 3) A user or a team to add to the role =====API DOCS===== Remove a user or a te...
[ "Remove", "a", "user", "or", "a", "team", "from", "a", "role", ".", "Required", "information", ":", "1", ")", "Type", "of", "the", "role", "2", ")", "Resource", "of", "the", "role", "inventory", "credential", "or", "any", "other", "3", ")", "A", "use...
ansible/tower-cli
python
https://github.com/ansible/tower-cli/blob/a2b151fed93c47725018d3034848cb3a1814bed7/tower_cli/resources/role.py#L373-L394
[ "def", "revoke", "(", "self", ",", "fail_on_found", "=", "False", ",", "*", "*", "kwargs", ")", ":", "return", "self", ".", "role_write", "(", "fail_on_found", "=", "fail_on_found", ",", "disassociate", "=", "True", ",", "*", "*", "kwargs", ")" ]
a2b151fed93c47725018d3034848cb3a1814bed7
valid
_compare_node_lists
Investigate two lists of workflow TreeNodes and categorize them. There will be three types of nodes after categorization: 1. Nodes that only exists in the new list. These nodes will later be created recursively. 2. Nodes that only exists in the old list. These nodes will later be de...
tower_cli/resources/workflow.py
def _compare_node_lists(old, new): ''' Investigate two lists of workflow TreeNodes and categorize them. There will be three types of nodes after categorization: 1. Nodes that only exists in the new list. These nodes will later be created recursively. 2. Nodes that only exists in the...
def _compare_node_lists(old, new): ''' Investigate two lists of workflow TreeNodes and categorize them. There will be three types of nodes after categorization: 1. Nodes that only exists in the new list. These nodes will later be created recursively. 2. Nodes that only exists in the...
[ "Investigate", "two", "lists", "of", "workflow", "TreeNodes", "and", "categorize", "them", "." ]
ansible/tower-cli
python
https://github.com/ansible/tower-cli/blob/a2b151fed93c47725018d3034848cb3a1814bed7/tower_cli/resources/workflow.py#L87-L130
[ "def", "_compare_node_lists", "(", "old", ",", "new", ")", ":", "to_expand", "=", "[", "]", "to_delete", "=", "[", "]", "to_recurse", "=", "[", "]", "old_records", "=", "{", "}", "new_records", "=", "{", "}", "for", "tree_node", "in", "old", ":", "ol...
a2b151fed93c47725018d3034848cb3a1814bed7
valid
Resource._workflow_node_structure
Takes the list results from the API in `node_results` and translates this data into a dictionary organized in a human-readable heirarchial structure
tower_cli/resources/workflow.py
def _workflow_node_structure(node_results): ''' Takes the list results from the API in `node_results` and translates this data into a dictionary organized in a human-readable heirarchial structure ''' # Build list address translation, and create backlink lists nod...
def _workflow_node_structure(node_results): ''' Takes the list results from the API in `node_results` and translates this data into a dictionary organized in a human-readable heirarchial structure ''' # Build list address translation, and create backlink lists nod...
[ "Takes", "the", "list", "results", "from", "the", "API", "in", "node_results", "and", "translates", "this", "data", "into", "a", "dictionary", "organized", "in", "a", "human", "-", "readable", "heirarchial", "structure" ]
ansible/tower-cli
python
https://github.com/ansible/tower-cli/blob/a2b151fed93c47725018d3034848cb3a1814bed7/tower_cli/resources/workflow.py#L190-L251
[ "def", "_workflow_node_structure", "(", "node_results", ")", ":", "# Build list address translation, and create backlink lists", "node_list_pos", "=", "{", "}", "for", "i", ",", "node_result", "in", "enumerate", "(", "node_results", ")", ":", "for", "rel", "in", "[", ...
a2b151fed93c47725018d3034848cb3a1814bed7
valid
Resource._get_schema
Returns a dictionary that represents the node network of the workflow job template
tower_cli/resources/workflow.py
def _get_schema(self, wfjt_id): """ Returns a dictionary that represents the node network of the workflow job template """ node_res = get_resource('node') node_results = node_res.list(workflow_job_template=wfjt_id, all_pages=True)['res...
def _get_schema(self, wfjt_id): """ Returns a dictionary that represents the node network of the workflow job template """ node_res = get_resource('node') node_results = node_res.list(workflow_job_template=wfjt_id, all_pages=True)['res...
[ "Returns", "a", "dictionary", "that", "represents", "the", "node", "network", "of", "the", "workflow", "job", "template" ]
ansible/tower-cli
python
https://github.com/ansible/tower-cli/blob/a2b151fed93c47725018d3034848cb3a1814bed7/tower_cli/resources/workflow.py#L253-L261
[ "def", "_get_schema", "(", "self", ",", "wfjt_id", ")", ":", "node_res", "=", "get_resource", "(", "'node'", ")", "node_results", "=", "node_res", ".", "list", "(", "workflow_job_template", "=", "wfjt_id", ",", "all_pages", "=", "True", ")", "[", "'results'"...
a2b151fed93c47725018d3034848cb3a1814bed7
valid
Resource.schema
Convert YAML/JSON content into workflow node objects if node_network param is given. If not, print a YAML representation of the node network. =====API DOCS===== Convert YAML/JSON content into workflow node objects if ``node_network`` param is given. If not, print a YAML represen...
tower_cli/resources/workflow.py
def schema(self, wfjt, node_network=None): """ Convert YAML/JSON content into workflow node objects if node_network param is given. If not, print a YAML representation of the node network. =====API DOCS===== Convert YAML/JSON content into workflow node objects if ``node_...
def schema(self, wfjt, node_network=None): """ Convert YAML/JSON content into workflow node objects if node_network param is given. If not, print a YAML representation of the node network. =====API DOCS===== Convert YAML/JSON content into workflow node objects if ``node_...
[ "Convert", "YAML", "/", "JSON", "content", "into", "workflow", "node", "objects", "if", "node_network", "param", "is", "given", ".", "If", "not", "print", "a", "YAML", "representation", "of", "the", "node", "network", "." ]
ansible/tower-cli
python
https://github.com/ansible/tower-cli/blob/a2b151fed93c47725018d3034848cb3a1814bed7/tower_cli/resources/workflow.py#L266-L306
[ "def", "schema", "(", "self", ",", "wfjt", ",", "node_network", "=", "None", ")", ":", "existing_network", "=", "self", ".", "_get_schema", "(", "wfjt", ")", "if", "not", "isinstance", "(", "existing_network", ",", "list", ")", ":", "existing_network", "="...
a2b151fed93c47725018d3034848cb3a1814bed7
valid
Resource.associate_notification_template
Associate a notification template from this workflow. =====API DOCS===== Associate a notification template from this workflow job template. :param workflow: The workflow job template to associate to. :type workflow: str :param notification_template: The notification template to...
tower_cli/resources/workflow.py
def associate_notification_template(self, workflow, notification_template, status): """Associate a notification template from this workflow. =====API DOCS===== Associate a notification template from this workflow job template. :param workflow: Th...
def associate_notification_template(self, workflow, notification_template, status): """Associate a notification template from this workflow. =====API DOCS===== Associate a notification template from this workflow job template. :param workflow: Th...
[ "Associate", "a", "notification", "template", "from", "this", "workflow", "." ]
ansible/tower-cli
python
https://github.com/ansible/tower-cli/blob/a2b151fed93c47725018d3034848cb3a1814bed7/tower_cli/resources/workflow.py#L315-L334
[ "def", "associate_notification_template", "(", "self", ",", "workflow", ",", "notification_template", ",", "status", ")", ":", "return", "self", ".", "_assoc", "(", "'notification_templates_%s'", "%", "status", ",", "workflow", ",", "notification_template", ")" ]
a2b151fed93c47725018d3034848cb3a1814bed7
valid
Resource.disassociate_notification_template
Disassociate a notification template from this workflow. =====API DOCS===== Disassociate a notification template from this workflow job template. :param job_template: The workflow job template to disassociate from. :type job_template: str :param notification_template: The notif...
tower_cli/resources/workflow.py
def disassociate_notification_template(self, workflow, notification_template, status): """Disassociate a notification template from this workflow. =====API DOCS===== Disassociate a notification template from this workflow job template. :param ...
def disassociate_notification_template(self, workflow, notification_template, status): """Disassociate a notification template from this workflow. =====API DOCS===== Disassociate a notification template from this workflow job template. :param ...
[ "Disassociate", "a", "notification", "template", "from", "this", "workflow", "." ]
ansible/tower-cli
python
https://github.com/ansible/tower-cli/blob/a2b151fed93c47725018d3034848cb3a1814bed7/tower_cli/resources/workflow.py#L343-L362
[ "def", "disassociate_notification_template", "(", "self", ",", "workflow", ",", "notification_template", ",", "status", ")", ":", "return", "self", ".", "_disassoc", "(", "'notification_templates_%s'", "%", "status", ",", "workflow", ",", "notification_template", ")" ...
a2b151fed93c47725018d3034848cb3a1814bed7
valid
Resource.create
Create a group. =====API DOCS===== Create a group. :param parent: Primary key or name of the group which will be the parent of created group. :type parent: str :param fail_on_found: Flag that if set, the operation fails if an object matching the unique criteria ...
tower_cli/resources/group.py
def create(self, fail_on_found=False, force_on_exists=False, **kwargs): """Create a group. =====API DOCS===== Create a group. :param parent: Primary key or name of the group which will be the parent of created group. :type parent: str :param fail_on_found: Flag that if ...
def create(self, fail_on_found=False, force_on_exists=False, **kwargs): """Create a group. =====API DOCS===== Create a group. :param parent: Primary key or name of the group which will be the parent of created group. :type parent: str :param fail_on_found: Flag that if ...
[ "Create", "a", "group", "." ]
ansible/tower-cli
python
https://github.com/ansible/tower-cli/blob/a2b151fed93c47725018d3034848cb3a1814bed7/tower_cli/resources/group.py#L49-L80
[ "def", "create", "(", "self", ",", "fail_on_found", "=", "False", ",", "force_on_exists", "=", "False", ",", "*", "*", "kwargs", ")", ":", "if", "kwargs", ".", "get", "(", "'parent'", ",", "None", ")", ":", "parent_data", "=", "self", ".", "set_child_e...
a2b151fed93c47725018d3034848cb3a1814bed7
valid
Resource.list
Return a list of groups. =====API DOCS===== Retrieve a list of groups. :param root: Flag that if set, only root groups of a specific inventory will be listed. :type root: bool :param parent: Primary key or name of the group whose child groups will be listed. :type paren...
tower_cli/resources/group.py
def list(self, root=False, **kwargs): """Return a list of groups. =====API DOCS===== Retrieve a list of groups. :param root: Flag that if set, only root groups of a specific inventory will be listed. :type root: bool :param parent: Primary key or name of the group whose...
def list(self, root=False, **kwargs): """Return a list of groups. =====API DOCS===== Retrieve a list of groups. :param root: Flag that if set, only root groups of a specific inventory will be listed. :type root: bool :param parent: Primary key or name of the group whose...
[ "Return", "a", "list", "of", "groups", "." ]
ansible/tower-cli
python
https://github.com/ansible/tower-cli/blob/a2b151fed93c47725018d3034848cb3a1814bed7/tower_cli/resources/group.py#L86-L123
[ "def", "list", "(", "self", ",", "root", "=", "False", ",", "*", "*", "kwargs", ")", ":", "# Option to list children of a parent group", "if", "kwargs", ".", "get", "(", "'parent'", ",", "None", ")", ":", "self", ".", "set_child_endpoint", "(", "parent", "...
a2b151fed93c47725018d3034848cb3a1814bed7
valid
Resource.associate
Associate this group with the specified group. =====API DOCS===== Associate this group with the specified group. :param group: Primary key or name of the child group to associate. :type group: str :param parent: Primary key or name of the parent group to associate to. :...
tower_cli/resources/group.py
def associate(self, group, parent, **kwargs): """Associate this group with the specified group. =====API DOCS===== Associate this group with the specified group. :param group: Primary key or name of the child group to associate. :type group: str :param parent: Primary k...
def associate(self, group, parent, **kwargs): """Associate this group with the specified group. =====API DOCS===== Associate this group with the specified group. :param group: Primary key or name of the child group to associate. :type group: str :param parent: Primary k...
[ "Associate", "this", "group", "with", "the", "specified", "group", "." ]
ansible/tower-cli
python
https://github.com/ansible/tower-cli/blob/a2b151fed93c47725018d3034848cb3a1814bed7/tower_cli/resources/group.py#L129-L148
[ "def", "associate", "(", "self", ",", "group", ",", "parent", ",", "*", "*", "kwargs", ")", ":", "parent_id", "=", "self", ".", "lookup_with_inventory", "(", "parent", ",", "kwargs", ".", "get", "(", "'inventory'", ",", "None", ")", ")", "[", "'id'", ...
a2b151fed93c47725018d3034848cb3a1814bed7
valid
Resource.disassociate
Disassociate this group from the specified group. =====API DOCS===== Disassociate this group with the specified group. :param group: Primary key or name of the child group to disassociate. :type group: str :param parent: Primary key or name of the parent group to disassociate f...
tower_cli/resources/group.py
def disassociate(self, group, parent, **kwargs): """Disassociate this group from the specified group. =====API DOCS===== Disassociate this group with the specified group. :param group: Primary key or name of the child group to disassociate. :type group: str :param paren...
def disassociate(self, group, parent, **kwargs): """Disassociate this group from the specified group. =====API DOCS===== Disassociate this group with the specified group. :param group: Primary key or name of the child group to disassociate. :type group: str :param paren...
[ "Disassociate", "this", "group", "from", "the", "specified", "group", "." ]
ansible/tower-cli
python
https://github.com/ansible/tower-cli/blob/a2b151fed93c47725018d3034848cb3a1814bed7/tower_cli/resources/group.py#L154-L173
[ "def", "disassociate", "(", "self", ",", "group", ",", "parent", ",", "*", "*", "kwargs", ")", ":", "parent_id", "=", "self", ".", "lookup_with_inventory", "(", "parent", ",", "kwargs", ".", "get", "(", "'inventory'", ",", "None", ")", ")", "[", "'id'"...
a2b151fed93c47725018d3034848cb3a1814bed7
valid
parse_kv
Similar to the Ansible function of the same name, parses file with a key=value pattern and stores information in a dictionary, but not as fully featured as the corresponding Ansible code.
tower_cli/utils/parser.py
def parse_kv(var_string): """Similar to the Ansible function of the same name, parses file with a key=value pattern and stores information in a dictionary, but not as fully featured as the corresponding Ansible code.""" return_dict = {} # Output updates dictionaries, so return empty one if no vals ...
def parse_kv(var_string): """Similar to the Ansible function of the same name, parses file with a key=value pattern and stores information in a dictionary, but not as fully featured as the corresponding Ansible code.""" return_dict = {} # Output updates dictionaries, so return empty one if no vals ...
[ "Similar", "to", "the", "Ansible", "function", "of", "the", "same", "name", "parses", "file", "with", "a", "key", "=", "value", "pattern", "and", "stores", "information", "in", "a", "dictionary", "but", "not", "as", "fully", "featured", "as", "the", "corre...
ansible/tower-cli
python
https://github.com/ansible/tower-cli/blob/a2b151fed93c47725018d3034848cb3a1814bed7/tower_cli/utils/parser.py#L29-L76
[ "def", "parse_kv", "(", "var_string", ")", ":", "return_dict", "=", "{", "}", "# Output updates dictionaries, so return empty one if no vals in", "if", "var_string", "is", "None", ":", "return", "{", "}", "# Python 2.6 / shlex has problems handling unicode, this is a fix", "f...
a2b151fed93c47725018d3034848cb3a1814bed7
valid
string_to_dict
Returns a dictionary given a string with yaml or json syntax. If data is not present in a key: value format, then it return an empty dictionary. Attempts processing string by 3 different methods in order: 1. as JSON 2. as YAML 3. as custom key=value syntax Throws an error if all of th...
tower_cli/utils/parser.py
def string_to_dict(var_string, allow_kv=True, require_dict=True): """Returns a dictionary given a string with yaml or json syntax. If data is not present in a key: value format, then it return an empty dictionary. Attempts processing string by 3 different methods in order: 1. as JSON 2. as...
def string_to_dict(var_string, allow_kv=True, require_dict=True): """Returns a dictionary given a string with yaml or json syntax. If data is not present in a key: value format, then it return an empty dictionary. Attempts processing string by 3 different methods in order: 1. as JSON 2. as...
[ "Returns", "a", "dictionary", "given", "a", "string", "with", "yaml", "or", "json", "syntax", ".", "If", "data", "is", "not", "present", "in", "a", "key", ":", "value", "format", "then", "it", "return", "an", "empty", "dictionary", "." ]
ansible/tower-cli
python
https://github.com/ansible/tower-cli/blob/a2b151fed93c47725018d3034848cb3a1814bed7/tower_cli/utils/parser.py#L79-L107
[ "def", "string_to_dict", "(", "var_string", ",", "allow_kv", "=", "True", ",", "require_dict", "=", "True", ")", ":", "# try:", "# # Accept all valid \"key\":value types of json", "# return_dict = json.loads(var_string)", "# assert type(return_dict) is dict", "# excep...
a2b151fed93c47725018d3034848cb3a1814bed7
valid
process_extra_vars
Returns a string that is valid JSON or YAML and contains all the variables in every extra_vars_opt inside of extra_vars_list. Args: parse_kv (bool): whether to allow key=value syntax. force_json (bool): if True, always output json.
tower_cli/utils/parser.py
def process_extra_vars(extra_vars_list, force_json=True): """Returns a string that is valid JSON or YAML and contains all the variables in every extra_vars_opt inside of extra_vars_list. Args: parse_kv (bool): whether to allow key=value syntax. force_json (bool): if True, always output json. ...
def process_extra_vars(extra_vars_list, force_json=True): """Returns a string that is valid JSON or YAML and contains all the variables in every extra_vars_opt inside of extra_vars_list. Args: parse_kv (bool): whether to allow key=value syntax. force_json (bool): if True, always output json. ...
[ "Returns", "a", "string", "that", "is", "valid", "JSON", "or", "YAML", "and", "contains", "all", "the", "variables", "in", "every", "extra_vars_opt", "inside", "of", "extra_vars_list", "." ]
ansible/tower-cli
python
https://github.com/ansible/tower-cli/blob/a2b151fed93c47725018d3034848cb3a1814bed7/tower_cli/utils/parser.py#L110-L153
[ "def", "process_extra_vars", "(", "extra_vars_list", ",", "force_json", "=", "True", ")", ":", "# Read from all the different sources and put into dictionary", "extra_vars", "=", "{", "}", "extra_vars_yaml", "=", "\"\"", "for", "extra_vars_opt", "in", "extra_vars_list", "...
a2b151fed93c47725018d3034848cb3a1814bed7
valid
ordered_dump
Expand PyYAML's built-in dumper to support parsing OrderedDict. Return a string as parse result of the original data structure, which includes OrderedDict. Args: data: the data structure to be dumped(parsed) which is supposed to contain OrderedDict. Dumper: the yaml serializer to be...
tower_cli/utils/parser.py
def ordered_dump(data, Dumper=yaml.Dumper, **kws): """Expand PyYAML's built-in dumper to support parsing OrderedDict. Return a string as parse result of the original data structure, which includes OrderedDict. Args: data: the data structure to be dumped(parsed) which is supposed to cont...
def ordered_dump(data, Dumper=yaml.Dumper, **kws): """Expand PyYAML's built-in dumper to support parsing OrderedDict. Return a string as parse result of the original data structure, which includes OrderedDict. Args: data: the data structure to be dumped(parsed) which is supposed to cont...
[ "Expand", "PyYAML", "s", "built", "-", "in", "dumper", "to", "support", "parsing", "OrderedDict", ".", "Return", "a", "string", "as", "parse", "result", "of", "the", "original", "data", "structure", "which", "includes", "OrderedDict", "." ]
ansible/tower-cli
python
https://github.com/ansible/tower-cli/blob/a2b151fed93c47725018d3034848cb3a1814bed7/tower_cli/utils/parser.py#L156-L176
[ "def", "ordered_dump", "(", "data", ",", "Dumper", "=", "yaml", ".", "Dumper", ",", "*", "*", "kws", ")", ":", "class", "OrderedDumper", "(", "Dumper", ")", ":", "pass", "def", "_dict_representer", "(", "dumper", ",", "data", ")", ":", "return", "dumpe...
a2b151fed93c47725018d3034848cb3a1814bed7
valid
Client.get_prefix
Return the appropriate URL prefix to prepend to requests, based on the host provided in settings.
tower_cli/api.py
def get_prefix(self, include_version=True): """Return the appropriate URL prefix to prepend to requests, based on the host provided in settings. """ host = settings.host if '://' not in host: host = 'https://%s' % host.strip('/') elif host.startswith('http://'...
def get_prefix(self, include_version=True): """Return the appropriate URL prefix to prepend to requests, based on the host provided in settings. """ host = settings.host if '://' not in host: host = 'https://%s' % host.strip('/') elif host.startswith('http://'...
[ "Return", "the", "appropriate", "URL", "prefix", "to", "prepend", "to", "requests", "based", "on", "the", "host", "provided", "in", "settings", "." ]
ansible/tower-cli
python
https://github.com/ansible/tower-cli/blob/a2b151fed93c47725018d3034848cb3a1814bed7/tower_cli/api.py#L184-L206
[ "def", "get_prefix", "(", "self", ",", "include_version", "=", "True", ")", ":", "host", "=", "settings", ".", "host", "if", "'://'", "not", "in", "host", ":", "host", "=", "'https://%s'", "%", "host", ".", "strip", "(", "'/'", ")", "elif", "host", "...
a2b151fed93c47725018d3034848cb3a1814bed7
valid
Client.request
Make a request to the Ansible Tower API, and return the response.
tower_cli/api.py
def request(self, method, url, *args, **kwargs): """Make a request to the Ansible Tower API, and return the response. """ # If the URL has the api/vX at the front strip it off # This is common to have if you are extracting a URL from an existing object. # For example, an...
def request(self, method, url, *args, **kwargs): """Make a request to the Ansible Tower API, and return the response. """ # If the URL has the api/vX at the front strip it off # This is common to have if you are extracting a URL from an existing object. # For example, an...
[ "Make", "a", "request", "to", "the", "Ansible", "Tower", "API", "and", "return", "the", "response", "." ]
ansible/tower-cli
python
https://github.com/ansible/tower-cli/blob/a2b151fed93c47725018d3034848cb3a1814bed7/tower_cli/api.py#L209-L315
[ "def", "request", "(", "self", ",", "method", ",", "url", ",", "*", "args", ",", "*", "*", "kwargs", ")", ":", "# If the URL has the api/vX at the front strip it off", "# This is common to have if you are extracting a URL from an existing object.", "# For example, any of the 'r...
a2b151fed93c47725018d3034848cb3a1814bed7
valid
Resource._separate
Remove None-valued and configuration-related keyworded arguments
tower_cli/resources/notification_template.py
def _separate(self, kwargs): """Remove None-valued and configuration-related keyworded arguments """ self._pop_none(kwargs) result = {} for field in Resource.config_fields: if field in kwargs: result[field] = kwargs.pop(field) if field ...
def _separate(self, kwargs): """Remove None-valued and configuration-related keyworded arguments """ self._pop_none(kwargs) result = {} for field in Resource.config_fields: if field in kwargs: result[field] = kwargs.pop(field) if field ...
[ "Remove", "None", "-", "valued", "and", "configuration", "-", "related", "keyworded", "arguments" ]
ansible/tower-cli
python
https://github.com/ansible/tower-cli/blob/a2b151fed93c47725018d3034848cb3a1814bed7/tower_cli/resources/notification_template.py#L153-L173
[ "def", "_separate", "(", "self", ",", "kwargs", ")", ":", "self", ".", "_pop_none", "(", "kwargs", ")", "result", "=", "{", "}", "for", "field", "in", "Resource", ".", "config_fields", ":", "if", "field", "in", "kwargs", ":", "result", "[", "field", ...
a2b151fed93c47725018d3034848cb3a1814bed7
valid
Resource._configuration
Combine configuration-related keyworded arguments into notification_configuration.
tower_cli/resources/notification_template.py
def _configuration(self, kwargs, config_item): """Combine configuration-related keyworded arguments into notification_configuration. """ if 'notification_configuration' not in config_item: if 'notification_type' not in kwargs: return nc = kwargs['n...
def _configuration(self, kwargs, config_item): """Combine configuration-related keyworded arguments into notification_configuration. """ if 'notification_configuration' not in config_item: if 'notification_type' not in kwargs: return nc = kwargs['n...
[ "Combine", "configuration", "-", "related", "keyworded", "arguments", "into", "notification_configuration", "." ]
ansible/tower-cli
python
https://github.com/ansible/tower-cli/blob/a2b151fed93c47725018d3034848cb3a1814bed7/tower_cli/resources/notification_template.py#L175-L191
[ "def", "_configuration", "(", "self", ",", "kwargs", ",", "config_item", ")", ":", "if", "'notification_configuration'", "not", "in", "config_item", ":", "if", "'notification_type'", "not", "in", "kwargs", ":", "return", "nc", "=", "kwargs", "[", "'notification_...
a2b151fed93c47725018d3034848cb3a1814bed7
valid
Resource.create
Create a notification template. All required configuration-related fields (required according to notification_type) must be provided. There are two types of notification template creation: isolatedly creating a new notification template and creating a new notification template ...
tower_cli/resources/notification_template.py
def create(self, fail_on_found=False, force_on_exists=False, **kwargs): """Create a notification template. All required configuration-related fields (required according to notification_type) must be provided. There are two types of notification template creation: isolatedly cre...
def create(self, fail_on_found=False, force_on_exists=False, **kwargs): """Create a notification template. All required configuration-related fields (required according to notification_type) must be provided. There are two types of notification template creation: isolatedly cre...
[ "Create", "a", "notification", "template", "." ]
ansible/tower-cli
python
https://github.com/ansible/tower-cli/blob/a2b151fed93c47725018d3034848cb3a1814bed7/tower_cli/resources/notification_template.py#L199-L263
[ "def", "create", "(", "self", ",", "fail_on_found", "=", "False", ",", "force_on_exists", "=", "False", ",", "*", "*", "kwargs", ")", ":", "config_item", "=", "self", ".", "_separate", "(", "kwargs", ")", "jt_id", "=", "kwargs", ".", "pop", "(", "'job_...
a2b151fed93c47725018d3034848cb3a1814bed7
valid
Resource.modify
Modify an existing notification template. Not all required configuration-related fields (required according to notification_type) should be provided. Fields in the resource's `identity` tuple can be used in lieu of a primary key for a lookup; in such a case, only other fields are ...
tower_cli/resources/notification_template.py
def modify(self, pk=None, create_on_missing=False, **kwargs): """Modify an existing notification template. Not all required configuration-related fields (required according to notification_type) should be provided. Fields in the resource's `identity` tuple can be used in lieu of a ...
def modify(self, pk=None, create_on_missing=False, **kwargs): """Modify an existing notification template. Not all required configuration-related fields (required according to notification_type) should be provided. Fields in the resource's `identity` tuple can be used in lieu of a ...
[ "Modify", "an", "existing", "notification", "template", "." ]
ansible/tower-cli
python
https://github.com/ansible/tower-cli/blob/a2b151fed93c47725018d3034848cb3a1814bed7/tower_cli/resources/notification_template.py#L266-L333
[ "def", "modify", "(", "self", ",", "pk", "=", "None", ",", "create_on_missing", "=", "False", ",", "*", "*", "kwargs", ")", ":", "# Create the resource if needed.", "if", "pk", "is", "None", "and", "create_on_missing", ":", "try", ":", "self", ".", "get", ...
a2b151fed93c47725018d3034848cb3a1814bed7
valid
Resource.delete
Remove the given notification template. Note here configuration-related fields like 'notification_configuration' and 'channels' will not be used even provided. If `fail_on_missing` is True, then the object's not being found is considered a failure; otherwise, a success with no ...
tower_cli/resources/notification_template.py
def delete(self, pk=None, fail_on_missing=False, **kwargs): """Remove the given notification template. Note here configuration-related fields like 'notification_configuration' and 'channels' will not be used even provided. If `fail_on_missing` is True, then the object's not bei...
def delete(self, pk=None, fail_on_missing=False, **kwargs): """Remove the given notification template. Note here configuration-related fields like 'notification_configuration' and 'channels' will not be used even provided. If `fail_on_missing` is True, then the object's not bei...
[ "Remove", "the", "given", "notification", "template", "." ]
ansible/tower-cli
python
https://github.com/ansible/tower-cli/blob/a2b151fed93c47725018d3034848cb3a1814bed7/tower_cli/resources/notification_template.py#L336-L363
[ "def", "delete", "(", "self", ",", "pk", "=", "None", ",", "fail_on_missing", "=", "False", ",", "*", "*", "kwargs", ")", ":", "self", ".", "_separate", "(", "kwargs", ")", "return", "super", "(", "Resource", ",", "self", ")", ".", "delete", "(", "...
a2b151fed93c47725018d3034848cb3a1814bed7
valid
Resource.list
Return a list of notification templates. Note here configuration-related fields like 'notification_configuration' and 'channels' will not be used even provided. If one or more filters are provided through keyword arguments, filter the results accordingly. If no filters...
tower_cli/resources/notification_template.py
def list(self, all_pages=False, **kwargs): """Return a list of notification templates. Note here configuration-related fields like 'notification_configuration' and 'channels' will not be used even provided. If one or more filters are provided through keyword arguments, ...
def list(self, all_pages=False, **kwargs): """Return a list of notification templates. Note here configuration-related fields like 'notification_configuration' and 'channels' will not be used even provided. If one or more filters are provided through keyword arguments, ...
[ "Return", "a", "list", "of", "notification", "templates", "." ]
ansible/tower-cli
python
https://github.com/ansible/tower-cli/blob/a2b151fed93c47725018d3034848cb3a1814bed7/tower_cli/resources/notification_template.py#L366-L394
[ "def", "list", "(", "self", ",", "all_pages", "=", "False", ",", "*", "*", "kwargs", ")", ":", "self", ".", "_separate", "(", "kwargs", ")", "return", "super", "(", "Resource", ",", "self", ")", ".", "list", "(", "all_pages", "=", "all_pages", ",", ...
a2b151fed93c47725018d3034848cb3a1814bed7
valid
Resource.get
Return one and exactly one notification template. Note here configuration-related fields like 'notification_configuration' and 'channels' will not be used even provided. Lookups may be through a primary key, specified as a positional argument, and/or through filters specified t...
tower_cli/resources/notification_template.py
def get(self, pk=None, **kwargs): """Return one and exactly one notification template. Note here configuration-related fields like 'notification_configuration' and 'channels' will not be used even provided. Lookups may be through a primary key, specified as a positional ...
def get(self, pk=None, **kwargs): """Return one and exactly one notification template. Note here configuration-related fields like 'notification_configuration' and 'channels' will not be used even provided. Lookups may be through a primary key, specified as a positional ...
[ "Return", "one", "and", "exactly", "one", "notification", "template", "." ]
ansible/tower-cli
python
https://github.com/ansible/tower-cli/blob/a2b151fed93c47725018d3034848cb3a1814bed7/tower_cli/resources/notification_template.py#L397-L422
[ "def", "get", "(", "self", ",", "pk", "=", "None", ",", "*", "*", "kwargs", ")", ":", "self", ".", "_separate", "(", "kwargs", ")", "return", "super", "(", "Resource", ",", "self", ")", ".", "get", "(", "pk", "=", "pk", ",", "*", "*", "kwargs",...
a2b151fed93c47725018d3034848cb3a1814bed7
valid
config_from_environment
Read tower-cli config values from the environment if present, being careful not to override config values that were explicitly passed in.
tower_cli/conf.py
def config_from_environment(): """Read tower-cli config values from the environment if present, being careful not to override config values that were explicitly passed in. """ kwargs = {} for k in CONFIG_OPTIONS: env = 'TOWER_' + k.upper() v = os.getenv(env, None) if v is not...
def config_from_environment(): """Read tower-cli config values from the environment if present, being careful not to override config values that were explicitly passed in. """ kwargs = {} for k in CONFIG_OPTIONS: env = 'TOWER_' + k.upper() v = os.getenv(env, None) if v is not...
[ "Read", "tower", "-", "cli", "config", "values", "from", "the", "environment", "if", "present", "being", "careful", "not", "to", "override", "config", "values", "that", "were", "explicitly", "passed", "in", "." ]
ansible/tower-cli
python
https://github.com/ansible/tower-cli/blob/a2b151fed93c47725018d3034848cb3a1814bed7/tower_cli/conf.py#L337-L347
[ "def", "config_from_environment", "(", ")", ":", "kwargs", "=", "{", "}", "for", "k", "in", "CONFIG_OPTIONS", ":", "env", "=", "'TOWER_'", "+", "k", ".", "upper", "(", ")", "v", "=", "os", ".", "getenv", "(", "env", ",", "None", ")", "if", "v", "...
a2b151fed93c47725018d3034848cb3a1814bed7
valid
with_global_options
Apply the global options that we desire on every method within tower-cli to the given click command.
tower_cli/conf.py
def with_global_options(method): """Apply the global options that we desire on every method within tower-cli to the given click command. """ # Create global options for the Tower host, username, and password. # # These are runtime options that will override the configuration file # settings....
def with_global_options(method): """Apply the global options that we desire on every method within tower-cli to the given click command. """ # Create global options for the Tower host, username, and password. # # These are runtime options that will override the configuration file # settings....
[ "Apply", "the", "global", "options", "that", "we", "desire", "on", "every", "method", "within", "tower", "-", "cli", "to", "the", "given", "click", "command", "." ]
ansible/tower-cli
python
https://github.com/ansible/tower-cli/blob/a2b151fed93c47725018d3034848cb3a1814bed7/tower_cli/conf.py#L377-L491
[ "def", "with_global_options", "(", "method", ")", ":", "# Create global options for the Tower host, username, and password.", "#", "# These are runtime options that will override the configuration file", "# settings.", "method", "=", "click", ".", "option", "(", "'-h'", ",", "'--...
a2b151fed93c47725018d3034848cb3a1814bed7
valid
pop_option
Used to remove an option applied by the @click.option decorator. This is useful for when you want to subclass a decorated resource command and *don't* want all of the options provided by the parent class' implementation.
tower_cli/conf.py
def pop_option(function, name): """ Used to remove an option applied by the @click.option decorator. This is useful for when you want to subclass a decorated resource command and *don't* want all of the options provided by the parent class' implementation. """ for option in getattr(function...
def pop_option(function, name): """ Used to remove an option applied by the @click.option decorator. This is useful for when you want to subclass a decorated resource command and *don't* want all of the options provided by the parent class' implementation. """ for option in getattr(function...
[ "Used", "to", "remove", "an", "option", "applied", "by", "the", "@click", ".", "option", "decorator", "." ]
ansible/tower-cli
python
https://github.com/ansible/tower-cli/blob/a2b151fed93c47725018d3034848cb3a1814bed7/tower_cli/conf.py#L494-L504
[ "def", "pop_option", "(", "function", ",", "name", ")", ":", "for", "option", "in", "getattr", "(", "function", ",", "'__click_params__'", ",", "tuple", "(", ")", ")", ":", "if", "option", ".", "name", "==", "name", ":", "function", ".", "__click_params_...
a2b151fed93c47725018d3034848cb3a1814bed7
valid
Parser._read
Read the configuration from the given file. If the file lacks any section header, add a [general] section header that encompasses the whole thing.
tower_cli/conf.py
def _read(self, fp, fpname): """Read the configuration from the given file. If the file lacks any section header, add a [general] section header that encompasses the whole thing. """ # Attempt to read the file using the superclass implementation. # # Check the pe...
def _read(self, fp, fpname): """Read the configuration from the given file. If the file lacks any section header, add a [general] section header that encompasses the whole thing. """ # Attempt to read the file using the superclass implementation. # # Check the pe...
[ "Read", "the", "configuration", "from", "the", "given", "file", "." ]
ansible/tower-cli
python
https://github.com/ansible/tower-cli/blob/a2b151fed93c47725018d3034848cb3a1814bed7/tower_cli/conf.py#L60-L88
[ "def", "_read", "(", "self", ",", "fp", ",", "fpname", ")", ":", "# Attempt to read the file using the superclass implementation.", "#", "# Check the permissions of the file we are considering reading", "# if the file exists and the permissions expose it to reads from", "# other users, r...
a2b151fed93c47725018d3034848cb3a1814bed7
valid
Settings.set_or_reset_runtime_param
Maintains the context of the runtime settings for invoking a command. This should be called by a click.option callback, and only called once for each setting for each command invocation. If the setting exists, it follows that the runtime settings are stale, so the entire runtim...
tower_cli/conf.py
def set_or_reset_runtime_param(self, key, value): """Maintains the context of the runtime settings for invoking a command. This should be called by a click.option callback, and only called once for each setting for each command invocation. If the setting exists, it follows that...
def set_or_reset_runtime_param(self, key, value): """Maintains the context of the runtime settings for invoking a command. This should be called by a click.option callback, and only called once for each setting for each command invocation. If the setting exists, it follows that...
[ "Maintains", "the", "context", "of", "the", "runtime", "settings", "for", "invoking", "a", "command", "." ]
ansible/tower-cli
python
https://github.com/ansible/tower-cli/blob/a2b151fed93c47725018d3034848cb3a1814bed7/tower_cli/conf.py#L263-L279
[ "def", "set_or_reset_runtime_param", "(", "self", ",", "key", ",", "value", ")", ":", "if", "self", ".", "_runtime", ".", "has_option", "(", "'general'", ",", "key", ")", ":", "self", ".", "_runtime", "=", "self", ".", "_new_parser", "(", ")", "if", "v...
a2b151fed93c47725018d3034848cb3a1814bed7
valid
Settings.runtime_values
=====API DOCS===== Context manager that temporarily override runtime level configurations. :param kwargs: Keyword arguments specifying runtime configuration settings. :type kwargs: arbitrary keyword arguments :returns: N/A :Example: >>> import tower_cli >>> fro...
tower_cli/conf.py
def runtime_values(self, **kwargs): """ =====API DOCS===== Context manager that temporarily override runtime level configurations. :param kwargs: Keyword arguments specifying runtime configuration settings. :type kwargs: arbitrary keyword arguments :returns: N/A ...
def runtime_values(self, **kwargs): """ =====API DOCS===== Context manager that temporarily override runtime level configurations. :param kwargs: Keyword arguments specifying runtime configuration settings. :type kwargs: arbitrary keyword arguments :returns: N/A ...
[ "=====", "API", "DOCS", "=====", "Context", "manager", "that", "temporarily", "override", "runtime", "level", "configurations", "." ]
ansible/tower-cli
python
https://github.com/ansible/tower-cli/blob/a2b151fed93c47725018d3034848cb3a1814bed7/tower_cli/conf.py#L282-L334
[ "def", "runtime_values", "(", "self", ",", "*", "*", "kwargs", ")", ":", "# Coerce all values to strings (to be coerced back by configparser", "# later) and defenestrate any None values.", "for", "k", ",", "v", "in", "copy", ".", "copy", "(", "kwargs", ")", ".", "item...
a2b151fed93c47725018d3034848cb3a1814bed7
valid
Resource.launch
Launch a new job based on a job template. Creates a new job in Ansible Tower, immediately starts it, and returns back an ID in order for its status to be monitored. =====API DOCS===== Launch a new job based on a job template. :param job_template: Primary key or name of the job...
tower_cli/resources/job.py
def launch(self, job_template=None, monitor=False, wait=False, timeout=None, no_input=True, extra_vars=None, **kwargs): """Launch a new job based on a job template. Creates a new job in Ansible Tower, immediately starts it, and returns back an ID in order for its status to be mon...
def launch(self, job_template=None, monitor=False, wait=False, timeout=None, no_input=True, extra_vars=None, **kwargs): """Launch a new job based on a job template. Creates a new job in Ansible Tower, immediately starts it, and returns back an ID in order for its status to be mon...
[ "Launch", "a", "new", "job", "based", "on", "a", "job", "template", "." ]
ansible/tower-cli
python
https://github.com/ansible/tower-cli/blob/a2b151fed93c47725018d3034848cb3a1814bed7/tower_cli/resources/job.py#L79-L252
[ "def", "launch", "(", "self", ",", "job_template", "=", "None", ",", "monitor", "=", "False", ",", "wait", "=", "False", ",", "timeout", "=", "None", ",", "no_input", "=", "True", ",", "extra_vars", "=", "None", ",", "*", "*", "kwargs", ")", ":", "...
a2b151fed93c47725018d3034848cb3a1814bed7
valid
Resource.launch
Launch a new ad-hoc command. Runs a user-defined command from Ansible Tower, immediately starts it, and returns back an ID in order for its status to be monitored. =====API DOCS===== Launch a new ad-hoc command. :param monitor: Flag that if set, immediately calls ``monitor`` o...
tower_cli/resources/ad_hoc.py
def launch(self, monitor=False, wait=False, timeout=None, **kwargs): """Launch a new ad-hoc command. Runs a user-defined command from Ansible Tower, immediately starts it, and returns back an ID in order for its status to be monitored. =====API DOCS===== Launch a new ad-hoc com...
def launch(self, monitor=False, wait=False, timeout=None, **kwargs): """Launch a new ad-hoc command. Runs a user-defined command from Ansible Tower, immediately starts it, and returns back an ID in order for its status to be monitored. =====API DOCS===== Launch a new ad-hoc com...
[ "Launch", "a", "new", "ad", "-", "hoc", "command", "." ]
ansible/tower-cli
python
https://github.com/ansible/tower-cli/blob/a2b151fed93c47725018d3034848cb3a1814bed7/tower_cli/resources/ad_hoc.py#L82-L137
[ "def", "launch", "(", "self", ",", "monitor", "=", "False", ",", "wait", "=", "False", ",", "timeout", "=", "None", ",", "*", "*", "kwargs", ")", ":", "# This feature only exists for versions 2.2 and up", "r", "=", "client", ".", "get", "(", "'/'", ")", ...
a2b151fed93c47725018d3034848cb3a1814bed7
valid
ResSubcommand._auto_help_text
Given a method with a docstring, convert the docstring to more CLI appropriate wording, and also disambiguate the word "object" on the base class docstrings.
tower_cli/cli/resource.py
def _auto_help_text(self, help_text): """Given a method with a docstring, convert the docstring to more CLI appropriate wording, and also disambiguate the word "object" on the base class docstrings. """ # Delete API docs if there are any. api_doc_delimiter = '=====API DOC...
def _auto_help_text(self, help_text): """Given a method with a docstring, convert the docstring to more CLI appropriate wording, and also disambiguate the word "object" on the base class docstrings. """ # Delete API docs if there are any. api_doc_delimiter = '=====API DOC...
[ "Given", "a", "method", "with", "a", "docstring", "convert", "the", "docstring", "to", "more", "CLI", "appropriate", "wording", "and", "also", "disambiguate", "the", "word", "object", "on", "the", "base", "class", "docstrings", "." ]
ansible/tower-cli
python
https://github.com/ansible/tower-cli/blob/a2b151fed93c47725018d3034848cb3a1814bed7/tower_cli/cli/resource.py#L59-L95
[ "def", "_auto_help_text", "(", "self", ",", "help_text", ")", ":", "# Delete API docs if there are any.", "api_doc_delimiter", "=", "'=====API DOCS====='", "begin_api_doc", "=", "help_text", ".", "find", "(", "api_doc_delimiter", ")", "if", "begin_api_doc", ">=", "0", ...
a2b151fed93c47725018d3034848cb3a1814bed7
valid
ResSubcommand._echo_method
Given a method, return a method that runs the internal method and echos the result.
tower_cli/cli/resource.py
def _echo_method(self, method): """Given a method, return a method that runs the internal method and echos the result. """ @functools.wraps(method) def func(*args, **kwargs): # Echo warning if this method is deprecated. if getattr(method, 'deprecated', Fal...
def _echo_method(self, method): """Given a method, return a method that runs the internal method and echos the result. """ @functools.wraps(method) def func(*args, **kwargs): # Echo warning if this method is deprecated. if getattr(method, 'deprecated', Fal...
[ "Given", "a", "method", "return", "a", "method", "that", "runs", "the", "internal", "method", "and", "echos", "the", "result", "." ]
ansible/tower-cli
python
https://github.com/ansible/tower-cli/blob/a2b151fed93c47725018d3034848cb3a1814bed7/tower_cli/cli/resource.py#L97-L124
[ "def", "_echo_method", "(", "self", ",", "method", ")", ":", "@", "functools", ".", "wraps", "(", "method", ")", "def", "func", "(", "*", "args", ",", "*", "*", "kwargs", ")", ":", "# Echo warning if this method is deprecated.", "if", "getattr", "(", "meth...
a2b151fed93c47725018d3034848cb3a1814bed7
valid
ResSubcommand._format_yaml
Convert the payload into a YAML string with proper indentation and return it.
tower_cli/cli/resource.py
def _format_yaml(self, payload): """Convert the payload into a YAML string with proper indentation and return it. """ return parser.ordered_dump(payload, Dumper=yaml.SafeDumper, default_flow_style=False)
def _format_yaml(self, payload): """Convert the payload into a YAML string with proper indentation and return it. """ return parser.ordered_dump(payload, Dumper=yaml.SafeDumper, default_flow_style=False)
[ "Convert", "the", "payload", "into", "a", "YAML", "string", "with", "proper", "indentation", "and", "return", "it", "." ]
ansible/tower-cli
python
https://github.com/ansible/tower-cli/blob/a2b151fed93c47725018d3034848cb3a1814bed7/tower_cli/cli/resource.py#L132-L137
[ "def", "_format_yaml", "(", "self", ",", "payload", ")", ":", "return", "parser", ".", "ordered_dump", "(", "payload", ",", "Dumper", "=", "yaml", ".", "SafeDumper", ",", "default_flow_style", "=", "False", ")" ]
a2b151fed93c47725018d3034848cb3a1814bed7
valid
ResSubcommand._format_id
Echos only the id
tower_cli/cli/resource.py
def _format_id(self, payload): """Echos only the id""" if 'id' in payload: return str(payload['id']) if 'results' in payload: return ' '.join([six.text_type(item['id']) for item in payload['results']]) raise MultipleRelatedError('Could not serialize output with id...
def _format_id(self, payload): """Echos only the id""" if 'id' in payload: return str(payload['id']) if 'results' in payload: return ' '.join([six.text_type(item['id']) for item in payload['results']]) raise MultipleRelatedError('Could not serialize output with id...
[ "Echos", "only", "the", "id" ]
ansible/tower-cli
python
https://github.com/ansible/tower-cli/blob/a2b151fed93c47725018d3034848cb3a1814bed7/tower_cli/cli/resource.py#L139-L145
[ "def", "_format_id", "(", "self", ",", "payload", ")", ":", "if", "'id'", "in", "payload", ":", "return", "str", "(", "payload", "[", "'id'", "]", ")", "if", "'results'", "in", "payload", ":", "return", "' '", ".", "join", "(", "[", "six", ".", "te...
a2b151fed93c47725018d3034848cb3a1814bed7
valid
ResSubcommand._format_human
Convert the payload into an ASCII table suitable for printing on screen and return it.
tower_cli/cli/resource.py
def _format_human(self, payload): """Convert the payload into an ASCII table suitable for printing on screen and return it. """ page = None total_pages = None # What are the columns we will show? columns = [field.name for field in self.resource.fields ...
def _format_human(self, payload): """Convert the payload into an ASCII table suitable for printing on screen and return it. """ page = None total_pages = None # What are the columns we will show? columns = [field.name for field in self.resource.fields ...
[ "Convert", "the", "payload", "into", "an", "ASCII", "table", "suitable", "for", "printing", "on", "screen", "and", "return", "it", "." ]
ansible/tower-cli
python
https://github.com/ansible/tower-cli/blob/a2b151fed93c47725018d3034848cb3a1814bed7/tower_cli/cli/resource.py#L156-L271
[ "def", "_format_human", "(", "self", ",", "payload", ")", ":", "page", "=", "None", "total_pages", "=", "None", "# What are the columns we will show?", "columns", "=", "[", "field", ".", "name", "for", "field", "in", "self", ".", "resource", ".", "fields", "...
a2b151fed93c47725018d3034848cb3a1814bed7
valid
ResSubcommand.get_command
Retrieve the appropriate method from the Resource, decorate it as a click command, and return that method.
tower_cli/cli/resource.py
def get_command(self, ctx, name): """Retrieve the appropriate method from the Resource, decorate it as a click command, and return that method. """ # Sanity check: Does a method exist corresponding to this # command? If not, None is returned for click to raise # exception...
def get_command(self, ctx, name): """Retrieve the appropriate method from the Resource, decorate it as a click command, and return that method. """ # Sanity check: Does a method exist corresponding to this # command? If not, None is returned for click to raise # exception...
[ "Retrieve", "the", "appropriate", "method", "from", "the", "Resource", "decorate", "it", "as", "a", "click", "command", "and", "return", "that", "method", "." ]
ansible/tower-cli
python
https://github.com/ansible/tower-cli/blob/a2b151fed93c47725018d3034848cb3a1814bed7/tower_cli/cli/resource.py#L273-L380
[ "def", "get_command", "(", "self", ",", "ctx", ",", "name", ")", ":", "# Sanity check: Does a method exist corresponding to this", "# command? If not, None is returned for click to raise", "# exception.", "if", "not", "hasattr", "(", "self", ".", "resource", ",", "name", ...
a2b151fed93c47725018d3034848cb3a1814bed7
valid
Resource.update
Update the given inventory source. =====API DOCS===== Update the given inventory source. :param inventory_source: Primary key or name of the inventory source to be updated. :type inventory_source: str :param monitor: Flag that if set, immediately calls ``monitor`` on the newly ...
tower_cli/resources/inventory_source.py
def update(self, inventory_source, monitor=False, wait=False, timeout=None, **kwargs): """Update the given inventory source. =====API DOCS===== Update the given inventory source. :param inventory_source: Primary key or name of the inventory source to be updated. ...
def update(self, inventory_source, monitor=False, wait=False, timeout=None, **kwargs): """Update the given inventory source. =====API DOCS===== Update the given inventory source. :param inventory_source: Primary key or name of the inventory source to be updated. ...
[ "Update", "the", "given", "inventory", "source", "." ]
ansible/tower-cli
python
https://github.com/ansible/tower-cli/blob/a2b151fed93c47725018d3034848cb3a1814bed7/tower_cli/resources/inventory_source.py#L69-L123
[ "def", "update", "(", "self", ",", "inventory_source", ",", "monitor", "=", "False", ",", "wait", "=", "False", ",", "timeout", "=", "None", ",", "*", "*", "kwargs", ")", ":", "# Establish that we are able to update this inventory source", "# at all.", "debug", ...
a2b151fed93c47725018d3034848cb3a1814bed7
valid
Resource.list
Return a list of hosts. =====API DOCS===== Retrieve a list of hosts. :param group: Primary key or name of the group whose hosts will be listed. :type group: str :param all_pages: Flag that if set, collect all pages of content from the API when returning results. :type a...
tower_cli/resources/host.py
def list(self, group=None, host_filter=None, **kwargs): """Return a list of hosts. =====API DOCS===== Retrieve a list of hosts. :param group: Primary key or name of the group whose hosts will be listed. :type group: str :param all_pages: Flag that if set, collect all pa...
def list(self, group=None, host_filter=None, **kwargs): """Return a list of hosts. =====API DOCS===== Retrieve a list of hosts. :param group: Primary key or name of the group whose hosts will be listed. :type group: str :param all_pages: Flag that if set, collect all pa...
[ "Return", "a", "list", "of", "hosts", "." ]
ansible/tower-cli
python
https://github.com/ansible/tower-cli/blob/a2b151fed93c47725018d3034848cb3a1814bed7/tower_cli/resources/host.py#L42-L66
[ "def", "list", "(", "self", ",", "group", "=", "None", ",", "host_filter", "=", "None", ",", "*", "*", "kwargs", ")", ":", "if", "group", ":", "kwargs", "[", "'query'", "]", "=", "kwargs", ".", "get", "(", "'query'", ",", "(", ")", ")", "+", "(...
a2b151fed93c47725018d3034848cb3a1814bed7
valid
Resource.list_facts
Return a JSON object of all available facts of the given host. Note global option --format is not available here, as the output would always be JSON-formatted. =====API DOCS===== List all available facts of the given host. :param pk: Primary key of the target host. :type pk: i...
tower_cli/resources/host.py
def list_facts(self, pk=None, **kwargs): """Return a JSON object of all available facts of the given host. Note global option --format is not available here, as the output would always be JSON-formatted. =====API DOCS===== List all available facts of the given host. :param pk:...
def list_facts(self, pk=None, **kwargs): """Return a JSON object of all available facts of the given host. Note global option --format is not available here, as the output would always be JSON-formatted. =====API DOCS===== List all available facts of the given host. :param pk:...
[ "Return", "a", "JSON", "object", "of", "all", "available", "facts", "of", "the", "given", "host", "." ]
ansible/tower-cli
python
https://github.com/ansible/tower-cli/blob/a2b151fed93c47725018d3034848cb3a1814bed7/tower_cli/resources/host.py#L69-L86
[ "def", "list_facts", "(", "self", ",", "pk", "=", "None", ",", "*", "*", "kwargs", ")", ":", "res", "=", "self", ".", "get", "(", "pk", "=", "pk", ",", "*", "*", "kwargs", ")", "url", "=", "self", ".", "endpoint", "+", "'%d/%s/'", "%", "(", "...
a2b151fed93c47725018d3034848cb3a1814bed7
valid
TowerCLI.format_command_subsection
Writes help text for a sub-section of commands, specifically to be reused for resource commands and system/configuration commands.
tower_cli/cli/base.py
def format_command_subsection(self, ctx, formatter, commands, header): """Writes help text for a sub-section of commands, specifically to be reused for resource commands and system/configuration commands. """ rows = [] for subcommand in commands: cmd = self.ge...
def format_command_subsection(self, ctx, formatter, commands, header): """Writes help text for a sub-section of commands, specifically to be reused for resource commands and system/configuration commands. """ rows = [] for subcommand in commands: cmd = self.ge...
[ "Writes", "help", "text", "for", "a", "sub", "-", "section", "of", "commands", "specifically", "to", "be", "reused", "for", "resource", "commands", "and", "system", "/", "configuration", "commands", "." ]
ansible/tower-cli
python
https://github.com/ansible/tower-cli/blob/a2b151fed93c47725018d3034848cb3a1814bed7/tower_cli/cli/base.py#L41-L58
[ "def", "format_command_subsection", "(", "self", ",", "ctx", ",", "formatter", ",", "commands", ",", "header", ")", ":", "rows", "=", "[", "]", "for", "subcommand", "in", "commands", ":", "cmd", "=", "self", ".", "get_command", "(", "ctx", ",", "subcomma...
a2b151fed93c47725018d3034848cb3a1814bed7
valid
TowerCLI.format_commands
Extra format methods for multi methods that adds all the commands after the options.
tower_cli/cli/base.py
def format_commands(self, ctx, formatter): """Extra format methods for multi methods that adds all the commands after the options. """ self.format_command_subsection( ctx, formatter, self.list_misc_commands(), 'Commands' ) self.format_command_subsection( ...
def format_commands(self, ctx, formatter): """Extra format methods for multi methods that adds all the commands after the options. """ self.format_command_subsection( ctx, formatter, self.list_misc_commands(), 'Commands' ) self.format_command_subsection( ...
[ "Extra", "format", "methods", "for", "multi", "methods", "that", "adds", "all", "the", "commands", "after", "the", "options", "." ]
ansible/tower-cli
python
https://github.com/ansible/tower-cli/blob/a2b151fed93c47725018d3034848cb3a1814bed7/tower_cli/cli/base.py#L60-L69
[ "def", "format_commands", "(", "self", ",", "ctx", ",", "formatter", ")", ":", "self", ".", "format_command_subsection", "(", "ctx", ",", "formatter", ",", "self", ".", "list_misc_commands", "(", ")", ",", "'Commands'", ")", "self", ".", "format_command_subsec...
a2b151fed93c47725018d3034848cb3a1814bed7
valid
TowerCLI.list_commands
Return a list of commands present in the commands and resources folders, but not subcommands.
tower_cli/cli/base.py
def list_commands(self, ctx): """Return a list of commands present in the commands and resources folders, but not subcommands. """ commands = set(self.list_resource_commands()) commands.union(set(self.list_misc_commands())) return sorted(commands)
def list_commands(self, ctx): """Return a list of commands present in the commands and resources folders, but not subcommands. """ commands = set(self.list_resource_commands()) commands.union(set(self.list_misc_commands())) return sorted(commands)
[ "Return", "a", "list", "of", "commands", "present", "in", "the", "commands", "and", "resources", "folders", "but", "not", "subcommands", "." ]
ansible/tower-cli
python
https://github.com/ansible/tower-cli/blob/a2b151fed93c47725018d3034848cb3a1814bed7/tower_cli/cli/base.py#L71-L77
[ "def", "list_commands", "(", "self", ",", "ctx", ")", ":", "commands", "=", "set", "(", "self", ".", "list_resource_commands", "(", ")", ")", "commands", ".", "union", "(", "set", "(", "self", ".", "list_misc_commands", "(", ")", ")", ")", "return", "s...
a2b151fed93c47725018d3034848cb3a1814bed7
valid
TowerCLI.list_resource_commands
Returns a list of multi-commands for each resource type.
tower_cli/cli/base.py
def list_resource_commands(self): """Returns a list of multi-commands for each resource type. """ resource_path = os.path.abspath(os.path.join( os.path.dirname(__file__), os.pardir, 'resources' )) answer = set([]) for _, name, _ in pkgu...
def list_resource_commands(self): """Returns a list of multi-commands for each resource type. """ resource_path = os.path.abspath(os.path.join( os.path.dirname(__file__), os.pardir, 'resources' )) answer = set([]) for _, name, _ in pkgu...
[ "Returns", "a", "list", "of", "multi", "-", "commands", "for", "each", "resource", "type", "." ]
ansible/tower-cli
python
https://github.com/ansible/tower-cli/blob/a2b151fed93c47725018d3034848cb3a1814bed7/tower_cli/cli/base.py#L79-L92
[ "def", "list_resource_commands", "(", "self", ")", ":", "resource_path", "=", "os", ".", "path", ".", "abspath", "(", "os", ".", "path", ".", "join", "(", "os", ".", "path", ".", "dirname", "(", "__file__", ")", ",", "os", ".", "pardir", ",", "'resou...
a2b151fed93c47725018d3034848cb3a1814bed7
valid
TowerCLI.list_misc_commands
Returns a list of global commands, realted to CLI configuration or system management in general.
tower_cli/cli/base.py
def list_misc_commands(self): """Returns a list of global commands, realted to CLI configuration or system management in general. """ answer = set([]) for cmd_name in misc.__all__: answer.add(cmd_name) return sorted(answer)
def list_misc_commands(self): """Returns a list of global commands, realted to CLI configuration or system management in general. """ answer = set([]) for cmd_name in misc.__all__: answer.add(cmd_name) return sorted(answer)
[ "Returns", "a", "list", "of", "global", "commands", "realted", "to", "CLI", "configuration", "or", "system", "management", "in", "general", "." ]
ansible/tower-cli
python
https://github.com/ansible/tower-cli/blob/a2b151fed93c47725018d3034848cb3a1814bed7/tower_cli/cli/base.py#L94-L101
[ "def", "list_misc_commands", "(", "self", ")", ":", "answer", "=", "set", "(", "[", "]", ")", "for", "cmd_name", "in", "misc", ".", "__all__", ":", "answer", ".", "add", "(", "cmd_name", ")", "return", "sorted", "(", "answer", ")" ]
a2b151fed93c47725018d3034848cb3a1814bed7
valid
TowerCLI.get_command
Given a command identified by its name, import the appropriate module and return the decorated command. Resources are automatically commands, but if both a resource and a command are defined, the command takes precedence.
tower_cli/cli/base.py
def get_command(self, ctx, name): """Given a command identified by its name, import the appropriate module and return the decorated command. Resources are automatically commands, but if both a resource and a command are defined, the command takes precedence. """ # First,...
def get_command(self, ctx, name): """Given a command identified by its name, import the appropriate module and return the decorated command. Resources are automatically commands, but if both a resource and a command are defined, the command takes precedence. """ # First,...
[ "Given", "a", "command", "identified", "by", "its", "name", "import", "the", "appropriate", "module", "and", "return", "the", "decorated", "command", "." ]
ansible/tower-cli
python
https://github.com/ansible/tower-cli/blob/a2b151fed93c47725018d3034848cb3a1814bed7/tower_cli/cli/base.py#L103-L123
[ "def", "get_command", "(", "self", ",", "ctx", ",", "name", ")", ":", "# First, attempt to get a basic command from `tower_cli.api.misc`.", "if", "name", "in", "misc", ".", "__all__", ":", "return", "getattr", "(", "misc", ",", "name", ")", "# No command was found; ...
a2b151fed93c47725018d3034848cb3a1814bed7
valid
command
Mark this method as a CLI command. This will only have any meaningful effect in methods that are members of a Resource subclass.
tower_cli/resources/__init__.py
def command(method=None, **kwargs): """Mark this method as a CLI command. This will only have any meaningful effect in methods that are members of a Resource subclass. """ # Create the actual decorator to be applied. # This is done in such a way to make `@resources.command`, # `@resources.c...
def command(method=None, **kwargs): """Mark this method as a CLI command. This will only have any meaningful effect in methods that are members of a Resource subclass. """ # Create the actual decorator to be applied. # This is done in such a way to make `@resources.command`, # `@resources.c...
[ "Mark", "this", "method", "as", "a", "CLI", "command", "." ]
ansible/tower-cli
python
https://github.com/ansible/tower-cli/blob/a2b151fed93c47725018d3034848cb3a1814bed7/tower_cli/resources/__init__.py#L19-L39
[ "def", "command", "(", "method", "=", "None", ",", "*", "*", "kwargs", ")", ":", "# Create the actual decorator to be applied.", "# This is done in such a way to make `@resources.command`,", "# `@resources.command()`, and `@resources.command(foo='bar')` all work.", "def", "actual_dec...
a2b151fed93c47725018d3034848cb3a1814bed7
valid
unified_job_template_options
Adds the decorators for all types of unified job templates, and if the non-unified type is specified, converts it into the unified_job_template kwarg.
tower_cli/utils/resource_decorators.py
def unified_job_template_options(method): """ Adds the decorators for all types of unified job templates, and if the non-unified type is specified, converts it into the unified_job_template kwarg. """ jt_dec = click.option( '--job-template', type=types.Related('job_template'), he...
def unified_job_template_options(method): """ Adds the decorators for all types of unified job templates, and if the non-unified type is specified, converts it into the unified_job_template kwarg. """ jt_dec = click.option( '--job-template', type=types.Related('job_template'), he...
[ "Adds", "the", "decorators", "for", "all", "types", "of", "unified", "job", "templates", "and", "if", "the", "non", "-", "unified", "type", "is", "specified", "converts", "it", "into", "the", "unified_job_template", "kwarg", "." ]
ansible/tower-cli
python
https://github.com/ansible/tower-cli/blob/a2b151fed93c47725018d3034848cb3a1814bed7/tower_cli/utils/resource_decorators.py#L22-L54
[ "def", "unified_job_template_options", "(", "method", ")", ":", "jt_dec", "=", "click", ".", "option", "(", "'--job-template'", ",", "type", "=", "types", ".", "Related", "(", "'job_template'", ")", ",", "help", "=", "'Use this job template as unified_job_template f...
a2b151fed93c47725018d3034848cb3a1814bed7
valid
OAuth2Session.new_state
Generates a state string to be used in authorizations.
requests_oauthlib/oauth2_session.py
def new_state(self): """Generates a state string to be used in authorizations.""" try: self._state = self.state() log.debug("Generated new state %s.", self._state) except TypeError: self._state = self.state log.debug("Re-using previously supplied s...
def new_state(self): """Generates a state string to be used in authorizations.""" try: self._state = self.state() log.debug("Generated new state %s.", self._state) except TypeError: self._state = self.state log.debug("Re-using previously supplied s...
[ "Generates", "a", "state", "string", "to", "be", "used", "in", "authorizations", "." ]
requests/requests-oauthlib
python
https://github.com/requests/requests-oauthlib/blob/800976faab3b827a42fa1cb80f13fcc03961d2c9/requests_oauthlib/oauth2_session.py#L100-L108
[ "def", "new_state", "(", "self", ")", ":", "try", ":", "self", ".", "_state", "=", "self", ".", "state", "(", ")", "log", ".", "debug", "(", "\"Generated new state %s.\"", ",", "self", ".", "_state", ")", "except", "TypeError", ":", "self", ".", "_stat...
800976faab3b827a42fa1cb80f13fcc03961d2c9
valid
OAuth2Session.authorization_url
Form an authorization URL. :param url: Authorization endpoint url, must be HTTPS. :param state: An optional state string for CSRF protection. If not given it will be generated for you. :param kwargs: Extra parameters to include. :return: authorization_url, state
requests_oauthlib/oauth2_session.py
def authorization_url(self, url, state=None, **kwargs): """Form an authorization URL. :param url: Authorization endpoint url, must be HTTPS. :param state: An optional state string for CSRF protection. If not given it will be generated for you. :param kwargs: Extra ...
def authorization_url(self, url, state=None, **kwargs): """Form an authorization URL. :param url: Authorization endpoint url, must be HTTPS. :param state: An optional state string for CSRF protection. If not given it will be generated for you. :param kwargs: Extra ...
[ "Form", "an", "authorization", "URL", "." ]
requests/requests-oauthlib
python
https://github.com/requests/requests-oauthlib/blob/800976faab3b827a42fa1cb80f13fcc03961d2c9/requests_oauthlib/oauth2_session.py#L154-L173
[ "def", "authorization_url", "(", "self", ",", "url", ",", "state", "=", "None", ",", "*", "*", "kwargs", ")", ":", "state", "=", "state", "or", "self", ".", "new_state", "(", ")", "return", "(", "self", ".", "_client", ".", "prepare_request_uri", "(", ...
800976faab3b827a42fa1cb80f13fcc03961d2c9
valid
OAuth2Session.fetch_token
Generic method for fetching an access token from the token endpoint. If you are using the MobileApplicationClient you will want to use `token_from_fragment` instead of `fetch_token`. The current implementation enforces the RFC guidelines. :param token_url: Token endpoint URL, must use...
requests_oauthlib/oauth2_session.py
def fetch_token( self, token_url, code=None, authorization_response=None, body="", auth=None, username=None, password=None, method="POST", force_querystring=False, timeout=None, headers=None, verify=True, pro...
def fetch_token( self, token_url, code=None, authorization_response=None, body="", auth=None, username=None, password=None, method="POST", force_querystring=False, timeout=None, headers=None, verify=True, pro...
[ "Generic", "method", "for", "fetching", "an", "access", "token", "from", "the", "token", "endpoint", "." ]
requests/requests-oauthlib
python
https://github.com/requests/requests-oauthlib/blob/800976faab3b827a42fa1cb80f13fcc03961d2c9/requests_oauthlib/oauth2_session.py#L175-L363
[ "def", "fetch_token", "(", "self", ",", "token_url", ",", "code", "=", "None", ",", "authorization_response", "=", "None", ",", "body", "=", "\"\"", ",", "auth", "=", "None", ",", "username", "=", "None", ",", "password", "=", "None", ",", "method", "=...
800976faab3b827a42fa1cb80f13fcc03961d2c9
valid
OAuth2Session.token_from_fragment
Parse token from the URI fragment, used by MobileApplicationClients. :param authorization_response: The full URL of the redirect back to you :return: A token dict
requests_oauthlib/oauth2_session.py
def token_from_fragment(self, authorization_response): """Parse token from the URI fragment, used by MobileApplicationClients. :param authorization_response: The full URL of the redirect back to you :return: A token dict """ self._client.parse_request_uri_response( a...
def token_from_fragment(self, authorization_response): """Parse token from the URI fragment, used by MobileApplicationClients. :param authorization_response: The full URL of the redirect back to you :return: A token dict """ self._client.parse_request_uri_response( a...
[ "Parse", "token", "from", "the", "URI", "fragment", "used", "by", "MobileApplicationClients", "." ]
requests/requests-oauthlib
python
https://github.com/requests/requests-oauthlib/blob/800976faab3b827a42fa1cb80f13fcc03961d2c9/requests_oauthlib/oauth2_session.py#L365-L375
[ "def", "token_from_fragment", "(", "self", ",", "authorization_response", ")", ":", "self", ".", "_client", ".", "parse_request_uri_response", "(", "authorization_response", ",", "state", "=", "self", ".", "_state", ")", "self", ".", "token", "=", "self", ".", ...
800976faab3b827a42fa1cb80f13fcc03961d2c9
valid
OAuth2Session.refresh_token
Fetch a new access token using a refresh token. :param token_url: The token endpoint, must be HTTPS. :param refresh_token: The refresh_token to use. :param body: Optional application/x-www-form-urlencoded body to add the include in the token request. Prefer kwargs over body...
requests_oauthlib/oauth2_session.py
def refresh_token( self, token_url, refresh_token=None, body="", auth=None, timeout=None, headers=None, verify=True, proxies=None, **kwargs ): """Fetch a new access token using a refresh token. :param token_url: The tok...
def refresh_token( self, token_url, refresh_token=None, body="", auth=None, timeout=None, headers=None, verify=True, proxies=None, **kwargs ): """Fetch a new access token using a refresh token. :param token_url: The tok...
[ "Fetch", "a", "new", "access", "token", "using", "a", "refresh", "token", "." ]
requests/requests-oauthlib
python
https://github.com/requests/requests-oauthlib/blob/800976faab3b827a42fa1cb80f13fcc03961d2c9/requests_oauthlib/oauth2_session.py#L377-L450
[ "def", "refresh_token", "(", "self", ",", "token_url", ",", "refresh_token", "=", "None", ",", "body", "=", "\"\"", ",", "auth", "=", "None", ",", "timeout", "=", "None", ",", "headers", "=", "None", ",", "verify", "=", "True", ",", "proxies", "=", "...
800976faab3b827a42fa1cb80f13fcc03961d2c9
valid
OAuth2Session.request
Intercept all requests and add the OAuth 2 token if present.
requests_oauthlib/oauth2_session.py
def request( self, method, url, data=None, headers=None, withhold_token=False, client_id=None, client_secret=None, **kwargs ): """Intercept all requests and add the OAuth 2 token if present.""" if not is_secure_transport(url): ...
def request( self, method, url, data=None, headers=None, withhold_token=False, client_id=None, client_secret=None, **kwargs ): """Intercept all requests and add the OAuth 2 token if present.""" if not is_secure_transport(url): ...
[ "Intercept", "all", "requests", "and", "add", "the", "OAuth", "2", "token", "if", "present", "." ]
requests/requests-oauthlib
python
https://github.com/requests/requests-oauthlib/blob/800976faab3b827a42fa1cb80f13fcc03961d2c9/requests_oauthlib/oauth2_session.py#L452-L517
[ "def", "request", "(", "self", ",", "method", ",", "url", ",", "data", "=", "None", ",", "headers", "=", "None", ",", "withhold_token", "=", "False", ",", "client_id", "=", "None", ",", "client_secret", "=", "None", ",", "*", "*", "kwargs", ")", ":",...
800976faab3b827a42fa1cb80f13fcc03961d2c9
valid
OAuth2Session.register_compliance_hook
Register a hook for request/response tweaking. Available hooks are: access_token_response invoked before token parsing. refresh_token_response invoked before refresh token parsing. protected_request invoked before making a request. If you find a new hook is needed p...
requests_oauthlib/oauth2_session.py
def register_compliance_hook(self, hook_type, hook): """Register a hook for request/response tweaking. Available hooks are: access_token_response invoked before token parsing. refresh_token_response invoked before refresh token parsing. protected_request invoked befo...
def register_compliance_hook(self, hook_type, hook): """Register a hook for request/response tweaking. Available hooks are: access_token_response invoked before token parsing. refresh_token_response invoked before refresh token parsing. protected_request invoked befo...
[ "Register", "a", "hook", "for", "request", "/", "response", "tweaking", "." ]
requests/requests-oauthlib
python
https://github.com/requests/requests-oauthlib/blob/800976faab3b827a42fa1cb80f13fcc03961d2c9/requests_oauthlib/oauth2_session.py#L519-L534
[ "def", "register_compliance_hook", "(", "self", ",", "hook_type", ",", "hook", ")", ":", "if", "hook_type", "not", "in", "self", ".", "compliance_hook", ":", "raise", "ValueError", "(", "\"Hook type %s is not in %s.\"", ",", "hook_type", ",", "self", ".", "compl...
800976faab3b827a42fa1cb80f13fcc03961d2c9
valid
OAuth1Session.authorized
Boolean that indicates whether this session has an OAuth token or not. If `self.authorized` is True, you can reasonably expect OAuth-protected requests to the resource to succeed. If `self.authorized` is False, you need the user to go through the OAuth authentication dance before OAuth-p...
requests_oauthlib/oauth1_session.py
def authorized(self): """Boolean that indicates whether this session has an OAuth token or not. If `self.authorized` is True, you can reasonably expect OAuth-protected requests to the resource to succeed. If `self.authorized` is False, you need the user to go through the OAuth au...
def authorized(self): """Boolean that indicates whether this session has an OAuth token or not. If `self.authorized` is True, you can reasonably expect OAuth-protected requests to the resource to succeed. If `self.authorized` is False, you need the user to go through the OAuth au...
[ "Boolean", "that", "indicates", "whether", "this", "session", "has", "an", "OAuth", "token", "or", "not", ".", "If", "self", ".", "authorized", "is", "True", "you", "can", "reasonably", "expect", "OAuth", "-", "protected", "requests", "to", "the", "resource"...
requests/requests-oauthlib
python
https://github.com/requests/requests-oauthlib/blob/800976faab3b827a42fa1cb80f13fcc03961d2c9/requests_oauthlib/oauth1_session.py#L195-L212
[ "def", "authorized", "(", "self", ")", ":", "if", "self", ".", "_client", ".", "client", ".", "signature_method", "==", "SIGNATURE_RSA", ":", "# RSA only uses resource_owner_key", "return", "bool", "(", "self", ".", "_client", ".", "client", ".", "resource_owner...
800976faab3b827a42fa1cb80f13fcc03961d2c9
valid
OAuth1Session.authorization_url
Create an authorization URL by appending request_token and optional kwargs to url. This is the second step in the OAuth 1 workflow. The user should be redirected to this authorization URL, grant access to you, and then be redirected back to you. The redirection back can either be specif...
requests_oauthlib/oauth1_session.py
def authorization_url(self, url, request_token=None, **kwargs): """Create an authorization URL by appending request_token and optional kwargs to url. This is the second step in the OAuth 1 workflow. The user should be redirected to this authorization URL, grant access to you, and then ...
def authorization_url(self, url, request_token=None, **kwargs): """Create an authorization URL by appending request_token and optional kwargs to url. This is the second step in the OAuth 1 workflow. The user should be redirected to this authorization URL, grant access to you, and then ...
[ "Create", "an", "authorization", "URL", "by", "appending", "request_token", "and", "optional", "kwargs", "to", "url", "." ]
requests/requests-oauthlib
python
https://github.com/requests/requests-oauthlib/blob/800976faab3b827a42fa1cb80f13fcc03961d2c9/requests_oauthlib/oauth1_session.py#L214-L258
[ "def", "authorization_url", "(", "self", ",", "url", ",", "request_token", "=", "None", ",", "*", "*", "kwargs", ")", ":", "kwargs", "[", "\"oauth_token\"", "]", "=", "request_token", "or", "self", ".", "_client", ".", "client", ".", "resource_owner_key", ...
800976faab3b827a42fa1cb80f13fcc03961d2c9
valid
OAuth1Session.fetch_request_token
r"""Fetch a request token. This is the first step in the OAuth 1 workflow. A request token is obtained by making a signed post request to url. The token is then parsed from the application/x-www-form-urlencoded response and ready to be used to construct an authorization url. :p...
requests_oauthlib/oauth1_session.py
def fetch_request_token(self, url, realm=None, **request_kwargs): r"""Fetch a request token. This is the first step in the OAuth 1 workflow. A request token is obtained by making a signed post request to url. The token is then parsed from the application/x-www-form-urlencoded response a...
def fetch_request_token(self, url, realm=None, **request_kwargs): r"""Fetch a request token. This is the first step in the OAuth 1 workflow. A request token is obtained by making a signed post request to url. The token is then parsed from the application/x-www-form-urlencoded response a...
[ "r", "Fetch", "a", "request", "token", "." ]
requests/requests-oauthlib
python
https://github.com/requests/requests-oauthlib/blob/800976faab3b827a42fa1cb80f13fcc03961d2c9/requests_oauthlib/oauth1_session.py#L260-L291
[ "def", "fetch_request_token", "(", "self", ",", "url", ",", "realm", "=", "None", ",", "*", "*", "request_kwargs", ")", ":", "self", ".", "_client", ".", "client", ".", "realm", "=", "\" \"", ".", "join", "(", "realm", ")", "if", "realm", "else", "No...
800976faab3b827a42fa1cb80f13fcc03961d2c9
valid
OAuth1Session.fetch_access_token
Fetch an access token. This is the final step in the OAuth 1 workflow. An access token is obtained using all previously obtained credentials, including the verifier from the authorization step. Note that a previously set verifier will be reset for your convenience, or else sign...
requests_oauthlib/oauth1_session.py
def fetch_access_token(self, url, verifier=None, **request_kwargs): """Fetch an access token. This is the final step in the OAuth 1 workflow. An access token is obtained using all previously obtained credentials, including the verifier from the authorization step. Note that a p...
def fetch_access_token(self, url, verifier=None, **request_kwargs): """Fetch an access token. This is the final step in the OAuth 1 workflow. An access token is obtained using all previously obtained credentials, including the verifier from the authorization step. Note that a p...
[ "Fetch", "an", "access", "token", "." ]
requests/requests-oauthlib
python
https://github.com/requests/requests-oauthlib/blob/800976faab3b827a42fa1cb80f13fcc03961d2c9/requests_oauthlib/oauth1_session.py#L293-L326
[ "def", "fetch_access_token", "(", "self", ",", "url", ",", "verifier", "=", "None", ",", "*", "*", "request_kwargs", ")", ":", "if", "verifier", ":", "self", ".", "_client", ".", "client", ".", "verifier", "=", "verifier", "if", "not", "getattr", "(", ...
800976faab3b827a42fa1cb80f13fcc03961d2c9
valid
OAuth1Session.parse_authorization_response
Extract parameters from the post authorization redirect response URL. :param url: The full URL that resulted from the user being redirected back from the OAuth provider to you, the client. :returns: A dict of parameters extracted from the URL. >>> redirect_response = 'https...
requests_oauthlib/oauth1_session.py
def parse_authorization_response(self, url): """Extract parameters from the post authorization redirect response URL. :param url: The full URL that resulted from the user being redirected back from the OAuth provider to you, the client. :returns: A dict of parameters extract...
def parse_authorization_response(self, url): """Extract parameters from the post authorization redirect response URL. :param url: The full URL that resulted from the user being redirected back from the OAuth provider to you, the client. :returns: A dict of parameters extract...
[ "Extract", "parameters", "from", "the", "post", "authorization", "redirect", "response", "URL", "." ]
requests/requests-oauthlib
python
https://github.com/requests/requests-oauthlib/blob/800976faab3b827a42fa1cb80f13fcc03961d2c9/requests_oauthlib/oauth1_session.py#L328-L349
[ "def", "parse_authorization_response", "(", "self", ",", "url", ")", ":", "log", ".", "debug", "(", "\"Parsing token from query part of url %s\"", ",", "url", ")", "token", "=", "dict", "(", "urldecode", "(", "urlparse", "(", "url", ")", ".", "query", ")", "...
800976faab3b827a42fa1cb80f13fcc03961d2c9
valid
OAuth1Session.rebuild_auth
When being redirected we should always strip Authorization header, since nonce may not be reused as per OAuth spec.
requests_oauthlib/oauth1_session.py
def rebuild_auth(self, prepared_request, response): """ When being redirected we should always strip Authorization header, since nonce may not be reused as per OAuth spec. """ if "Authorization" in prepared_request.headers: # If we get redirected to a new host, we sho...
def rebuild_auth(self, prepared_request, response): """ When being redirected we should always strip Authorization header, since nonce may not be reused as per OAuth spec. """ if "Authorization" in prepared_request.headers: # If we get redirected to a new host, we sho...
[ "When", "being", "redirected", "we", "should", "always", "strip", "Authorization", "header", "since", "nonce", "may", "not", "be", "reused", "as", "per", "OAuth", "spec", "." ]
requests/requests-oauthlib
python
https://github.com/requests/requests-oauthlib/blob/800976faab3b827a42fa1cb80f13fcc03961d2c9/requests_oauthlib/oauth1_session.py#L390-L400
[ "def", "rebuild_auth", "(", "self", ",", "prepared_request", ",", "response", ")", ":", "if", "\"Authorization\"", "in", "prepared_request", ".", "headers", ":", "# If we get redirected to a new host, we should strip out", "# any authentication headers.", "prepared_request", ...
800976faab3b827a42fa1cb80f13fcc03961d2c9
valid
Cacher.get_fpath
Reports the filepath that the cacher will use. It will attempt to use '{fname}_{cfgstr}{ext}' unless that is too long. Then cfgstr will be hashed. Example: >>> from ubelt.util_cache import Cacher >>> import pytest >>> with pytest.warns(UserWarning): ...
ubelt/util_cache.py
def get_fpath(self, cfgstr=None): """ Reports the filepath that the cacher will use. It will attempt to use '{fname}_{cfgstr}{ext}' unless that is too long. Then cfgstr will be hashed. Example: >>> from ubelt.util_cache import Cacher >>> import pytest ...
def get_fpath(self, cfgstr=None): """ Reports the filepath that the cacher will use. It will attempt to use '{fname}_{cfgstr}{ext}' unless that is too long. Then cfgstr will be hashed. Example: >>> from ubelt.util_cache import Cacher >>> import pytest ...
[ "Reports", "the", "filepath", "that", "the", "cacher", "will", "use", ".", "It", "will", "attempt", "to", "use", "{", "fname", "}", "_", "{", "cfgstr", "}", "{", "ext", "}", "unless", "that", "is", "too", "long", ".", "Then", "cfgstr", "will", "be", ...
Erotemic/ubelt
python
https://github.com/Erotemic/ubelt/blob/db802f3ad8abba025db74b54f86e6892b8927325/ubelt/util_cache.py#L210-L231
[ "def", "get_fpath", "(", "self", ",", "cfgstr", "=", "None", ")", ":", "condensed", "=", "self", ".", "_condense_cfgstr", "(", "cfgstr", ")", "fname_cfgstr", "=", "'{}_{}{}'", ".", "format", "(", "self", ".", "fname", ",", "condensed", ",", "self", ".", ...
db802f3ad8abba025db74b54f86e6892b8927325
valid
Cacher.existing_versions
Returns data with different cfgstr values that were previously computed with this cacher. Example: >>> from ubelt.util_cache import Cacher >>> # Ensure that some data exists >>> known_fnames = set() >>> cacher = Cacher('versioned_data', cfgstr='1') ...
ubelt/util_cache.py
def existing_versions(self): """ Returns data with different cfgstr values that were previously computed with this cacher. Example: >>> from ubelt.util_cache import Cacher >>> # Ensure that some data exists >>> known_fnames = set() >>> cac...
def existing_versions(self): """ Returns data with different cfgstr values that were previously computed with this cacher. Example: >>> from ubelt.util_cache import Cacher >>> # Ensure that some data exists >>> known_fnames = set() >>> cac...
[ "Returns", "data", "with", "different", "cfgstr", "values", "that", "were", "previously", "computed", "with", "this", "cacher", "." ]
Erotemic/ubelt
python
https://github.com/Erotemic/ubelt/blob/db802f3ad8abba025db74b54f86e6892b8927325/ubelt/util_cache.py#L239-L268
[ "def", "existing_versions", "(", "self", ")", ":", "import", "glob", "pattern", "=", "join", "(", "self", ".", "dpath", ",", "self", ".", "fname", "+", "'_*'", "+", "self", ".", "ext", ")", "for", "fname", "in", "glob", ".", "iglob", "(", "pattern", ...
db802f3ad8abba025db74b54f86e6892b8927325
valid
Cacher.clear
Removes the saved cache and metadata from disk
ubelt/util_cache.py
def clear(self, cfgstr=None): """ Removes the saved cache and metadata from disk """ data_fpath = self.get_fpath(cfgstr) if self.verbose > 0: self.log('[cacher] clear cache') if exists(data_fpath): if self.verbose > 0: self.log('[ca...
def clear(self, cfgstr=None): """ Removes the saved cache and metadata from disk """ data_fpath = self.get_fpath(cfgstr) if self.verbose > 0: self.log('[cacher] clear cache') if exists(data_fpath): if self.verbose > 0: self.log('[ca...
[ "Removes", "the", "saved", "cache", "and", "metadata", "from", "disk" ]
Erotemic/ubelt
python
https://github.com/Erotemic/ubelt/blob/db802f3ad8abba025db74b54f86e6892b8927325/ubelt/util_cache.py#L270-L288
[ "def", "clear", "(", "self", ",", "cfgstr", "=", "None", ")", ":", "data_fpath", "=", "self", ".", "get_fpath", "(", "cfgstr", ")", "if", "self", ".", "verbose", ">", "0", ":", "self", ".", "log", "(", "'[cacher] clear cache'", ")", "if", "exists", "...
db802f3ad8abba025db74b54f86e6892b8927325
valid
Cacher.tryload
Like load, but returns None if the load fails due to a cache miss. Args: on_error (str): How to handle non-io errors errors. Either raise, which re-raises the exception, or clear which deletes the cache and returns None.
ubelt/util_cache.py
def tryload(self, cfgstr=None, on_error='raise'): """ Like load, but returns None if the load fails due to a cache miss. Args: on_error (str): How to handle non-io errors errors. Either raise, which re-raises the exception, or clear which deletes the cache ...
def tryload(self, cfgstr=None, on_error='raise'): """ Like load, but returns None if the load fails due to a cache miss. Args: on_error (str): How to handle non-io errors errors. Either raise, which re-raises the exception, or clear which deletes the cache ...
[ "Like", "load", "but", "returns", "None", "if", "the", "load", "fails", "due", "to", "a", "cache", "miss", "." ]
Erotemic/ubelt
python
https://github.com/Erotemic/ubelt/blob/db802f3ad8abba025db74b54f86e6892b8927325/ubelt/util_cache.py#L290-L321
[ "def", "tryload", "(", "self", ",", "cfgstr", "=", "None", ",", "on_error", "=", "'raise'", ")", ":", "cfgstr", "=", "self", ".", "_rectify_cfgstr", "(", "cfgstr", ")", "if", "self", ".", "enabled", ":", "try", ":", "if", "self", ".", "verbose", ">",...
db802f3ad8abba025db74b54f86e6892b8927325
valid
Cacher.load
Loads the data Raises: IOError - if the data is unable to be loaded. This could be due to a cache miss or because the cache is disabled. Example: >>> from ubelt.util_cache import * # NOQA >>> # Setting the cacher as enabled=False turns it off ...
ubelt/util_cache.py
def load(self, cfgstr=None): """ Loads the data Raises: IOError - if the data is unable to be loaded. This could be due to a cache miss or because the cache is disabled. Example: >>> from ubelt.util_cache import * # NOQA >>> # Settin...
def load(self, cfgstr=None): """ Loads the data Raises: IOError - if the data is unable to be loaded. This could be due to a cache miss or because the cache is disabled. Example: >>> from ubelt.util_cache import * # NOQA >>> # Settin...
[ "Loads", "the", "data" ]
Erotemic/ubelt
python
https://github.com/Erotemic/ubelt/blob/db802f3ad8abba025db74b54f86e6892b8927325/ubelt/util_cache.py#L323-L385
[ "def", "load", "(", "self", ",", "cfgstr", "=", "None", ")", ":", "from", "six", ".", "moves", "import", "cPickle", "as", "pickle", "cfgstr", "=", "self", ".", "_rectify_cfgstr", "(", "cfgstr", ")", "dpath", "=", "self", ".", "dpath", "fname", "=", "...
db802f3ad8abba025db74b54f86e6892b8927325
valid
Cacher.save
Writes data to path specified by `self.fpath(cfgstr)`. Metadata containing information about the cache will also be appended to an adjacent file with the `.meta` suffix. Example: >>> from ubelt.util_cache import * # NOQA >>> # Normal functioning >>> cfgstr ...
ubelt/util_cache.py
def save(self, data, cfgstr=None): """ Writes data to path specified by `self.fpath(cfgstr)`. Metadata containing information about the cache will also be appended to an adjacent file with the `.meta` suffix. Example: >>> from ubelt.util_cache import * # NOQA ...
def save(self, data, cfgstr=None): """ Writes data to path specified by `self.fpath(cfgstr)`. Metadata containing information about the cache will also be appended to an adjacent file with the `.meta` suffix. Example: >>> from ubelt.util_cache import * # NOQA ...
[ "Writes", "data", "to", "path", "specified", "by", "self", ".", "fpath", "(", "cfgstr", ")", "." ]
Erotemic/ubelt
python
https://github.com/Erotemic/ubelt/blob/db802f3ad8abba025db74b54f86e6892b8927325/ubelt/util_cache.py#L387-L433
[ "def", "save", "(", "self", ",", "data", ",", "cfgstr", "=", "None", ")", ":", "from", "six", ".", "moves", "import", "cPickle", "as", "pickle", "if", "not", "self", ".", "enabled", ":", "return", "if", "self", ".", "verbose", ">", "0", ":", "self"...
db802f3ad8abba025db74b54f86e6892b8927325
valid
Cacher.ensure
r""" Wraps around a function. A cfgstr must be stored in the base cacher. Args: func (callable): function that will compute data on cache miss *args: passed to func **kwargs: passed to func Example: >>> from ubelt.util_cache import * # NOQA ...
ubelt/util_cache.py
def ensure(self, func, *args, **kwargs): r""" Wraps around a function. A cfgstr must be stored in the base cacher. Args: func (callable): function that will compute data on cache miss *args: passed to func **kwargs: passed to func Example: ...
def ensure(self, func, *args, **kwargs): r""" Wraps around a function. A cfgstr must be stored in the base cacher. Args: func (callable): function that will compute data on cache miss *args: passed to func **kwargs: passed to func Example: ...
[ "r", "Wraps", "around", "a", "function", ".", "A", "cfgstr", "must", "be", "stored", "in", "the", "base", "cacher", "." ]
Erotemic/ubelt
python
https://github.com/Erotemic/ubelt/blob/db802f3ad8abba025db74b54f86e6892b8927325/ubelt/util_cache.py#L435-L462
[ "def", "ensure", "(", "self", ",", "func", ",", "*", "args", ",", "*", "*", "kwargs", ")", ":", "data", "=", "self", ".", "tryload", "(", ")", "if", "data", "is", "None", ":", "data", "=", "func", "(", "*", "args", ",", "*", "*", "kwargs", ")...
db802f3ad8abba025db74b54f86e6892b8927325
valid
CacheStamp._get_certificate
Returns the stamp certificate if it exists
ubelt/util_cache.py
def _get_certificate(self, cfgstr=None): """ Returns the stamp certificate if it exists """ certificate = self.cacher.tryload(cfgstr=cfgstr) return certificate
def _get_certificate(self, cfgstr=None): """ Returns the stamp certificate if it exists """ certificate = self.cacher.tryload(cfgstr=cfgstr) return certificate
[ "Returns", "the", "stamp", "certificate", "if", "it", "exists" ]
Erotemic/ubelt
python
https://github.com/Erotemic/ubelt/blob/db802f3ad8abba025db74b54f86e6892b8927325/ubelt/util_cache.py#L563-L568
[ "def", "_get_certificate", "(", "self", ",", "cfgstr", "=", "None", ")", ":", "certificate", "=", "self", ".", "cacher", ".", "tryload", "(", "cfgstr", "=", "cfgstr", ")", "return", "certificate" ]
db802f3ad8abba025db74b54f86e6892b8927325
valid
CacheStamp._rectify_products
puts products in a normalized format
ubelt/util_cache.py
def _rectify_products(self, product=None): """ puts products in a normalized format """ products = self.product if product is None else product if products is None: return None if not isinstance(products, (list, tuple)): products = [products] return produc...
def _rectify_products(self, product=None): """ puts products in a normalized format """ products = self.product if product is None else product if products is None: return None if not isinstance(products, (list, tuple)): products = [products] return produc...
[ "puts", "products", "in", "a", "normalized", "format" ]
Erotemic/ubelt
python
https://github.com/Erotemic/ubelt/blob/db802f3ad8abba025db74b54f86e6892b8927325/ubelt/util_cache.py#L570-L577
[ "def", "_rectify_products", "(", "self", ",", "product", "=", "None", ")", ":", "products", "=", "self", ".", "product", "if", "product", "is", "None", "else", "product", "if", "products", "is", "None", ":", "return", "None", "if", "not", "isinstance", "...
db802f3ad8abba025db74b54f86e6892b8927325