partition
stringclasses
3 values
func_name
stringlengths
1
134
docstring
stringlengths
1
46.9k
path
stringlengths
4
223
original_string
stringlengths
75
104k
code
stringlengths
75
104k
docstring_tokens
listlengths
1
1.97k
repo
stringlengths
7
55
language
stringclasses
1 value
url
stringlengths
87
315
code_tokens
listlengths
19
28.4k
sha
stringlengths
40
40
train
NURESTObject.is_owned_by_current_user
Check if the current user owns the object
bambou/nurest_object.py
def is_owned_by_current_user(self): """ Check if the current user owns the object """ from bambou.nurest_root_object import NURESTRootObject root_object = NURESTRootObject.get_default_root_object() return self._owner == root_object.id
def is_owned_by_current_user(self): """ Check if the current user owns the object """ from bambou.nurest_root_object import NURESTRootObject root_object = NURESTRootObject.get_default_root_object() return self._owner == root_object.id
[ "Check", "if", "the", "current", "user", "owns", "the", "object" ]
nuagenetworks/bambou
python
https://github.com/nuagenetworks/bambou/blob/d334fea23e384d3df8e552fe1849ad707941c666/bambou/nurest_object.py#L490-L495
[ "def", "is_owned_by_current_user", "(", "self", ")", ":", "from", "bambou", ".", "nurest_root_object", "import", "NURESTRootObject", "root_object", "=", "NURESTRootObject", ".", "get_default_root_object", "(", ")", "return", "self", ".", "_owner", "==", "root_object",...
d334fea23e384d3df8e552fe1849ad707941c666
train
NURESTObject.parent_for_matching_rest_name
Return parent that matches a rest name
bambou/nurest_object.py
def parent_for_matching_rest_name(self, rest_names): """ Return parent that matches a rest name """ parent = self while parent: if parent.rest_name in rest_names: return parent parent = parent.parent_object return None
def parent_for_matching_rest_name(self, rest_names): """ Return parent that matches a rest name """ parent = self while parent: if parent.rest_name in rest_names: return parent parent = parent.parent_object return None
[ "Return", "parent", "that", "matches", "a", "rest", "name" ]
nuagenetworks/bambou
python
https://github.com/nuagenetworks/bambou/blob/d334fea23e384d3df8e552fe1849ad707941c666/bambou/nurest_object.py#L497-L508
[ "def", "parent_for_matching_rest_name", "(", "self", ",", "rest_names", ")", ":", "parent", "=", "self", "while", "parent", ":", "if", "parent", ".", "rest_name", "in", "rest_names", ":", "return", "parent", "parent", "=", "parent", ".", "parent_object", "retu...
d334fea23e384d3df8e552fe1849ad707941c666
train
NURESTObject.genealogic_types
Get genealogic types Returns: Returns a list of all parent types
bambou/nurest_object.py
def genealogic_types(self): """ Get genealogic types Returns: Returns a list of all parent types """ types = [] parent = self while parent: types.append(parent.rest_name) parent = parent.parent_object return types
def genealogic_types(self): """ Get genealogic types Returns: Returns a list of all parent types """ types = [] parent = self while parent: types.append(parent.rest_name) parent = parent.parent_object return types
[ "Get", "genealogic", "types" ]
nuagenetworks/bambou
python
https://github.com/nuagenetworks/bambou/blob/d334fea23e384d3df8e552fe1849ad707941c666/bambou/nurest_object.py#L510-L524
[ "def", "genealogic_types", "(", "self", ")", ":", "types", "=", "[", "]", "parent", "=", "self", "while", "parent", ":", "types", ".", "append", "(", "parent", ".", "rest_name", ")", "parent", "=", "parent", ".", "parent_object", "return", "types" ]
d334fea23e384d3df8e552fe1849ad707941c666
train
NURESTObject.genealogic_ids
Get all genealogic ids Returns: A list of all parent ids
bambou/nurest_object.py
def genealogic_ids(self): """ Get all genealogic ids Returns: A list of all parent ids """ ids = [] parent = self while parent: ids.append(parent.id) parent = parent.parent_object return ids
def genealogic_ids(self): """ Get all genealogic ids Returns: A list of all parent ids """ ids = [] parent = self while parent: ids.append(parent.id) parent = parent.parent_object return ids
[ "Get", "all", "genealogic", "ids" ]
nuagenetworks/bambou
python
https://github.com/nuagenetworks/bambou/blob/d334fea23e384d3df8e552fe1849ad707941c666/bambou/nurest_object.py#L526-L540
[ "def", "genealogic_ids", "(", "self", ")", ":", "ids", "=", "[", "]", "parent", "=", "self", "while", "parent", ":", "ids", ".", "append", "(", "parent", ".", "id", ")", "parent", "=", "parent", ".", "parent_object", "return", "ids" ]
d334fea23e384d3df8e552fe1849ad707941c666
train
NURESTObject.get_formated_creation_date
Return creation date with a given format. Default is '%b %Y %d %H:%I:%S'
bambou/nurest_object.py
def get_formated_creation_date(self, format='%b %Y %d %H:%I:%S'): """ Return creation date with a given format. Default is '%b %Y %d %H:%I:%S' """ if not self._creation_date: return None date = datetime.datetime.utcfromtimestamp(self._creation_date) return date.strftime(for...
def get_formated_creation_date(self, format='%b %Y %d %H:%I:%S'): """ Return creation date with a given format. Default is '%b %Y %d %H:%I:%S' """ if not self._creation_date: return None date = datetime.datetime.utcfromtimestamp(self._creation_date) return date.strftime(for...
[ "Return", "creation", "date", "with", "a", "given", "format", ".", "Default", "is", "%b", "%Y", "%d", "%H", ":", "%I", ":", "%S" ]
nuagenetworks/bambou
python
https://github.com/nuagenetworks/bambou/blob/d334fea23e384d3df8e552fe1849ad707941c666/bambou/nurest_object.py#L568-L575
[ "def", "get_formated_creation_date", "(", "self", ",", "format", "=", "'%b %Y %d %H:%I:%S'", ")", ":", "if", "not", "self", ".", "_creation_date", ":", "return", "None", "date", "=", "datetime", ".", "datetime", ".", "utcfromtimestamp", "(", "self", ".", "_cre...
d334fea23e384d3df8e552fe1849ad707941c666
train
NURESTObject.add_child
Add a child
bambou/nurest_object.py
def add_child(self, child): """ Add a child """ rest_name = child.rest_name children = self.fetcher_for_rest_name(rest_name) if children is None: raise InternalConsitencyError('Could not find fetcher with name %s while adding %s in parent %s' % (rest_name, child, self)) ...
def add_child(self, child): """ Add a child """ rest_name = child.rest_name children = self.fetcher_for_rest_name(rest_name) if children is None: raise InternalConsitencyError('Could not find fetcher with name %s while adding %s in parent %s' % (rest_name, child, self)) ...
[ "Add", "a", "child" ]
nuagenetworks/bambou
python
https://github.com/nuagenetworks/bambou/blob/d334fea23e384d3df8e552fe1849ad707941c666/bambou/nurest_object.py#L605-L616
[ "def", "add_child", "(", "self", ",", "child", ")", ":", "rest_name", "=", "child", ".", "rest_name", "children", "=", "self", ".", "fetcher_for_rest_name", "(", "rest_name", ")", "if", "children", "is", "None", ":", "raise", "InternalConsitencyError", "(", ...
d334fea23e384d3df8e552fe1849ad707941c666
train
NURESTObject.remove_child
Remove a child
bambou/nurest_object.py
def remove_child(self, child): """ Remove a child """ rest_name = child.rest_name children = self.fetcher_for_rest_name(rest_name) target_child = None for local_child in children: if local_child.id == child.id: target_child = local_child ...
def remove_child(self, child): """ Remove a child """ rest_name = child.rest_name children = self.fetcher_for_rest_name(rest_name) target_child = None for local_child in children: if local_child.id == child.id: target_child = local_child ...
[ "Remove", "a", "child" ]
nuagenetworks/bambou
python
https://github.com/nuagenetworks/bambou/blob/d334fea23e384d3df8e552fe1849ad707941c666/bambou/nurest_object.py#L618-L633
[ "def", "remove_child", "(", "self", ",", "child", ")", ":", "rest_name", "=", "child", ".", "rest_name", "children", "=", "self", ".", "fetcher_for_rest_name", "(", "rest_name", ")", "target_child", "=", "None", "for", "local_child", "in", "children", ":", "...
d334fea23e384d3df8e552fe1849ad707941c666
train
NURESTObject.update_child
Update child
bambou/nurest_object.py
def update_child(self, child): """ Update child """ rest_name = child.rest_name children = self.fetcher_for_rest_name(rest_name) index = None for local_child in children: if local_child.id == child.id: index = children.index(local_child) ...
def update_child(self, child): """ Update child """ rest_name = child.rest_name children = self.fetcher_for_rest_name(rest_name) index = None for local_child in children: if local_child.id == child.id: index = children.index(local_child) ...
[ "Update", "child" ]
nuagenetworks/bambou
python
https://github.com/nuagenetworks/bambou/blob/d334fea23e384d3df8e552fe1849ad707941c666/bambou/nurest_object.py#L635-L649
[ "def", "update_child", "(", "self", ",", "child", ")", ":", "rest_name", "=", "child", ".", "rest_name", "children", "=", "self", ".", "fetcher_for_rest_name", "(", "rest_name", ")", "index", "=", "None", "for", "local_child", "in", "children", ":", "if", ...
d334fea23e384d3df8e552fe1849ad707941c666
train
NURESTObject.to_dict
Converts the current object into a Dictionary using all exposed ReST attributes. Returns: dict: the dictionary containing all the exposed ReST attributes and their values. Example:: >>> print entity.to_dict() {"name": "my entity", "description": ...
bambou/nurest_object.py
def to_dict(self): """ Converts the current object into a Dictionary using all exposed ReST attributes. Returns: dict: the dictionary containing all the exposed ReST attributes and their values. Example:: >>> print entity.to_dict() {"name...
def to_dict(self): """ Converts the current object into a Dictionary using all exposed ReST attributes. Returns: dict: the dictionary containing all the exposed ReST attributes and their values. Example:: >>> print entity.to_dict() {"name...
[ "Converts", "the", "current", "object", "into", "a", "Dictionary", "using", "all", "exposed", "ReST", "attributes", "." ]
nuagenetworks/bambou
python
https://github.com/nuagenetworks/bambou/blob/d334fea23e384d3df8e552fe1849ad707941c666/bambou/nurest_object.py#L667-L704
[ "def", "to_dict", "(", "self", ")", ":", "dictionary", "=", "dict", "(", ")", "for", "local_name", ",", "attribute", "in", "self", ".", "_attributes", ".", "items", "(", ")", ":", "remote_name", "=", "attribute", ".", "remote_name", "if", "hasattr", "(",...
d334fea23e384d3df8e552fe1849ad707941c666
train
NURESTObject.from_dict
Sets all the exposed ReST attribues from the given dictionary Args: dictionary (dict): dictionnary containing the raw object attributes and their values. Example: >>> info = {"name": "my group", "private": False} >>> group = NUGroup() ...
bambou/nurest_object.py
def from_dict(self, dictionary): """ Sets all the exposed ReST attribues from the given dictionary Args: dictionary (dict): dictionnary containing the raw object attributes and their values. Example: >>> info = {"name": "my group", "private": False} ...
def from_dict(self, dictionary): """ Sets all the exposed ReST attribues from the given dictionary Args: dictionary (dict): dictionnary containing the raw object attributes and their values. Example: >>> info = {"name": "my group", "private": False} ...
[ "Sets", "all", "the", "exposed", "ReST", "attribues", "from", "the", "given", "dictionary" ]
nuagenetworks/bambou
python
https://github.com/nuagenetworks/bambou/blob/d334fea23e384d3df8e552fe1849ad707941c666/bambou/nurest_object.py#L706-L729
[ "def", "from_dict", "(", "self", ",", "dictionary", ")", ":", "for", "remote_name", ",", "remote_value", "in", "dictionary", ".", "items", "(", ")", ":", "# Check if a local attribute is exposed with the remote_name", "# if no attribute is exposed, return None", "local_name...
d334fea23e384d3df8e552fe1849ad707941c666
train
NURESTObject.delete
Delete object and call given callback in case of call. Args: response_choice (int): Automatically send a response choice when confirmation is needed async (bool): Boolean to make an asynchronous call. Default is False callback (function): Callback method that...
bambou/nurest_object.py
def delete(self, response_choice=1, async=False, callback=None): """ Delete object and call given callback in case of call. Args: response_choice (int): Automatically send a response choice when confirmation is needed async (bool): Boolean to make an asynchronous cal...
def delete(self, response_choice=1, async=False, callback=None): """ Delete object and call given callback in case of call. Args: response_choice (int): Automatically send a response choice when confirmation is needed async (bool): Boolean to make an asynchronous cal...
[ "Delete", "object", "and", "call", "given", "callback", "in", "case", "of", "call", "." ]
nuagenetworks/bambou
python
https://github.com/nuagenetworks/bambou/blob/d334fea23e384d3df8e552fe1849ad707941c666/bambou/nurest_object.py#L733-L744
[ "def", "delete", "(", "self", ",", "response_choice", "=", "1", ",", "async", "=", "False", ",", "callback", "=", "None", ")", ":", "return", "self", ".", "_manage_child_object", "(", "nurest_object", "=", "self", ",", "method", "=", "HTTP_METHOD_DELETE", ...
d334fea23e384d3df8e552fe1849ad707941c666
train
NURESTObject.save
Update object and call given callback in case of async call Args: async (bool): Boolean to make an asynchronous call. Default is False callback (function): Callback method that will be triggered in case of asynchronous call Example: >>> entity.na...
bambou/nurest_object.py
def save(self, response_choice=None, async=False, callback=None): """ Update object and call given callback in case of async call Args: async (bool): Boolean to make an asynchronous call. Default is False callback (function): Callback method that will be triggered in...
def save(self, response_choice=None, async=False, callback=None): """ Update object and call given callback in case of async call Args: async (bool): Boolean to make an asynchronous call. Default is False callback (function): Callback method that will be triggered in...
[ "Update", "object", "and", "call", "given", "callback", "in", "case", "of", "async", "call" ]
nuagenetworks/bambou
python
https://github.com/nuagenetworks/bambou/blob/d334fea23e384d3df8e552fe1849ad707941c666/bambou/nurest_object.py#L746-L757
[ "def", "save", "(", "self", ",", "response_choice", "=", "None", ",", "async", "=", "False", ",", "callback", "=", "None", ")", ":", "return", "self", ".", "_manage_child_object", "(", "nurest_object", "=", "self", ",", "method", "=", "HTTP_METHOD_PUT", ",...
d334fea23e384d3df8e552fe1849ad707941c666
train
NURESTObject.send_request
Sends a request, calls the local callback, then the remote callback in case of async call Args: request: The request to send local_callback: local method that will be triggered in case of async call remote_callback: remote moethd that will be triggered in cas...
bambou/nurest_object.py
def send_request(self, request, async=False, local_callback=None, remote_callback=None, user_info=None): """ Sends a request, calls the local callback, then the remote callback in case of async call Args: request: The request to send local_callback: local method that...
def send_request(self, request, async=False, local_callback=None, remote_callback=None, user_info=None): """ Sends a request, calls the local callback, then the remote callback in case of async call Args: request: The request to send local_callback: local method that...
[ "Sends", "a", "request", "calls", "the", "local", "callback", "then", "the", "remote", "callback", "in", "case", "of", "async", "call" ]
nuagenetworks/bambou
python
https://github.com/nuagenetworks/bambou/blob/d334fea23e384d3df8e552fe1849ad707941c666/bambou/nurest_object.py#L789-L813
[ "def", "send_request", "(", "self", ",", "request", ",", "async", "=", "False", ",", "local_callback", "=", "None", ",", "remote_callback", "=", "None", ",", "user_info", "=", "None", ")", ":", "callbacks", "=", "dict", "(", ")", "if", "local_callback", ...
d334fea23e384d3df8e552fe1849ad707941c666
train
NURESTObject._manage_child_object
Low level child management. Send given HTTP method with given nurest_object to given ressource of current object Args: nurest_object: the NURESTObject object to manage method: the HTTP method to use (GET, POST, PUT, DELETE) callback: the callback to call at t...
bambou/nurest_object.py
def _manage_child_object(self, nurest_object, method=HTTP_METHOD_GET, async=False, callback=None, handler=None, response_choice=None, commit=False): """ Low level child management. Send given HTTP method with given nurest_object to given ressource of current object Args: nurest_obje...
def _manage_child_object(self, nurest_object, method=HTTP_METHOD_GET, async=False, callback=None, handler=None, response_choice=None, commit=False): """ Low level child management. Send given HTTP method with given nurest_object to given ressource of current object Args: nurest_obje...
[ "Low", "level", "child", "management", ".", "Send", "given", "HTTP", "method", "with", "given", "nurest_object", "to", "given", "ressource", "of", "current", "object" ]
nuagenetworks/bambou
python
https://github.com/nuagenetworks/bambou/blob/d334fea23e384d3df8e552fe1849ad707941c666/bambou/nurest_object.py#L815-L849
[ "def", "_manage_child_object", "(", "self", ",", "nurest_object", ",", "method", "=", "HTTP_METHOD_GET", ",", "async", "=", "False", ",", "callback", "=", "None", ",", "handler", "=", "None", ",", "response_choice", "=", "None", ",", "commit", "=", "False", ...
d334fea23e384d3df8e552fe1849ad707941c666
train
NURESTObject._did_receive_response
Receive a response from the connection
bambou/nurest_object.py
def _did_receive_response(self, connection): """ Receive a response from the connection """ if connection.has_timeouted: bambou_logger.info("NURESTConnection has timeout.") return has_callbacks = connection.has_callbacks() should_post = not has_callbacks ...
def _did_receive_response(self, connection): """ Receive a response from the connection """ if connection.has_timeouted: bambou_logger.info("NURESTConnection has timeout.") return has_callbacks = connection.has_callbacks() should_post = not has_callbacks ...
[ "Receive", "a", "response", "from", "the", "connection" ]
nuagenetworks/bambou
python
https://github.com/nuagenetworks/bambou/blob/d334fea23e384d3df8e552fe1849ad707941c666/bambou/nurest_object.py#L853-L865
[ "def", "_did_receive_response", "(", "self", ",", "connection", ")", ":", "if", "connection", ".", "has_timeouted", ":", "bambou_logger", ".", "info", "(", "\"NURESTConnection has timeout.\"", ")", "return", "has_callbacks", "=", "connection", ".", "has_callbacks", ...
d334fea23e384d3df8e552fe1849ad707941c666
train
NURESTObject._did_retrieve
Callback called after fetching the object
bambou/nurest_object.py
def _did_retrieve(self, connection): """ Callback called after fetching the object """ response = connection.response try: self.from_dict(response.data[0]) except: pass return self._did_perform_standard_operation(connection)
def _did_retrieve(self, connection): """ Callback called after fetching the object """ response = connection.response try: self.from_dict(response.data[0]) except: pass return self._did_perform_standard_operation(connection)
[ "Callback", "called", "after", "fetching", "the", "object" ]
nuagenetworks/bambou
python
https://github.com/nuagenetworks/bambou/blob/d334fea23e384d3df8e552fe1849ad707941c666/bambou/nurest_object.py#L867-L877
[ "def", "_did_retrieve", "(", "self", ",", "connection", ")", ":", "response", "=", "connection", ".", "response", "try", ":", "self", ".", "from_dict", "(", "response", ".", "data", "[", "0", "]", ")", "except", ":", "pass", "return", "self", ".", "_di...
d334fea23e384d3df8e552fe1849ad707941c666
train
NURESTObject._did_perform_standard_operation
Performs standard opertions
bambou/nurest_object.py
def _did_perform_standard_operation(self, connection): """ Performs standard opertions """ if connection.async: callback = connection.callbacks['remote'] if connection.user_info and 'nurest_object' in connection.user_info: callback(connection.user_info['nurest_o...
def _did_perform_standard_operation(self, connection): """ Performs standard opertions """ if connection.async: callback = connection.callbacks['remote'] if connection.user_info and 'nurest_object' in connection.user_info: callback(connection.user_info['nurest_o...
[ "Performs", "standard", "opertions" ]
nuagenetworks/bambou
python
https://github.com/nuagenetworks/bambou/blob/d334fea23e384d3df8e552fe1849ad707941c666/bambou/nurest_object.py#L879-L908
[ "def", "_did_perform_standard_operation", "(", "self", ",", "connection", ")", ":", "if", "connection", ".", "async", ":", "callback", "=", "connection", ".", "callbacks", "[", "'remote'", "]", "if", "connection", ".", "user_info", "and", "'nurest_object'", "in"...
d334fea23e384d3df8e552fe1849ad707941c666
train
NURESTObject.create_child
Add given nurest_object to the current object For example, to add a child into a parent, you can call parent.create_child(nurest_object=child) Args: nurest_object (bambou.NURESTObject): the NURESTObject object to add response_choice (int): Automatica...
bambou/nurest_object.py
def create_child(self, nurest_object, response_choice=None, async=False, callback=None, commit=True): """ Add given nurest_object to the current object For example, to add a child into a parent, you can call parent.create_child(nurest_object=child) Args: nur...
def create_child(self, nurest_object, response_choice=None, async=False, callback=None, commit=True): """ Add given nurest_object to the current object For example, to add a child into a parent, you can call parent.create_child(nurest_object=child) Args: nur...
[ "Add", "given", "nurest_object", "to", "the", "current", "object" ]
nuagenetworks/bambou
python
https://github.com/nuagenetworks/bambou/blob/d334fea23e384d3df8e552fe1849ad707941c666/bambou/nurest_object.py#L912-L941
[ "def", "create_child", "(", "self", ",", "nurest_object", ",", "response_choice", "=", "None", ",", "async", "=", "False", ",", "callback", "=", "None", ",", "commit", "=", "True", ")", ":", "# if nurest_object.id:", "# raise InternalConsitencyError(\"Cannot cre...
d334fea23e384d3df8e552fe1849ad707941c666
train
NURESTObject.instantiate_child
Instantiate an nurest_object from a template object Args: nurest_object: the NURESTObject object to add from_template: the NURESTObject template object callback: callback containing the object and the connection Returns: Returns t...
bambou/nurest_object.py
def instantiate_child(self, nurest_object, from_template, response_choice=None, async=False, callback=None, commit=True): """ Instantiate an nurest_object from a template object Args: nurest_object: the NURESTObject object to add from_template: the NURESTObject templ...
def instantiate_child(self, nurest_object, from_template, response_choice=None, async=False, callback=None, commit=True): """ Instantiate an nurest_object from a template object Args: nurest_object: the NURESTObject object to add from_template: the NURESTObject templ...
[ "Instantiate", "an", "nurest_object", "from", "a", "template", "object" ]
nuagenetworks/bambou
python
https://github.com/nuagenetworks/bambou/blob/d334fea23e384d3df8e552fe1849ad707941c666/bambou/nurest_object.py#L943-L975
[ "def", "instantiate_child", "(", "self", ",", "nurest_object", ",", "from_template", ",", "response_choice", "=", "None", ",", "async", "=", "False", ",", "callback", "=", "None", ",", "commit", "=", "True", ")", ":", "# if nurest_object.id:", "# raise Inter...
d334fea23e384d3df8e552fe1849ad707941c666
train
NURESTObject._did_create_child
Callback called after adding a new child nurest_object
bambou/nurest_object.py
def _did_create_child(self, connection): """ Callback called after adding a new child nurest_object """ response = connection.response try: connection.user_info['nurest_object'].from_dict(response.data[0]) except Exception: pass return self._did_perform_...
def _did_create_child(self, connection): """ Callback called after adding a new child nurest_object """ response = connection.response try: connection.user_info['nurest_object'].from_dict(response.data[0]) except Exception: pass return self._did_perform_...
[ "Callback", "called", "after", "adding", "a", "new", "child", "nurest_object" ]
nuagenetworks/bambou
python
https://github.com/nuagenetworks/bambou/blob/d334fea23e384d3df8e552fe1849ad707941c666/bambou/nurest_object.py#L977-L986
[ "def", "_did_create_child", "(", "self", ",", "connection", ")", ":", "response", "=", "connection", ".", "response", "try", ":", "connection", ".", "user_info", "[", "'nurest_object'", "]", ".", "from_dict", "(", "response", ".", "data", "[", "0", "]", ")...
d334fea23e384d3df8e552fe1849ad707941c666
train
NURESTObject.assign
Reference a list of objects into the current resource Args: objects (list): list of NURESTObject to link nurest_object_type (type): Type of the object to link callback (function): Callback method that should be fired at the end Returns: ...
bambou/nurest_object.py
def assign(self, objects, nurest_object_type, async=False, callback=None, commit=True): """ Reference a list of objects into the current resource Args: objects (list): list of NURESTObject to link nurest_object_type (type): Type of the object to link ...
def assign(self, objects, nurest_object_type, async=False, callback=None, commit=True): """ Reference a list of objects into the current resource Args: objects (list): list of NURESTObject to link nurest_object_type (type): Type of the object to link ...
[ "Reference", "a", "list", "of", "objects", "into", "the", "current", "resource" ]
nuagenetworks/bambou
python
https://github.com/nuagenetworks/bambou/blob/d334fea23e384d3df8e552fe1849ad707941c666/bambou/nurest_object.py#L988-L1022
[ "def", "assign", "(", "self", ",", "objects", ",", "nurest_object_type", ",", "async", "=", "False", ",", "callback", "=", "None", ",", "commit", "=", "True", ")", ":", "ids", "=", "list", "(", ")", "for", "nurest_object", "in", "objects", ":", "ids", ...
d334fea23e384d3df8e552fe1849ad707941c666
train
NURESTObject.rest_equals
Compare objects REST attributes
bambou/nurest_object.py
def rest_equals(self, rest_object): """ Compare objects REST attributes """ if not self.equals(rest_object): return False return self.to_dict() == rest_object.to_dict()
def rest_equals(self, rest_object): """ Compare objects REST attributes """ if not self.equals(rest_object): return False return self.to_dict() == rest_object.to_dict()
[ "Compare", "objects", "REST", "attributes" ]
nuagenetworks/bambou
python
https://github.com/nuagenetworks/bambou/blob/d334fea23e384d3df8e552fe1849ad707941c666/bambou/nurest_object.py#L1026-L1033
[ "def", "rest_equals", "(", "self", ",", "rest_object", ")", ":", "if", "not", "self", ".", "equals", "(", "rest_object", ")", ":", "return", "False", "return", "self", ".", "to_dict", "(", ")", "==", "rest_object", ".", "to_dict", "(", ")" ]
d334fea23e384d3df8e552fe1849ad707941c666
train
NURESTObject.equals
Compare with another object
bambou/nurest_object.py
def equals(self, rest_object): """ Compare with another object """ if self._is_dirty: return False if rest_object is None: return False if not isinstance(rest_object, NURESTObject): raise TypeError('The object is not a NURESTObject %s' % rest_object...
def equals(self, rest_object): """ Compare with another object """ if self._is_dirty: return False if rest_object is None: return False if not isinstance(rest_object, NURESTObject): raise TypeError('The object is not a NURESTObject %s' % rest_object...
[ "Compare", "with", "another", "object" ]
nuagenetworks/bambou
python
https://github.com/nuagenetworks/bambou/blob/d334fea23e384d3df8e552fe1849ad707941c666/bambou/nurest_object.py#L1035-L1056
[ "def", "equals", "(", "self", ",", "rest_object", ")", ":", "if", "self", ".", "_is_dirty", ":", "return", "False", "if", "rest_object", "is", "None", ":", "return", "False", "if", "not", "isinstance", "(", "rest_object", ",", "NURESTObject", ")", ":", "...
d334fea23e384d3df8e552fe1849ad707941c666
train
get_ip_address
Correct IP address is expected as first element of HTTP_X_FORWARDED_FOR or REMOTE_ADDR
waldur_core/logging/middleware.py
def get_ip_address(request): """ Correct IP address is expected as first element of HTTP_X_FORWARDED_FOR or REMOTE_ADDR """ if 'HTTP_X_FORWARDED_FOR' in request.META: return request.META['HTTP_X_FORWARDED_FOR'].split(',')[0].strip() else: return request.META['REMOTE_ADDR']
def get_ip_address(request): """ Correct IP address is expected as first element of HTTP_X_FORWARDED_FOR or REMOTE_ADDR """ if 'HTTP_X_FORWARDED_FOR' in request.META: return request.META['HTTP_X_FORWARDED_FOR'].split(',')[0].strip() else: return request.META['REMOTE_ADDR']
[ "Correct", "IP", "address", "is", "expected", "as", "first", "element", "of", "HTTP_X_FORWARDED_FOR", "or", "REMOTE_ADDR" ]
opennode/waldur-core
python
https://github.com/opennode/waldur-core/blob/d6c17a9592bb6c49c33567542eef8d099605a46a/waldur_core/logging/middleware.py#L29-L36
[ "def", "get_ip_address", "(", "request", ")", ":", "if", "'HTTP_X_FORWARDED_FOR'", "in", "request", ".", "META", ":", "return", "request", ".", "META", "[", "'HTTP_X_FORWARDED_FOR'", "]", ".", "split", "(", "','", ")", "[", "0", "]", ".", "strip", "(", "...
d6c17a9592bb6c49c33567542eef8d099605a46a
train
Command.get_estimates_without_scope_in_month
It is expected that valid row for each month contains at least one price estimate for customer, service setting, service, service project link, project and resource. Otherwise all price estimates in the row should be deleted.
waldur_core/cost_tracking/management/commands/delete_invalid_price_estimates.py
def get_estimates_without_scope_in_month(self, customer): """ It is expected that valid row for each month contains at least one price estimate for customer, service setting, service, service project link, project and resource. Otherwise all price estimates in the row should be d...
def get_estimates_without_scope_in_month(self, customer): """ It is expected that valid row for each month contains at least one price estimate for customer, service setting, service, service project link, project and resource. Otherwise all price estimates in the row should be d...
[ "It", "is", "expected", "that", "valid", "row", "for", "each", "month", "contains", "at", "least", "one", "price", "estimate", "for", "customer", "service", "setting", "service", "service", "project", "link", "project", "and", "resource", ".", "Otherwise", "al...
opennode/waldur-core
python
https://github.com/opennode/waldur-core/blob/d6c17a9592bb6c49c33567542eef8d099605a46a/waldur_core/cost_tracking/management/commands/delete_invalid_price_estimates.py#L78-L109
[ "def", "get_estimates_without_scope_in_month", "(", "self", ",", "customer", ")", ":", "estimates", "=", "self", ".", "get_price_estimates_for_customer", "(", "customer", ")", "if", "not", "estimates", ":", "return", "[", "]", "tables", "=", "{", "model", ":", ...
d6c17a9592bb6c49c33567542eef8d099605a46a
train
NURemoteAttribute.is_identifier
Setter for is_identifier
bambou/utils/nuremote_attribute.py
def is_identifier(self, is_identifier): """ Setter for is_identifier """ if is_identifier: self.is_editable = False self._is_identifier = is_identifier
def is_identifier(self, is_identifier): """ Setter for is_identifier """ if is_identifier: self.is_editable = False self._is_identifier = is_identifier
[ "Setter", "for", "is_identifier" ]
nuagenetworks/bambou
python
https://github.com/nuagenetworks/bambou/blob/d334fea23e384d3df8e552fe1849ad707941c666/bambou/utils/nuremote_attribute.py#L75-L81
[ "def", "is_identifier", "(", "self", ",", "is_identifier", ")", ":", "if", "is_identifier", ":", "self", ".", "is_editable", "=", "False", "self", ".", "_is_identifier", "=", "is_identifier" ]
d334fea23e384d3df8e552fe1849ad707941c666
train
NURemoteAttribute.is_password
Setter for is_identifier
bambou/utils/nuremote_attribute.py
def is_password(self, is_password): """ Setter for is_identifier """ if is_password: self.is_forgetable = True self._is_password = is_password
def is_password(self, is_password): """ Setter for is_identifier """ if is_password: self.is_forgetable = True self._is_password = is_password
[ "Setter", "for", "is_identifier" ]
nuagenetworks/bambou
python
https://github.com/nuagenetworks/bambou/blob/d334fea23e384d3df8e552fe1849ad707941c666/bambou/utils/nuremote_attribute.py#L90-L96
[ "def", "is_password", "(", "self", ",", "is_password", ")", ":", "if", "is_password", ":", "self", ".", "is_forgetable", "=", "True", "self", ".", "_is_password", "=", "is_password" ]
d334fea23e384d3df8e552fe1849ad707941c666
train
NURemoteAttribute.choices
Setter for is_identifier
bambou/utils/nuremote_attribute.py
def choices(self, choices): """ Setter for is_identifier """ if choices is not None and len(choices) > 0: self.has_choices = True self._choices = choices
def choices(self, choices): """ Setter for is_identifier """ if choices is not None and len(choices) > 0: self.has_choices = True self._choices = choices
[ "Setter", "for", "is_identifier" ]
nuagenetworks/bambou
python
https://github.com/nuagenetworks/bambou/blob/d334fea23e384d3df8e552fe1849ad707941c666/bambou/utils/nuremote_attribute.py#L105-L111
[ "def", "choices", "(", "self", ",", "choices", ")", ":", "if", "choices", "is", "not", "None", "and", "len", "(", "choices", ")", ">", "0", ":", "self", ".", "has_choices", "=", "True", "self", ".", "_choices", "=", "choices" ]
d334fea23e384d3df8e552fe1849ad707941c666
train
NURemoteAttribute.get_default_value
Get a default value of the attribute_type
bambou/utils/nuremote_attribute.py
def get_default_value(self): """ Get a default value of the attribute_type """ if self.choices: return self.choices[0] value = self.attribute_type() if self.attribute_type is time: value = int(value) elif self.attribute_type is str: value =...
def get_default_value(self): """ Get a default value of the attribute_type """ if self.choices: return self.choices[0] value = self.attribute_type() if self.attribute_type is time: value = int(value) elif self.attribute_type is str: value =...
[ "Get", "a", "default", "value", "of", "the", "attribute_type" ]
nuagenetworks/bambou
python
https://github.com/nuagenetworks/bambou/blob/d334fea23e384d3df8e552fe1849ad707941c666/bambou/utils/nuremote_attribute.py#L115-L141
[ "def", "get_default_value", "(", "self", ")", ":", "if", "self", ".", "choices", ":", "return", "self", ".", "choices", "[", "0", "]", "value", "=", "self", ".", "attribute_type", "(", ")", "if", "self", ".", "attribute_type", "is", "time", ":", "value...
d334fea23e384d3df8e552fe1849ad707941c666
train
NURemoteAttribute.get_min_value
Get the minimum value
bambou/utils/nuremote_attribute.py
def get_min_value(self): """ Get the minimum value """ value = self.get_default_value() if self.attribute_type is str: min_value = value[:self.min_length - 1] elif self.attribute_type is int: min_value = self.min_length - 1 else: raise Type...
def get_min_value(self): """ Get the minimum value """ value = self.get_default_value() if self.attribute_type is str: min_value = value[:self.min_length - 1] elif self.attribute_type is int: min_value = self.min_length - 1 else: raise Type...
[ "Get", "the", "minimum", "value" ]
nuagenetworks/bambou
python
https://github.com/nuagenetworks/bambou/blob/d334fea23e384d3df8e552fe1849ad707941c666/bambou/utils/nuremote_attribute.py#L143-L157
[ "def", "get_min_value", "(", "self", ")", ":", "value", "=", "self", ".", "get_default_value", "(", ")", "if", "self", ".", "attribute_type", "is", "str", ":", "min_value", "=", "value", "[", ":", "self", ".", "min_length", "-", "1", "]", "elif", "self...
d334fea23e384d3df8e552fe1849ad707941c666
train
NURemoteAttribute.get_max_value
Get the maximum value
bambou/utils/nuremote_attribute.py
def get_max_value(self): """ Get the maximum value """ value = self.get_default_value() if self.attribute_type is str: max_value = value.ljust(self.max_length + 1, 'a') elif self.attribute_type is int: max_value = self.max_length + 1 else: ...
def get_max_value(self): """ Get the maximum value """ value = self.get_default_value() if self.attribute_type is str: max_value = value.ljust(self.max_length + 1, 'a') elif self.attribute_type is int: max_value = self.max_length + 1 else: ...
[ "Get", "the", "maximum", "value" ]
nuagenetworks/bambou
python
https://github.com/nuagenetworks/bambou/blob/d334fea23e384d3df8e552fe1849ad707941c666/bambou/utils/nuremote_attribute.py#L159-L173
[ "def", "get_max_value", "(", "self", ")", ":", "value", "=", "self", ".", "get_default_value", "(", ")", "if", "self", ".", "attribute_type", "is", "str", ":", "max_value", "=", "value", ".", "ljust", "(", "self", ".", "max_length", "+", "1", ",", "'a'...
d334fea23e384d3df8e552fe1849ad707941c666
train
SortedDefaultRouter.get_api_root_view
Return a basic root view.
waldur_core/core/routers.py
def get_api_root_view(self, api_urls=None): """ Return a basic root view. """ api_root_dict = OrderedDict() list_name = self.routes[0].name for prefix, viewset, basename in self.registry: api_root_dict[prefix] = list_name.format(basename=basename) cla...
def get_api_root_view(self, api_urls=None): """ Return a basic root view. """ api_root_dict = OrderedDict() list_name = self.routes[0].name for prefix, viewset, basename in self.registry: api_root_dict[prefix] = list_name.format(basename=basename) cla...
[ "Return", "a", "basic", "root", "view", "." ]
opennode/waldur-core
python
https://github.com/opennode/waldur-core/blob/d6c17a9592bb6c49c33567542eef8d099605a46a/waldur_core/core/routers.py#L13-L47
[ "def", "get_api_root_view", "(", "self", ",", "api_urls", "=", "None", ")", ":", "api_root_dict", "=", "OrderedDict", "(", ")", "list_name", "=", "self", ".", "routes", "[", "0", "]", ".", "name", "for", "prefix", ",", "viewset", ",", "basename", "in", ...
d6c17a9592bb6c49c33567542eef8d099605a46a
train
SortedDefaultRouter.get_default_base_name
Attempt to automatically determine base name using `get_url_name`.
waldur_core/core/routers.py
def get_default_base_name(self, viewset): """ Attempt to automatically determine base name using `get_url_name`. """ queryset = getattr(viewset, 'queryset', None) if queryset is not None: get_url_name = getattr(queryset.model, 'get_url_name', None) if get...
def get_default_base_name(self, viewset): """ Attempt to automatically determine base name using `get_url_name`. """ queryset = getattr(viewset, 'queryset', None) if queryset is not None: get_url_name = getattr(queryset.model, 'get_url_name', None) if get...
[ "Attempt", "to", "automatically", "determine", "base", "name", "using", "get_url_name", "." ]
opennode/waldur-core
python
https://github.com/opennode/waldur-core/blob/d6c17a9592bb6c49c33567542eef8d099605a46a/waldur_core/core/routers.py#L49-L60
[ "def", "get_default_base_name", "(", "self", ",", "viewset", ")", ":", "queryset", "=", "getattr", "(", "viewset", ",", "'queryset'", ",", "None", ")", "if", "queryset", "is", "not", "None", ":", "get_url_name", "=", "getattr", "(", "queryset", ".", "model...
d6c17a9592bb6c49c33567542eef8d099605a46a
train
change_customer_nc_users_quota
Modify nc_user_count quota usage on structure role grant or revoke
waldur_core/structure/handlers.py
def change_customer_nc_users_quota(sender, structure, user, role, signal, **kwargs): """ Modify nc_user_count quota usage on structure role grant or revoke """ assert signal in (signals.structure_role_granted, signals.structure_role_revoked), \ 'Handler "change_customer_nc_users_quota" has to be used on...
def change_customer_nc_users_quota(sender, structure, user, role, signal, **kwargs): """ Modify nc_user_count quota usage on structure role grant or revoke """ assert signal in (signals.structure_role_granted, signals.structure_role_revoked), \ 'Handler "change_customer_nc_users_quota" has to be used on...
[ "Modify", "nc_user_count", "quota", "usage", "on", "structure", "role", "grant", "or", "revoke" ]
opennode/waldur-core
python
https://github.com/opennode/waldur-core/blob/d6c17a9592bb6c49c33567542eef8d099605a46a/waldur_core/structure/handlers.py#L196-L209
[ "def", "change_customer_nc_users_quota", "(", "sender", ",", "structure", ",", "user", ",", "role", ",", "signal", ",", "*", "*", "kwargs", ")", ":", "assert", "signal", "in", "(", "signals", ".", "structure_role_granted", ",", "signals", ".", "structure_role_...
d6c17a9592bb6c49c33567542eef8d099605a46a
train
delete_service_settings_on_service_delete
Delete not shared service settings without services
waldur_core/structure/handlers.py
def delete_service_settings_on_service_delete(sender, instance, **kwargs): """ Delete not shared service settings without services """ service = instance try: service_settings = service.settings except ServiceSettings.DoesNotExist: # If this handler works together with delete_service_set...
def delete_service_settings_on_service_delete(sender, instance, **kwargs): """ Delete not shared service settings without services """ service = instance try: service_settings = service.settings except ServiceSettings.DoesNotExist: # If this handler works together with delete_service_set...
[ "Delete", "not", "shared", "service", "settings", "without", "services" ]
opennode/waldur-core
python
https://github.com/opennode/waldur-core/blob/d6c17a9592bb6c49c33567542eef8d099605a46a/waldur_core/structure/handlers.py#L312-L322
[ "def", "delete_service_settings_on_service_delete", "(", "sender", ",", "instance", ",", "*", "*", "kwargs", ")", ":", "service", "=", "instance", "try", ":", "service_settings", "=", "service", ".", "settings", "except", "ServiceSettings", ".", "DoesNotExist", ":...
d6c17a9592bb6c49c33567542eef8d099605a46a
train
delete_service_settings_on_scope_delete
If VM that contains service settings were deleted - all settings resources could be safely deleted from NC.
waldur_core/structure/handlers.py
def delete_service_settings_on_scope_delete(sender, instance, **kwargs): """ If VM that contains service settings were deleted - all settings resources could be safely deleted from NC. """ for service_settings in ServiceSettings.objects.filter(scope=instance): service_settings.unlink_descend...
def delete_service_settings_on_scope_delete(sender, instance, **kwargs): """ If VM that contains service settings were deleted - all settings resources could be safely deleted from NC. """ for service_settings in ServiceSettings.objects.filter(scope=instance): service_settings.unlink_descend...
[ "If", "VM", "that", "contains", "service", "settings", "were", "deleted", "-", "all", "settings", "resources", "could", "be", "safely", "deleted", "from", "NC", "." ]
opennode/waldur-core
python
https://github.com/opennode/waldur-core/blob/d6c17a9592bb6c49c33567542eef8d099605a46a/waldur_core/structure/handlers.py#L343-L349
[ "def", "delete_service_settings_on_scope_delete", "(", "sender", ",", "instance", ",", "*", "*", "kwargs", ")", ":", "for", "service_settings", "in", "ServiceSettings", ".", "objects", ".", "filter", "(", "scope", "=", "instance", ")", ":", "service_settings", "...
d6c17a9592bb6c49c33567542eef8d099605a46a
train
NURESTLoginController.url
Set API URL endpoint Args: url: the url of the API endpoint
bambou/nurest_login_controller.py
def url(self, url): """ Set API URL endpoint Args: url: the url of the API endpoint """ if url and url.endswith('/'): url = url[:-1] self._url = url
def url(self, url): """ Set API URL endpoint Args: url: the url of the API endpoint """ if url and url.endswith('/'): url = url[:-1] self._url = url
[ "Set", "API", "URL", "endpoint" ]
nuagenetworks/bambou
python
https://github.com/nuagenetworks/bambou/blob/d334fea23e384d3df8e552fe1849ad707941c666/bambou/nurest_login_controller.py#L191-L200
[ "def", "url", "(", "self", ",", "url", ")", ":", "if", "url", "and", "url", ".", "endswith", "(", "'/'", ")", ":", "url", "=", "url", "[", ":", "-", "1", "]", "self", ".", "_url", "=", "url" ]
d334fea23e384d3df8e552fe1849ad707941c666
train
NURESTLoginController.get_authentication_header
Return authenication string to place in Authorization Header If API Token is set, it'll be used. Otherwise, the clear text password will be sent. Users of NURESTLoginController are responsible to clean the password property. Returns: Returns the XREST Au...
bambou/nurest_login_controller.py
def get_authentication_header(self, user=None, api_key=None, password=None, certificate=None): """ Return authenication string to place in Authorization Header If API Token is set, it'll be used. Otherwise, the clear text password will be sent. Users of NURESTLoginController are respons...
def get_authentication_header(self, user=None, api_key=None, password=None, certificate=None): """ Return authenication string to place in Authorization Header If API Token is set, it'll be used. Otherwise, the clear text password will be sent. Users of NURESTLoginController are respons...
[ "Return", "authenication", "string", "to", "place", "in", "Authorization", "Header" ]
nuagenetworks/bambou
python
https://github.com/nuagenetworks/bambou/blob/d334fea23e384d3df8e552fe1849ad707941c666/bambou/nurest_login_controller.py#L223-L256
[ "def", "get_authentication_header", "(", "self", ",", "user", "=", "None", ",", "api_key", "=", "None", ",", "password", "=", "None", ",", "certificate", "=", "None", ")", ":", "if", "not", "user", ":", "user", "=", "self", ".", "user", "if", "not", ...
d334fea23e384d3df8e552fe1849ad707941c666
train
NURESTLoginController.reset
Reset controller It removes all information about previous session
bambou/nurest_login_controller.py
def reset(self): """ Reset controller It removes all information about previous session """ self._is_impersonating = False self._impersonation = None self.user = None self.password = None self.api_key = None self.enterprise = None se...
def reset(self): """ Reset controller It removes all information about previous session """ self._is_impersonating = False self._impersonation = None self.user = None self.password = None self.api_key = None self.enterprise = None se...
[ "Reset", "controller" ]
nuagenetworks/bambou
python
https://github.com/nuagenetworks/bambou/blob/d334fea23e384d3df8e552fe1849ad707941c666/bambou/nurest_login_controller.py#L258-L271
[ "def", "reset", "(", "self", ")", ":", "self", ".", "_is_impersonating", "=", "False", "self", ".", "_impersonation", "=", "None", "self", ".", "user", "=", "None", "self", ".", "password", "=", "None", "self", ".", "api_key", "=", "None", "self", ".",...
d334fea23e384d3df8e552fe1849ad707941c666
train
NURESTLoginController.impersonate
Impersonate a user in a enterprise Args: user: the name of the user to impersonate enterprise: the name of the enterprise where to use impersonation
bambou/nurest_login_controller.py
def impersonate(self, user, enterprise): """ Impersonate a user in a enterprise Args: user: the name of the user to impersonate enterprise: the name of the enterprise where to use impersonation """ if not user or not enterprise: raise Val...
def impersonate(self, user, enterprise): """ Impersonate a user in a enterprise Args: user: the name of the user to impersonate enterprise: the name of the enterprise where to use impersonation """ if not user or not enterprise: raise Val...
[ "Impersonate", "a", "user", "in", "a", "enterprise" ]
nuagenetworks/bambou
python
https://github.com/nuagenetworks/bambou/blob/d334fea23e384d3df8e552fe1849ad707941c666/bambou/nurest_login_controller.py#L273-L285
[ "def", "impersonate", "(", "self", ",", "user", ",", "enterprise", ")", ":", "if", "not", "user", "or", "not", "enterprise", ":", "raise", "ValueError", "(", "'You must set a user name and an enterprise name to begin impersonification'", ")", "self", ".", "_is_imperso...
d334fea23e384d3df8e552fe1849ad707941c666
train
NURESTLoginController.equals
Verify if the controller corresponds to the current one.
bambou/nurest_login_controller.py
def equals(self, controller): """ Verify if the controller corresponds to the current one. """ if controller is None: return False return self.user == controller.user and self.enterprise == controller.enterprise and self.url == controller.url
def equals(self, controller): """ Verify if the controller corresponds to the current one. """ if controller is None: return False return self.user == controller.user and self.enterprise == controller.enterprise and self.url == controller.url
[ "Verify", "if", "the", "controller", "corresponds", "to", "the", "current", "one", "." ]
nuagenetworks/bambou
python
https://github.com/nuagenetworks/bambou/blob/d334fea23e384d3df8e552fe1849ad707941c666/bambou/nurest_login_controller.py#L294-L302
[ "def", "equals", "(", "self", ",", "controller", ")", ":", "if", "controller", "is", "None", ":", "return", "False", "return", "self", ".", "user", "==", "controller", ".", "user", "and", "self", ".", "enterprise", "==", "controller", ".", "enterprise", ...
d334fea23e384d3df8e552fe1849ad707941c666
train
create_application
WSGI adapter. It creates a simple WSGI application, that can be used with any WSGI server. The arguments are: #. ``server`` is a pyws server object, #. ``root_url`` is an URL to which the server will be bound. An application created by the function transforms WSGI environment into a pyws request o...
src/pyws/adapters/_wsgi.py
def create_application(server, root_url): """ WSGI adapter. It creates a simple WSGI application, that can be used with any WSGI server. The arguments are: #. ``server`` is a pyws server object, #. ``root_url`` is an URL to which the server will be bound. An application created by the function...
def create_application(server, root_url): """ WSGI adapter. It creates a simple WSGI application, that can be used with any WSGI server. The arguments are: #. ``server`` is a pyws server object, #. ``root_url`` is an URL to which the server will be bound. An application created by the function...
[ "WSGI", "adapter", ".", "It", "creates", "a", "simple", "WSGI", "application", "that", "can", "be", "used", "with", "any", "WSGI", "server", ".", "The", "arguments", "are", ":" ]
stepank/pyws
python
https://github.com/stepank/pyws/blob/ff39133aabeb56bbb08d66286ac0cc8731eda7dd/src/pyws/adapters/_wsgi.py#L8-L58
[ "def", "create_application", "(", "server", ",", "root_url", ")", ":", "def", "serve", "(", "environ", ",", "start_response", ")", ":", "root", "=", "root_url", ".", "lstrip", "(", "'/'", ")", "tail", ",", "get", "=", "(", "util", ".", "request_uri", "...
ff39133aabeb56bbb08d66286ac0cc8731eda7dd
train
compiler_dialect
构建dialect
aiosqlite3/sa/engine.py
def compiler_dialect(paramstyle='named'): """ 构建dialect """ dialect = SQLiteDialect_pysqlite( json_serializer=json.dumps, json_deserializer=json_deserializer, paramstyle=paramstyle ) dialect.default_paramstyle = paramstyle dialect.statement_compiler = ACompiler_sqlite...
def compiler_dialect(paramstyle='named'): """ 构建dialect """ dialect = SQLiteDialect_pysqlite( json_serializer=json.dumps, json_deserializer=json_deserializer, paramstyle=paramstyle ) dialect.default_paramstyle = paramstyle dialect.statement_compiler = ACompiler_sqlite...
[ "构建dialect" ]
zeromake/aiosqlite3
python
https://github.com/zeromake/aiosqlite3/blob/1a74a062507e2df8f833a70885e69dca0ab3e7e7/aiosqlite3/sa/engine.py#L58-L69
[ "def", "compiler_dialect", "(", "paramstyle", "=", "'named'", ")", ":", "dialect", "=", "SQLiteDialect_pysqlite", "(", "json_serializer", "=", "json", ".", "dumps", ",", "json_deserializer", "=", "json_deserializer", ",", "paramstyle", "=", "paramstyle", ")", "dia...
1a74a062507e2df8f833a70885e69dca0ab3e7e7
train
create_engine
A coroutine for Engine creation. Returns Engine instance with embedded connection pool. The pool has *minsize* opened connections to sqlite3.
aiosqlite3/sa/engine.py
def create_engine( database, minsize=1, maxsize=10, loop=None, dialect=_dialect, paramstyle=None, **kwargs): """ A coroutine for Engine creation. Returns Engine instance with embedded connection pool. The pool has *minsize* opened connections to ...
def create_engine( database, minsize=1, maxsize=10, loop=None, dialect=_dialect, paramstyle=None, **kwargs): """ A coroutine for Engine creation. Returns Engine instance with embedded connection pool. The pool has *minsize* opened connections to ...
[ "A", "coroutine", "for", "Engine", "creation", "." ]
zeromake/aiosqlite3
python
https://github.com/zeromake/aiosqlite3/blob/1a74a062507e2df8f833a70885e69dca0ab3e7e7/aiosqlite3/sa/engine.py#L75-L99
[ "def", "create_engine", "(", "database", ",", "minsize", "=", "1", ",", "maxsize", "=", "10", ",", "loop", "=", "None", ",", "dialect", "=", "_dialect", ",", "paramstyle", "=", "None", ",", "*", "*", "kwargs", ")", ":", "coro", "=", "_create_engine", ...
1a74a062507e2df8f833a70885e69dca0ab3e7e7
train
Engine.release
Revert back connection to pool.
aiosqlite3/sa/engine.py
def release(self, conn): """Revert back connection to pool.""" if conn.in_transaction: raise InvalidRequestError( "Cannot release a connection with " "not finished transaction" ) raw = conn.connection res = yield from self._pool.rel...
def release(self, conn): """Revert back connection to pool.""" if conn.in_transaction: raise InvalidRequestError( "Cannot release a connection with " "not finished transaction" ) raw = conn.connection res = yield from self._pool.rel...
[ "Revert", "back", "connection", "to", "pool", "." ]
zeromake/aiosqlite3
python
https://github.com/zeromake/aiosqlite3/blob/1a74a062507e2df8f833a70885e69dca0ab3e7e7/aiosqlite3/sa/engine.py#L213-L222
[ "def", "release", "(", "self", ",", "conn", ")", ":", "if", "conn", ".", "in_transaction", ":", "raise", "InvalidRequestError", "(", "\"Cannot release a connection with \"", "\"not finished transaction\"", ")", "raw", "=", "conn", ".", "connection", "res", "=", "y...
1a74a062507e2df8f833a70885e69dca0ab3e7e7
train
CostTrackingRegister.get_configuration
Return how much consumables are used by resource with current configuration. Output example: { <ConsumableItem instance>: <usage>, <ConsumableItem instance>: <usage>, ... }
waldur_core/cost_tracking/__init__.py
def get_configuration(cls, resource): """ Return how much consumables are used by resource with current configuration. Output example: { <ConsumableItem instance>: <usage>, <ConsumableItem instance>: <usage>, ... } """ ...
def get_configuration(cls, resource): """ Return how much consumables are used by resource with current configuration. Output example: { <ConsumableItem instance>: <usage>, <ConsumableItem instance>: <usage>, ... } """ ...
[ "Return", "how", "much", "consumables", "are", "used", "by", "resource", "with", "current", "configuration", "." ]
opennode/waldur-core
python
https://github.com/opennode/waldur-core/blob/d6c17a9592bb6c49c33567542eef8d099605a46a/waldur_core/cost_tracking/__init__.py#L124-L135
[ "def", "get_configuration", "(", "cls", ",", "resource", ")", ":", "strategy", "=", "cls", ".", "_get_strategy", "(", "resource", ".", "__class__", ")", "return", "strategy", ".", "get_configuration", "(", "resource", ")" ]
d6c17a9592bb6c49c33567542eef8d099605a46a
train
ResultProxy.close
Close this ResultProxy. Closes the underlying DBAPI cursor corresponding to the execution. Note that any data cached within this ResultProxy is still available. For some types of results, this may include buffered rows. If this ResultProxy was generated from an implicit execution, ...
aiosqlite3/sa/result.py
def close(self): """Close this ResultProxy. Closes the underlying DBAPI cursor corresponding to the execution. Note that any data cached within this ResultProxy is still available. For some types of results, this may include buffered rows. If this ResultProxy was generated from a...
def close(self): """Close this ResultProxy. Closes the underlying DBAPI cursor corresponding to the execution. Note that any data cached within this ResultProxy is still available. For some types of results, this may include buffered rows. If this ResultProxy was generated from a...
[ "Close", "this", "ResultProxy", ".", "Closes", "the", "underlying", "DBAPI", "cursor", "corresponding", "to", "the", "execution", ".", "Note", "that", "any", "data", "cached", "within", "this", "ResultProxy", "is", "still", "available", ".", "For", "some", "ty...
zeromake/aiosqlite3
python
https://github.com/zeromake/aiosqlite3/blob/1a74a062507e2df8f833a70885e69dca0ab3e7e7/aiosqlite3/sa/result.py#L315-L336
[ "def", "close", "(", "self", ")", ":", "if", "not", "self", ".", "_closed", ":", "self", ".", "_closed", "=", "True", "yield", "from", "self", ".", "_cursor", ".", "close", "(", ")", "# allow consistent errors", "self", ".", "_cursor", "=", "None", "se...
1a74a062507e2df8f833a70885e69dca0ab3e7e7
train
get_version
Obtain the version number
setup.py
def get_version(): """Obtain the version number""" import imp import os mod = imp.load_source( 'version', os.path.join('skdata', '__init__.py') ) return mod.__version__
def get_version(): """Obtain the version number""" import imp import os mod = imp.load_source( 'version', os.path.join('skdata', '__init__.py') ) return mod.__version__
[ "Obtain", "the", "version", "number" ]
OpenDataScienceLab/skdata
python
https://github.com/OpenDataScienceLab/skdata/blob/34f06845a944ff4f048b55c7babdd8420f71a6b9/setup.py#L29-L36
[ "def", "get_version", "(", ")", ":", "import", "imp", "import", "os", "mod", "=", "imp", ".", "load_source", "(", "'version'", ",", "os", ".", "path", ".", "join", "(", "'skdata'", ",", "'__init__.py'", ")", ")", "return", "mod", ".", "__version__" ]
34f06845a944ff4f048b55c7babdd8420f71a6b9
train
InvitationViewSet.accept
Accept invitation for current user. To replace user's email with email from invitation - add parameter 'replace_email' to request POST body.
waldur_core/users/views.py
def accept(self, request, uuid=None): """ Accept invitation for current user. To replace user's email with email from invitation - add parameter 'replace_email' to request POST body. """ invitation = self.get_object() if invitation.state != models.Invitation.Sta...
def accept(self, request, uuid=None): """ Accept invitation for current user. To replace user's email with email from invitation - add parameter 'replace_email' to request POST body. """ invitation = self.get_object() if invitation.state != models.Invitation.Sta...
[ "Accept", "invitation", "for", "current", "user", "." ]
opennode/waldur-core
python
https://github.com/opennode/waldur-core/blob/d6c17a9592bb6c49c33567542eef8d099605a46a/waldur_core/users/views.py#L94-L119
[ "def", "accept", "(", "self", ",", "request", ",", "uuid", "=", "None", ")", ":", "invitation", "=", "self", ".", "get_object", "(", ")", "if", "invitation", ".", "state", "!=", "models", ".", "Invitation", ".", "State", ".", "PENDING", ":", "raise", ...
d6c17a9592bb6c49c33567542eef8d099605a46a
train
scope_deletion
Run different actions on price estimate scope deletion. If scope is a customer - delete all customer estimates and their children. If scope is a deleted resource - redefine consumption details, recalculate ancestors estimates and update estimate details. ...
waldur_core/cost_tracking/handlers.py
def scope_deletion(sender, instance, **kwargs): """ Run different actions on price estimate scope deletion. If scope is a customer - delete all customer estimates and their children. If scope is a deleted resource - redefine consumption details, recalculate ...
def scope_deletion(sender, instance, **kwargs): """ Run different actions on price estimate scope deletion. If scope is a customer - delete all customer estimates and their children. If scope is a deleted resource - redefine consumption details, recalculate ...
[ "Run", "different", "actions", "on", "price", "estimate", "scope", "deletion", "." ]
opennode/waldur-core
python
https://github.com/opennode/waldur-core/blob/d6c17a9592bb6c49c33567542eef8d099605a46a/waldur_core/cost_tracking/handlers.py#L16-L35
[ "def", "scope_deletion", "(", "sender", ",", "instance", ",", "*", "*", "kwargs", ")", ":", "is_resource", "=", "isinstance", "(", "instance", ",", "structure_models", ".", "ResourceMixin", ")", "if", "is_resource", "and", "getattr", "(", "instance", ",", "'...
d6c17a9592bb6c49c33567542eef8d099605a46a
train
_resource_deletion
Recalculate consumption details and save resource details
waldur_core/cost_tracking/handlers.py
def _resource_deletion(resource): """ Recalculate consumption details and save resource details """ if resource.__class__ not in CostTrackingRegister.registered_resources: return new_configuration = {} price_estimate = models.PriceEstimate.update_resource_estimate(resource, new_configuration) ...
def _resource_deletion(resource): """ Recalculate consumption details and save resource details """ if resource.__class__ not in CostTrackingRegister.registered_resources: return new_configuration = {} price_estimate = models.PriceEstimate.update_resource_estimate(resource, new_configuration) ...
[ "Recalculate", "consumption", "details", "and", "save", "resource", "details" ]
opennode/waldur-core
python
https://github.com/opennode/waldur-core/blob/d6c17a9592bb6c49c33567542eef8d099605a46a/waldur_core/cost_tracking/handlers.py#L52-L58
[ "def", "_resource_deletion", "(", "resource", ")", ":", "if", "resource", ".", "__class__", "not", "in", "CostTrackingRegister", ".", "registered_resources", ":", "return", "new_configuration", "=", "{", "}", "price_estimate", "=", "models", ".", "PriceEstimate", ...
d6c17a9592bb6c49c33567542eef8d099605a46a
train
resource_update
Update resource consumption details and price estimate if its configuration has changed. Create estimates for previous months if resource was created not in current month.
waldur_core/cost_tracking/handlers.py
def resource_update(sender, instance, created=False, **kwargs): """ Update resource consumption details and price estimate if its configuration has changed. Create estimates for previous months if resource was created not in current month. """ resource = instance try: new_configuration =...
def resource_update(sender, instance, created=False, **kwargs): """ Update resource consumption details and price estimate if its configuration has changed. Create estimates for previous months if resource was created not in current month. """ resource = instance try: new_configuration =...
[ "Update", "resource", "consumption", "details", "and", "price", "estimate", "if", "its", "configuration", "has", "changed", ".", "Create", "estimates", "for", "previous", "months", "if", "resource", "was", "created", "not", "in", "current", "month", "." ]
opennode/waldur-core
python
https://github.com/opennode/waldur-core/blob/d6c17a9592bb6c49c33567542eef8d099605a46a/waldur_core/cost_tracking/handlers.py#L66-L79
[ "def", "resource_update", "(", "sender", ",", "instance", ",", "created", "=", "False", ",", "*", "*", "kwargs", ")", ":", "resource", "=", "instance", "try", ":", "new_configuration", "=", "CostTrackingRegister", ".", "get_configuration", "(", "resource", ")"...
d6c17a9592bb6c49c33567542eef8d099605a46a
train
resource_quota_update
Update resource consumption details and price estimate if its configuration has changed
waldur_core/cost_tracking/handlers.py
def resource_quota_update(sender, instance, **kwargs): """ Update resource consumption details and price estimate if its configuration has changed """ quota = instance resource = quota.scope try: new_configuration = CostTrackingRegister.get_configuration(resource) except ResourceNotRegistere...
def resource_quota_update(sender, instance, **kwargs): """ Update resource consumption details and price estimate if its configuration has changed """ quota = instance resource = quota.scope try: new_configuration = CostTrackingRegister.get_configuration(resource) except ResourceNotRegistere...
[ "Update", "resource", "consumption", "details", "and", "price", "estimate", "if", "its", "configuration", "has", "changed" ]
opennode/waldur-core
python
https://github.com/opennode/waldur-core/blob/d6c17a9592bb6c49c33567542eef8d099605a46a/waldur_core/cost_tracking/handlers.py#L82-L91
[ "def", "resource_quota_update", "(", "sender", ",", "instance", ",", "*", "*", "kwargs", ")", ":", "quota", "=", "instance", "resource", "=", "quota", ".", "scope", "try", ":", "new_configuration", "=", "CostTrackingRegister", ".", "get_configuration", "(", "r...
d6c17a9592bb6c49c33567542eef8d099605a46a
train
_create_historical_estimates
Create consumption details and price estimates for past months. Usually we need to update historical values on resource import.
waldur_core/cost_tracking/handlers.py
def _create_historical_estimates(resource, configuration): """ Create consumption details and price estimates for past months. Usually we need to update historical values on resource import. """ today = timezone.now() month_start = core_utils.month_start(today) while month_start > resource....
def _create_historical_estimates(resource, configuration): """ Create consumption details and price estimates for past months. Usually we need to update historical values on resource import. """ today = timezone.now() month_start = core_utils.month_start(today) while month_start > resource....
[ "Create", "consumption", "details", "and", "price", "estimates", "for", "past", "months", "." ]
opennode/waldur-core
python
https://github.com/opennode/waldur-core/blob/d6c17a9592bb6c49c33567542eef8d099605a46a/waldur_core/cost_tracking/handlers.py#L94-L103
[ "def", "_create_historical_estimates", "(", "resource", ",", "configuration", ")", ":", "today", "=", "timezone", ".", "now", "(", ")", "month_start", "=", "core_utils", ".", "month_start", "(", "today", ")", "while", "month_start", ">", "resource", ".", "crea...
d6c17a9592bb6c49c33567542eef8d099605a46a
train
IPYTHON_MAIN
Decide if the Ipython command line is running code.
src/importnb/ipython_extension.py
def IPYTHON_MAIN(): """Decide if the Ipython command line is running code.""" import pkg_resources runner_frame = inspect.getouterframes(inspect.currentframe())[-2] return ( getattr(runner_frame, "function", None) == pkg_resources.load_entry_point("ipython", "console_scripts", "ipython"...
def IPYTHON_MAIN(): """Decide if the Ipython command line is running code.""" import pkg_resources runner_frame = inspect.getouterframes(inspect.currentframe())[-2] return ( getattr(runner_frame, "function", None) == pkg_resources.load_entry_point("ipython", "console_scripts", "ipython"...
[ "Decide", "if", "the", "Ipython", "command", "line", "is", "running", "code", "." ]
deathbeds/importnb
python
https://github.com/deathbeds/importnb/blob/ec870d1f8ab99fd5b363267f89787a3e442a779f/src/importnb/ipython_extension.py#L85-L93
[ "def", "IPYTHON_MAIN", "(", ")", ":", "import", "pkg_resources", "runner_frame", "=", "inspect", ".", "getouterframes", "(", "inspect", ".", "currentframe", "(", ")", ")", "[", "-", "2", "]", "return", "(", "getattr", "(", "runner_frame", ",", "\"function\""...
ec870d1f8ab99fd5b363267f89787a3e442a779f
train
NURESTModelController.register_model
Register a model class according to its remote name Args: model: the model to register
bambou/nurest_modelcontroller.py
def register_model(cls, model): """ Register a model class according to its remote name Args: model: the model to register """ rest_name = model.rest_name resource_name = model.resource_name if rest_name not in cls._model_rest_name_regis...
def register_model(cls, model): """ Register a model class according to its remote name Args: model: the model to register """ rest_name = model.rest_name resource_name = model.resource_name if rest_name not in cls._model_rest_name_regis...
[ "Register", "a", "model", "class", "according", "to", "its", "remote", "name" ]
nuagenetworks/bambou
python
https://github.com/nuagenetworks/bambou/blob/d334fea23e384d3df8e552fe1849ad707941c666/bambou/nurest_modelcontroller.py#L37-L54
[ "def", "register_model", "(", "cls", ",", "model", ")", ":", "rest_name", "=", "model", ".", "rest_name", "resource_name", "=", "model", ".", "resource_name", "if", "rest_name", "not", "in", "cls", ".", "_model_rest_name_registry", ":", "cls", ".", "_model_res...
d334fea23e384d3df8e552fe1849ad707941c666
train
NURESTModelController.get_first_model_with_rest_name
Get the first model corresponding to a rest_name Args: rest_name: the rest name
bambou/nurest_modelcontroller.py
def get_first_model_with_rest_name(cls, rest_name): """ Get the first model corresponding to a rest_name Args: rest_name: the rest name """ models = cls.get_models_with_rest_name(rest_name) if len(models) > 0: return models[0] return No...
def get_first_model_with_rest_name(cls, rest_name): """ Get the first model corresponding to a rest_name Args: rest_name: the rest name """ models = cls.get_models_with_rest_name(rest_name) if len(models) > 0: return models[0] return No...
[ "Get", "the", "first", "model", "corresponding", "to", "a", "rest_name" ]
nuagenetworks/bambou
python
https://github.com/nuagenetworks/bambou/blob/d334fea23e384d3df8e552fe1849ad707941c666/bambou/nurest_modelcontroller.py#L87-L99
[ "def", "get_first_model_with_rest_name", "(", "cls", ",", "rest_name", ")", ":", "models", "=", "cls", ".", "get_models_with_rest_name", "(", "rest_name", ")", "if", "len", "(", "models", ")", ">", "0", ":", "return", "models", "[", "0", "]", "return", "No...
d334fea23e384d3df8e552fe1849ad707941c666
train
NURESTModelController.get_first_model_with_resource_name
Get the first model corresponding to a resource_name Args: resource_name: the resource name
bambou/nurest_modelcontroller.py
def get_first_model_with_resource_name(cls, resource_name): """ Get the first model corresponding to a resource_name Args: resource_name: the resource name """ models = cls.get_models_with_resource_name(resource_name) if len(models) > 0: return ...
def get_first_model_with_resource_name(cls, resource_name): """ Get the first model corresponding to a resource_name Args: resource_name: the resource name """ models = cls.get_models_with_resource_name(resource_name) if len(models) > 0: return ...
[ "Get", "the", "first", "model", "corresponding", "to", "a", "resource_name" ]
nuagenetworks/bambou
python
https://github.com/nuagenetworks/bambou/blob/d334fea23e384d3df8e552fe1849ad707941c666/bambou/nurest_modelcontroller.py#L121-L133
[ "def", "get_first_model_with_resource_name", "(", "cls", ",", "resource_name", ")", ":", "models", "=", "cls", ".", "get_models_with_resource_name", "(", "resource_name", ")", "if", "len", "(", "models", ")", ">", "0", ":", "return", "models", "[", "0", "]", ...
d334fea23e384d3df8e552fe1849ad707941c666
train
SqliteThread.run
执行任务
aiosqlite3/sqlite_thread.py
def run(self): """ 执行任务 """ while not self._stoped: self._tx_event.wait() self._tx_event.clear() try: func = self._tx_queue.get_nowait() if isinstance(func, str): self._stoped = True ...
def run(self): """ 执行任务 """ while not self._stoped: self._tx_event.wait() self._tx_event.clear() try: func = self._tx_queue.get_nowait() if isinstance(func, str): self._stoped = True ...
[ "执行任务" ]
zeromake/aiosqlite3
python
https://github.com/zeromake/aiosqlite3/blob/1a74a062507e2df8f833a70885e69dca0ab3e7e7/aiosqlite3/sqlite_thread.py#L22-L47
[ "def", "run", "(", "self", ")", ":", "while", "not", "self", ".", "_stoped", ":", "self", ".", "_tx_event", ".", "wait", "(", ")", "self", ".", "_tx_event", ".", "clear", "(", ")", "try", ":", "func", "=", "self", ".", "_tx_queue", ".", "get_nowait...
1a74a062507e2df8f833a70885e69dca0ab3e7e7
train
SkDataWidget.build_layout
:param dset_id: :return:
skdata/widgets.py
def build_layout(self, dset_id: str): """ :param dset_id: :return: """ all_fields = list(self.get_data(dset_id=dset_id).keys()) try: field_reference = self.skd[dset_id].attrs('target') except: field_reference = all_fields[0] field...
def build_layout(self, dset_id: str): """ :param dset_id: :return: """ all_fields = list(self.get_data(dset_id=dset_id).keys()) try: field_reference = self.skd[dset_id].attrs('target') except: field_reference = all_fields[0] field...
[ ":", "param", "dset_id", ":", ":", "return", ":" ]
OpenDataScienceLab/skdata
python
https://github.com/OpenDataScienceLab/skdata/blob/34f06845a944ff4f048b55c7babdd8420f71a6b9/skdata/widgets.py#L108-L249
[ "def", "build_layout", "(", "self", ",", "dset_id", ":", "str", ")", ":", "all_fields", "=", "list", "(", "self", ".", "get_data", "(", "dset_id", "=", "dset_id", ")", ".", "keys", "(", ")", ")", "try", ":", "field_reference", "=", "self", ".", "skd"...
34f06845a944ff4f048b55c7babdd8420f71a6b9
train
SkDataWidget.display
:param dset_id: :return:
skdata/widgets.py
def display(self, dset_id: str): """ :param dset_id: :return: """ # update result self.skd[dset_id].compute() # build layout self.build_layout(dset_id=dset_id) # display widgets display(self._('dashboard')) # display data table and...
def display(self, dset_id: str): """ :param dset_id: :return: """ # update result self.skd[dset_id].compute() # build layout self.build_layout(dset_id=dset_id) # display widgets display(self._('dashboard')) # display data table and...
[ ":", "param", "dset_id", ":", ":", "return", ":" ]
OpenDataScienceLab/skdata
python
https://github.com/OpenDataScienceLab/skdata/blob/34f06845a944ff4f048b55c7babdd8420f71a6b9/skdata/widgets.py#L251-L264
[ "def", "display", "(", "self", ",", "dset_id", ":", "str", ")", ":", "# update result", "self", ".", "skd", "[", "dset_id", "]", ".", "compute", "(", ")", "# build layout", "self", ".", "build_layout", "(", "dset_id", "=", "dset_id", ")", "# display widget...
34f06845a944ff4f048b55c7babdd8420f71a6b9
train
FuzzyFinder.find_spec
Try to finder the spec and if it cannot be found, use the underscore starring syntax to identify potential matches.
src/importnb/finder.py
def find_spec(self, fullname, target=None): """Try to finder the spec and if it cannot be found, use the underscore starring syntax to identify potential matches. """ spec = super().find_spec(fullname, target=target) if spec is None: original = fullname ...
def find_spec(self, fullname, target=None): """Try to finder the spec and if it cannot be found, use the underscore starring syntax to identify potential matches. """ spec = super().find_spec(fullname, target=target) if spec is None: original = fullname ...
[ "Try", "to", "finder", "the", "spec", "and", "if", "it", "cannot", "be", "found", "use", "the", "underscore", "starring", "syntax", "to", "identify", "potential", "matches", "." ]
deathbeds/importnb
python
https://github.com/deathbeds/importnb/blob/ec870d1f8ab99fd5b363267f89787a3e442a779f/src/importnb/finder.py#L58-L89
[ "def", "find_spec", "(", "self", ",", "fullname", ",", "target", "=", "None", ")", ":", "spec", "=", "super", "(", ")", ".", "find_spec", "(", "fullname", ",", "target", "=", "target", ")", "if", "spec", "is", "None", ":", "original", "=", "fullname"...
ec870d1f8ab99fd5b363267f89787a3e442a779f
train
NURESTRootObject.get_resource_url
Get resource complete url
bambou/nurest_root_object.py
def get_resource_url(self): """ Get resource complete url """ name = self.__class__.resource_name url = self.__class__.rest_base_url() return "%s/%s" % (url, name)
def get_resource_url(self): """ Get resource complete url """ name = self.__class__.resource_name url = self.__class__.rest_base_url() return "%s/%s" % (url, name)
[ "Get", "resource", "complete", "url" ]
nuagenetworks/bambou
python
https://github.com/nuagenetworks/bambou/blob/d334fea23e384d3df8e552fe1849ad707941c666/bambou/nurest_root_object.py#L118-L124
[ "def", "get_resource_url", "(", "self", ")", ":", "name", "=", "self", ".", "__class__", ".", "resource_name", "url", "=", "self", ".", "__class__", ".", "rest_base_url", "(", ")", "return", "\"%s/%s\"", "%", "(", "url", ",", "name", ")" ]
d334fea23e384d3df8e552fe1849ad707941c666
train
NURESTRootObject.save
Updates the user and perform the callback method
bambou/nurest_root_object.py
def save(self, async=False, callback=None, encrypted=True): """ Updates the user and perform the callback method """ if self._new_password and encrypted: self.password = Sha1.encrypt(self._new_password) controller = NURESTSession.get_current_session().login_controller contr...
def save(self, async=False, callback=None, encrypted=True): """ Updates the user and perform the callback method """ if self._new_password and encrypted: self.password = Sha1.encrypt(self._new_password) controller = NURESTSession.get_current_session().login_controller contr...
[ "Updates", "the", "user", "and", "perform", "the", "callback", "method" ]
nuagenetworks/bambou
python
https://github.com/nuagenetworks/bambou/blob/d334fea23e384d3df8e552fe1849ad707941c666/bambou/nurest_root_object.py#L131-L148
[ "def", "save", "(", "self", ",", "async", "=", "False", ",", "callback", "=", "None", ",", "encrypted", "=", "True", ")", ":", "if", "self", ".", "_new_password", "and", "encrypted", ":", "self", ".", "password", "=", "Sha1", ".", "encrypt", "(", "se...
d334fea23e384d3df8e552fe1849ad707941c666
train
NURESTRootObject._did_save
Launched when save has been successfully executed
bambou/nurest_root_object.py
def _did_save(self, connection): """ Launched when save has been successfully executed """ self._new_password = None controller = NURESTSession.get_current_session().login_controller controller.password = None controller.api_key = self.api_key if connection.async: ...
def _did_save(self, connection): """ Launched when save has been successfully executed """ self._new_password = None controller = NURESTSession.get_current_session().login_controller controller.password = None controller.api_key = self.api_key if connection.async: ...
[ "Launched", "when", "save", "has", "been", "successfully", "executed" ]
nuagenetworks/bambou
python
https://github.com/nuagenetworks/bambou/blob/d334fea23e384d3df8e552fe1849ad707941c666/bambou/nurest_root_object.py#L150-L167
[ "def", "_did_save", "(", "self", ",", "connection", ")", ":", "self", ".", "_new_password", "=", "None", "controller", "=", "NURESTSession", ".", "get_current_session", "(", ")", ".", "login_controller", "controller", ".", "password", "=", "None", "controller", ...
d334fea23e384d3df8e552fe1849ad707941c666
train
NURESTRootObject.fetch
Fetch all information about the current object Args: async (bool): Boolean to make an asynchronous call. Default is False callback (function): Callback method that will be triggered in case of asynchronous call Returns: tuple: (current_fetcher, c...
bambou/nurest_root_object.py
def fetch(self, async=False, callback=None): """ Fetch all information about the current object Args: async (bool): Boolean to make an asynchronous call. Default is False callback (function): Callback method that will be triggered in case of asynchronous call ...
def fetch(self, async=False, callback=None): """ Fetch all information about the current object Args: async (bool): Boolean to make an asynchronous call. Default is False callback (function): Callback method that will be triggered in case of asynchronous call ...
[ "Fetch", "all", "information", "about", "the", "current", "object" ]
nuagenetworks/bambou
python
https://github.com/nuagenetworks/bambou/blob/d334fea23e384d3df8e552fe1849ad707941c666/bambou/nurest_root_object.py#L169-L191
[ "def", "fetch", "(", "self", ",", "async", "=", "False", ",", "callback", "=", "None", ")", ":", "request", "=", "NURESTRequest", "(", "method", "=", "HTTP_METHOD_GET", ",", "url", "=", "self", ".", "get_resource_url", "(", ")", ")", "if", "async", ":"...
d334fea23e384d3df8e552fe1849ad707941c666
train
_fabtabular
This function retrieves the ISO 639 and inverted names datasets as tsv files and returns them as lists.
iso639/iso639.py
def _fabtabular(): """ This function retrieves the ISO 639 and inverted names datasets as tsv files and returns them as lists. """ import csv import sys from pkg_resources import resource_filename data = resource_filename(__package__, 'iso-639-3.tab') inverted = resource_filename(__pack...
def _fabtabular(): """ This function retrieves the ISO 639 and inverted names datasets as tsv files and returns them as lists. """ import csv import sys from pkg_resources import resource_filename data = resource_filename(__package__, 'iso-639-3.tab') inverted = resource_filename(__pack...
[ "This", "function", "retrieves", "the", "ISO", "639", "and", "inverted", "names", "datasets", "as", "tsv", "files", "and", "returns", "them", "as", "lists", "." ]
noumar/iso639
python
https://github.com/noumar/iso639/blob/2175cf04b8b8cec79d99a6c4ad31295d67c22cd6/iso639/iso639.py#L14-L63
[ "def", "_fabtabular", "(", ")", ":", "import", "csv", "import", "sys", "from", "pkg_resources", "import", "resource_filename", "data", "=", "resource_filename", "(", "__package__", ",", "'iso-639-3.tab'", ")", "inverted", "=", "resource_filename", "(", "__package__"...
2175cf04b8b8cec79d99a6c4ad31295d67c22cd6
train
Iso639.retired
Function for generating retired languages. Returns a dict('code', (datetime, [language, ...], 'description')).
iso639/iso639.py
def retired(self): """ Function for generating retired languages. Returns a dict('code', (datetime, [language, ...], 'description')). """ def gen(): import csv import re from datetime import datetime from pkg_resources import resource_file...
def retired(self): """ Function for generating retired languages. Returns a dict('code', (datetime, [language, ...], 'description')). """ def gen(): import csv import re from datetime import datetime from pkg_resources import resource_file...
[ "Function", "for", "generating", "retired", "languages", ".", "Returns", "a", "dict", "(", "code", "(", "datetime", "[", "language", "...", "]", "description", "))", "." ]
noumar/iso639
python
https://github.com/noumar/iso639/blob/2175cf04b8b8cec79d99a6c4ad31295d67c22cd6/iso639/iso639.py#L230-L256
[ "def", "retired", "(", "self", ")", ":", "def", "gen", "(", ")", ":", "import", "csv", "import", "re", "from", "datetime", "import", "datetime", "from", "pkg_resources", "import", "resource_filename", "with", "open", "(", "resource_filename", "(", "__package__...
2175cf04b8b8cec79d99a6c4ad31295d67c22cd6
train
Iso639.get
Simple getter function for languages. Takes 1 keyword/value and returns 1 language object.
iso639/iso639.py
def get(self, **kwargs): """ Simple getter function for languages. Takes 1 keyword/value and returns 1 language object. """ if not len(kwargs) == 1: raise AttributeError('Only one keyword expected') key, value = kwargs.popitem() return getattr(self, key)[value...
def get(self, **kwargs): """ Simple getter function for languages. Takes 1 keyword/value and returns 1 language object. """ if not len(kwargs) == 1: raise AttributeError('Only one keyword expected') key, value = kwargs.popitem() return getattr(self, key)[value...
[ "Simple", "getter", "function", "for", "languages", ".", "Takes", "1", "keyword", "/", "value", "and", "returns", "1", "language", "object", "." ]
noumar/iso639
python
https://github.com/noumar/iso639/blob/2175cf04b8b8cec79d99a6c4ad31295d67c22cd6/iso639/iso639.py#L258-L265
[ "def", "get", "(", "self", ",", "*", "*", "kwargs", ")", ":", "if", "not", "len", "(", "kwargs", ")", "==", "1", ":", "raise", "AttributeError", "(", "'Only one keyword expected'", ")", "key", ",", "value", "=", "kwargs", ".", "popitem", "(", ")", "r...
2175cf04b8b8cec79d99a6c4ad31295d67c22cd6
train
CustomerViewSet.list
To get a list of customers, run GET against */api/customers/* as authenticated user. Note that a user can only see connected customers: - customers that the user owns - customers that have a project where user has a role Staff also can filter customers by user UUID, for example /api/cu...
waldur_core/structure/views.py
def list(self, request, *args, **kwargs): """ To get a list of customers, run GET against */api/customers/* as authenticated user. Note that a user can only see connected customers: - customers that the user owns - customers that have a project where user has a role Sta...
def list(self, request, *args, **kwargs): """ To get a list of customers, run GET against */api/customers/* as authenticated user. Note that a user can only see connected customers: - customers that the user owns - customers that have a project where user has a role Sta...
[ "To", "get", "a", "list", "of", "customers", "run", "GET", "against", "*", "/", "api", "/", "customers", "/", "*", "as", "authenticated", "user", ".", "Note", "that", "a", "user", "can", "only", "see", "connected", "customers", ":" ]
opennode/waldur-core
python
https://github.com/opennode/waldur-core/blob/d6c17a9592bb6c49c33567542eef8d099605a46a/waldur_core/structure/views.py#L71-L92
[ "def", "list", "(", "self", ",", "request", ",", "*", "args", ",", "*", "*", "kwargs", ")", ":", "return", "super", "(", "CustomerViewSet", ",", "self", ")", ".", "list", "(", "request", ",", "*", "args", ",", "*", "*", "kwargs", ")" ]
d6c17a9592bb6c49c33567542eef8d099605a46a
train
CustomerViewSet.retrieve
Optional `field` query parameter (can be list) allows to limit what fields are returned. For example, given request /api/customers/<uuid>/?field=uuid&field=name you get response like this: .. code-block:: javascript { "uuid": "90bcfe38b0124c9bbdadd617b5d739f5", ...
waldur_core/structure/views.py
def retrieve(self, request, *args, **kwargs): """ Optional `field` query parameter (can be list) allows to limit what fields are returned. For example, given request /api/customers/<uuid>/?field=uuid&field=name you get response like this: .. code-block:: javascript { ...
def retrieve(self, request, *args, **kwargs): """ Optional `field` query parameter (can be list) allows to limit what fields are returned. For example, given request /api/customers/<uuid>/?field=uuid&field=name you get response like this: .. code-block:: javascript { ...
[ "Optional", "field", "query", "parameter", "(", "can", "be", "list", ")", "allows", "to", "limit", "what", "fields", "are", "returned", ".", "For", "example", "given", "request", "/", "api", "/", "customers", "/", "<uuid", ">", "/", "?field", "=", "uuid&...
opennode/waldur-core
python
https://github.com/opennode/waldur-core/blob/d6c17a9592bb6c49c33567542eef8d099605a46a/waldur_core/structure/views.py#L94-L106
[ "def", "retrieve", "(", "self", ",", "request", ",", "*", "args", ",", "*", "*", "kwargs", ")", ":", "return", "super", "(", "CustomerViewSet", ",", "self", ")", ".", "retrieve", "(", "request", ",", "*", "args", ",", "*", "*", "kwargs", ")" ]
d6c17a9592bb6c49c33567542eef8d099605a46a
train
CustomerViewSet.create
A new customer can only be created: - by users with staff privilege (is_staff=True); - by organization owners if OWNER_CAN_MANAGE_CUSTOMER is set to True; Example of a valid request: .. code-block:: http POST /api/customers/ HTTP/1.1 Content-Type: applicatio...
waldur_core/structure/views.py
def create(self, request, *args, **kwargs): """ A new customer can only be created: - by users with staff privilege (is_staff=True); - by organization owners if OWNER_CAN_MANAGE_CUSTOMER is set to True; Example of a valid request: .. code-block:: http PO...
def create(self, request, *args, **kwargs): """ A new customer can only be created: - by users with staff privilege (is_staff=True); - by organization owners if OWNER_CAN_MANAGE_CUSTOMER is set to True; Example of a valid request: .. code-block:: http PO...
[ "A", "new", "customer", "can", "only", "be", "created", ":" ]
opennode/waldur-core
python
https://github.com/opennode/waldur-core/blob/d6c17a9592bb6c49c33567542eef8d099605a46a/waldur_core/structure/views.py#L108-L132
[ "def", "create", "(", "self", ",", "request", ",", "*", "args", ",", "*", "*", "kwargs", ")", ":", "return", "super", "(", "CustomerViewSet", ",", "self", ")", ".", "create", "(", "request", ",", "*", "args", ",", "*", "*", "kwargs", ")" ]
d6c17a9592bb6c49c33567542eef8d099605a46a
train
CustomerViewSet.destroy
Deletion of a customer is done through sending a **DELETE** request to the customer instance URI. Please note, that if a customer has connected projects, deletion request will fail with 409 response code. Valid request example (token is user specific): .. code-block:: http DELETE ...
waldur_core/structure/views.py
def destroy(self, request, *args, **kwargs): """ Deletion of a customer is done through sending a **DELETE** request to the customer instance URI. Please note, that if a customer has connected projects, deletion request will fail with 409 response code. Valid request example (token is u...
def destroy(self, request, *args, **kwargs): """ Deletion of a customer is done through sending a **DELETE** request to the customer instance URI. Please note, that if a customer has connected projects, deletion request will fail with 409 response code. Valid request example (token is u...
[ "Deletion", "of", "a", "customer", "is", "done", "through", "sending", "a", "**", "DELETE", "**", "request", "to", "the", "customer", "instance", "URI", ".", "Please", "note", "that", "if", "a", "customer", "has", "connected", "projects", "deletion", "reques...
opennode/waldur-core
python
https://github.com/opennode/waldur-core/blob/d6c17a9592bb6c49c33567542eef8d099605a46a/waldur_core/structure/views.py#L134-L147
[ "def", "destroy", "(", "self", ",", "request", ",", "*", "args", ",", "*", "*", "kwargs", ")", ":", "return", "super", "(", "CustomerViewSet", ",", "self", ")", ".", "destroy", "(", "request", ",", "*", "args", ",", "*", "*", "kwargs", ")" ]
d6c17a9592bb6c49c33567542eef8d099605a46a
train
ProjectViewSet.list
To get a list of projects, run **GET** against */api/projects/* as authenticated user. Here you can also check actual value for project quotas and project usage Note that a user can only see connected projects: - projects that the user owns as a customer - projects where user has any r...
waldur_core/structure/views.py
def list(self, request, *args, **kwargs): """ To get a list of projects, run **GET** against */api/projects/* as authenticated user. Here you can also check actual value for project quotas and project usage Note that a user can only see connected projects: - projects that the u...
def list(self, request, *args, **kwargs): """ To get a list of projects, run **GET** against */api/projects/* as authenticated user. Here you can also check actual value for project quotas and project usage Note that a user can only see connected projects: - projects that the u...
[ "To", "get", "a", "list", "of", "projects", "run", "**", "GET", "**", "against", "*", "/", "api", "/", "projects", "/", "*", "as", "authenticated", "user", ".", "Here", "you", "can", "also", "check", "actual", "value", "for", "project", "quotas", "and"...
opennode/waldur-core
python
https://github.com/opennode/waldur-core/blob/d6c17a9592bb6c49c33567542eef8d099605a46a/waldur_core/structure/views.py#L260-L275
[ "def", "list", "(", "self", ",", "request", ",", "*", "args", ",", "*", "*", "kwargs", ")", ":", "return", "super", "(", "ProjectViewSet", ",", "self", ")", ".", "list", "(", "request", ",", "*", "args", ",", "*", "*", "kwargs", ")" ]
d6c17a9592bb6c49c33567542eef8d099605a46a
train
ProjectViewSet.retrieve
Optional `field` query parameter (can be list) allows to limit what fields are returned. For example, given request /api/projects/<uuid>/?field=uuid&field=name you get response like this: .. code-block:: javascript { "uuid": "90bcfe38b0124c9bbdadd617b5d739f5", ...
waldur_core/structure/views.py
def retrieve(self, request, *args, **kwargs): """ Optional `field` query parameter (can be list) allows to limit what fields are returned. For example, given request /api/projects/<uuid>/?field=uuid&field=name you get response like this: .. code-block:: javascript { ...
def retrieve(self, request, *args, **kwargs): """ Optional `field` query parameter (can be list) allows to limit what fields are returned. For example, given request /api/projects/<uuid>/?field=uuid&field=name you get response like this: .. code-block:: javascript { ...
[ "Optional", "field", "query", "parameter", "(", "can", "be", "list", ")", "allows", "to", "limit", "what", "fields", "are", "returned", ".", "For", "example", "given", "request", "/", "api", "/", "projects", "/", "<uuid", ">", "/", "?field", "=", "uuid&f...
opennode/waldur-core
python
https://github.com/opennode/waldur-core/blob/d6c17a9592bb6c49c33567542eef8d099605a46a/waldur_core/structure/views.py#L277-L289
[ "def", "retrieve", "(", "self", ",", "request", ",", "*", "args", ",", "*", "*", "kwargs", ")", ":", "return", "super", "(", "ProjectViewSet", ",", "self", ")", ".", "retrieve", "(", "request", ",", "*", "args", ",", "*", "*", "kwargs", ")" ]
d6c17a9592bb6c49c33567542eef8d099605a46a
train
ProjectViewSet.create
A new project can be created by users with staff privilege (is_staff=True) or customer owners. Project resource quota is optional. Example of a valid request: .. code-block:: http POST /api/projects/ HTTP/1.1 Content-Type: application/json Accept: application/json ...
waldur_core/structure/views.py
def create(self, request, *args, **kwargs): """ A new project can be created by users with staff privilege (is_staff=True) or customer owners. Project resource quota is optional. Example of a valid request: .. code-block:: http POST /api/projects/ HTTP/1.1 Conte...
def create(self, request, *args, **kwargs): """ A new project can be created by users with staff privilege (is_staff=True) or customer owners. Project resource quota is optional. Example of a valid request: .. code-block:: http POST /api/projects/ HTTP/1.1 Conte...
[ "A", "new", "project", "can", "be", "created", "by", "users", "with", "staff", "privilege", "(", "is_staff", "=", "True", ")", "or", "customer", "owners", ".", "Project", "resource", "quota", "is", "optional", ".", "Example", "of", "a", "valid", "request",...
opennode/waldur-core
python
https://github.com/opennode/waldur-core/blob/d6c17a9592bb6c49c33567542eef8d099605a46a/waldur_core/structure/views.py#L291-L309
[ "def", "create", "(", "self", ",", "request", ",", "*", "args", ",", "*", "*", "kwargs", ")", ":", "return", "super", "(", "ProjectViewSet", ",", "self", ")", ".", "create", "(", "request", ",", "*", "args", ",", "*", "*", "kwargs", ")" ]
d6c17a9592bb6c49c33567542eef8d099605a46a
train
ProjectViewSet.destroy
Deletion of a project is done through sending a **DELETE** request to the project instance URI. Please note, that if a project has connected instances, deletion request will fail with 409 response code. Valid request example (token is user specific): .. code-block:: http DELETE /a...
waldur_core/structure/views.py
def destroy(self, request, *args, **kwargs): """ Deletion of a project is done through sending a **DELETE** request to the project instance URI. Please note, that if a project has connected instances, deletion request will fail with 409 response code. Valid request example (token is use...
def destroy(self, request, *args, **kwargs): """ Deletion of a project is done through sending a **DELETE** request to the project instance URI. Please note, that if a project has connected instances, deletion request will fail with 409 response code. Valid request example (token is use...
[ "Deletion", "of", "a", "project", "is", "done", "through", "sending", "a", "**", "DELETE", "**", "request", "to", "the", "project", "instance", "URI", ".", "Please", "note", "that", "if", "a", "project", "has", "connected", "instances", "deletion", "request"...
opennode/waldur-core
python
https://github.com/opennode/waldur-core/blob/d6c17a9592bb6c49c33567542eef8d099605a46a/waldur_core/structure/views.py#L311-L324
[ "def", "destroy", "(", "self", ",", "request", ",", "*", "args", ",", "*", "*", "kwargs", ")", ":", "return", "super", "(", "ProjectViewSet", ",", "self", ")", ".", "destroy", "(", "request", ",", "*", "args", ",", "*", "*", "kwargs", ")" ]
d6c17a9592bb6c49c33567542eef8d099605a46a
train
ProjectViewSet.users
A list of users connected to the project
waldur_core/structure/views.py
def users(self, request, uuid=None): """ A list of users connected to the project """ project = self.get_object() queryset = project.get_users() # we need to handle filtration manually because we want to filter only project users, not projects. filter_backend = filters.UserConcat...
def users(self, request, uuid=None): """ A list of users connected to the project """ project = self.get_object() queryset = project.get_users() # we need to handle filtration manually because we want to filter only project users, not projects. filter_backend = filters.UserConcat...
[ "A", "list", "of", "users", "connected", "to", "the", "project" ]
opennode/waldur-core
python
https://github.com/opennode/waldur-core/blob/d6c17a9592bb6c49c33567542eef8d099605a46a/waldur_core/structure/views.py#L374-L383
[ "def", "users", "(", "self", ",", "request", ",", "uuid", "=", "None", ")", ":", "project", "=", "self", ".", "get_object", "(", ")", "queryset", "=", "project", ".", "get_users", "(", ")", "# we need to handle filtration manually because we want to filter only pr...
d6c17a9592bb6c49c33567542eef8d099605a46a
train
UserViewSet.list
User list is available to all authenticated users. To get a list, issue authenticated **GET** request against */api/users/*. User list supports several filters. All filters are set in HTTP query section. Field filters are listed below. All of the filters apart from ?organization are usi...
waldur_core/structure/views.py
def list(self, request, *args, **kwargs): """ User list is available to all authenticated users. To get a list, issue authenticated **GET** request against */api/users/*. User list supports several filters. All filters are set in HTTP query section. Field filters are listed belo...
def list(self, request, *args, **kwargs): """ User list is available to all authenticated users. To get a list, issue authenticated **GET** request against */api/users/*. User list supports several filters. All filters are set in HTTP query section. Field filters are listed belo...
[ "User", "list", "is", "available", "to", "all", "authenticated", "users", ".", "To", "get", "a", "list", "issue", "authenticated", "**", "GET", "**", "request", "against", "*", "/", "api", "/", "users", "/", "*", "." ]
opennode/waldur-core
python
https://github.com/opennode/waldur-core/blob/d6c17a9592bb6c49c33567542eef8d099605a46a/waldur_core/structure/views.py#L417-L459
[ "def", "list", "(", "self", ",", "request", ",", "*", "args", ",", "*", "*", "kwargs", ")", ":", "return", "super", "(", "UserViewSet", ",", "self", ")", ".", "list", "(", "request", ",", "*", "args", ",", "*", "*", "kwargs", ")" ]
d6c17a9592bb6c49c33567542eef8d099605a46a
train
UserViewSet.retrieve
User fields can be updated by account owner or user with staff privilege (is_staff=True). Following user fields can be updated: - organization (deprecated, use `organization plugin <http://waldur_core-organization.readthedocs.org/en/stable/>`_ instead) - full_name - native_nam...
waldur_core/structure/views.py
def retrieve(self, request, *args, **kwargs): """ User fields can be updated by account owner or user with staff privilege (is_staff=True). Following user fields can be updated: - organization (deprecated, use `organization plugin <http://waldur_core-organization.readthedocs.o...
def retrieve(self, request, *args, **kwargs): """ User fields can be updated by account owner or user with staff privilege (is_staff=True). Following user fields can be updated: - organization (deprecated, use `organization plugin <http://waldur_core-organization.readthedocs.o...
[ "User", "fields", "can", "be", "updated", "by", "account", "owner", "or", "user", "with", "staff", "privilege", "(", "is_staff", "=", "True", ")", ".", "Following", "user", "fields", "can", "be", "updated", ":" ]
opennode/waldur-core
python
https://github.com/opennode/waldur-core/blob/d6c17a9592bb6c49c33567542eef8d099605a46a/waldur_core/structure/views.py#L461-L490
[ "def", "retrieve", "(", "self", ",", "request", ",", "*", "args", ",", "*", "*", "kwargs", ")", ":", "return", "super", "(", "UserViewSet", ",", "self", ")", ".", "retrieve", "(", "request", ",", "*", "args", ",", "*", "*", "kwargs", ")" ]
d6c17a9592bb6c49c33567542eef8d099605a46a
train
UserViewSet.password
To change a user password, submit a **POST** request to the user's RPC URL, specifying new password by staff user or account owner. Password is expected to be at least 7 symbols long and contain at least one number and at least one lower or upper case. Example of a valid request: ...
waldur_core/structure/views.py
def password(self, request, uuid=None): """ To change a user password, submit a **POST** request to the user's RPC URL, specifying new password by staff user or account owner. Password is expected to be at least 7 symbols long and contain at least one number and at least one low...
def password(self, request, uuid=None): """ To change a user password, submit a **POST** request to the user's RPC URL, specifying new password by staff user or account owner. Password is expected to be at least 7 symbols long and contain at least one number and at least one low...
[ "To", "change", "a", "user", "password", "submit", "a", "**", "POST", "**", "request", "to", "the", "user", "s", "RPC", "URL", "specifying", "new", "password", "by", "staff", "user", "or", "account", "owner", "." ]
opennode/waldur-core
python
https://github.com/opennode/waldur-core/blob/d6c17a9592bb6c49c33567542eef8d099605a46a/waldur_core/structure/views.py#L493-L525
[ "def", "password", "(", "self", ",", "request", ",", "uuid", "=", "None", ")", ":", "user", "=", "self", ".", "get_object", "(", ")", "serializer", "=", "serializers", ".", "PasswordSerializer", "(", "data", "=", "request", ".", "data", ")", "serializer"...
d6c17a9592bb6c49c33567542eef8d099605a46a
train
ProjectPermissionViewSet.list
Project permissions expresses connection of user to a project. User may have either project manager or system administrator permission in the project. Use */api/project-permissions/* endpoint to maintain project permissions. Note that project permissions can be viewed and modified only by custo...
waldur_core/structure/views.py
def list(self, request, *args, **kwargs): """ Project permissions expresses connection of user to a project. User may have either project manager or system administrator permission in the project. Use */api/project-permissions/* endpoint to maintain project permissions. Note tha...
def list(self, request, *args, **kwargs): """ Project permissions expresses connection of user to a project. User may have either project manager or system administrator permission in the project. Use */api/project-permissions/* endpoint to maintain project permissions. Note tha...
[ "Project", "permissions", "expresses", "connection", "of", "user", "to", "a", "project", ".", "User", "may", "have", "either", "project", "manager", "or", "system", "administrator", "permission", "in", "the", "project", ".", "Use", "*", "/", "api", "/", "pro...
opennode/waldur-core
python
https://github.com/opennode/waldur-core/blob/d6c17a9592bb6c49c33567542eef8d099605a46a/waldur_core/structure/views.py#L611-L638
[ "def", "list", "(", "self", ",", "request", ",", "*", "args", ",", "*", "*", "kwargs", ")", ":", "return", "super", "(", "ProjectPermissionViewSet", ",", "self", ")", ".", "list", "(", "request", ",", "*", "args", ",", "*", "*", "kwargs", ")" ]
d6c17a9592bb6c49c33567542eef8d099605a46a
train
ProjectPermissionViewSet.destroy
To remove a user from a project, delete corresponding connection (**url** field). Successful deletion will return status code 204. .. code-block:: http DELETE /api/project-permissions/42/ HTTP/1.1 Authorization: Token 95a688962bf68678fd4c8cec4d138ddd9493c93b Host: e...
waldur_core/structure/views.py
def destroy(self, request, *args, **kwargs): """ To remove a user from a project, delete corresponding connection (**url** field). Successful deletion will return status code 204. .. code-block:: http DELETE /api/project-permissions/42/ HTTP/1.1 Authorization: T...
def destroy(self, request, *args, **kwargs): """ To remove a user from a project, delete corresponding connection (**url** field). Successful deletion will return status code 204. .. code-block:: http DELETE /api/project-permissions/42/ HTTP/1.1 Authorization: T...
[ "To", "remove", "a", "user", "from", "a", "project", "delete", "corresponding", "connection", "(", "**", "url", "**", "field", ")", ".", "Successful", "deletion", "will", "return", "status", "code", "204", "." ]
opennode/waldur-core
python
https://github.com/opennode/waldur-core/blob/d6c17a9592bb6c49c33567542eef8d099605a46a/waldur_core/structure/views.py#L640-L651
[ "def", "destroy", "(", "self", ",", "request", ",", "*", "args", ",", "*", "*", "kwargs", ")", ":", "return", "super", "(", "ProjectPermissionViewSet", ",", "self", ")", ".", "destroy", "(", "request", ",", "*", "args", ",", "*", "*", "kwargs", ")" ]
d6c17a9592bb6c49c33567542eef8d099605a46a
train
CustomerPermissionViewSet.list
Each customer is associated with a group of users that represent customer owners. The link is maintained through **api/customer-permissions/** endpoint. To list all visible links, run a **GET** query against a list. Response will contain a list of customer owners and their brief data. ...
waldur_core/structure/views.py
def list(self, request, *args, **kwargs): """ Each customer is associated with a group of users that represent customer owners. The link is maintained through **api/customer-permissions/** endpoint. To list all visible links, run a **GET** query against a list. Response will con...
def list(self, request, *args, **kwargs): """ Each customer is associated with a group of users that represent customer owners. The link is maintained through **api/customer-permissions/** endpoint. To list all visible links, run a **GET** query against a list. Response will con...
[ "Each", "customer", "is", "associated", "with", "a", "group", "of", "users", "that", "represent", "customer", "owners", ".", "The", "link", "is", "maintained", "through", "**", "api", "/", "customer", "-", "permissions", "/", "**", "endpoint", "." ]
opennode/waldur-core
python
https://github.com/opennode/waldur-core/blob/d6c17a9592bb6c49c33567542eef8d099605a46a/waldur_core/structure/views.py#L689-L712
[ "def", "list", "(", "self", ",", "request", ",", "*", "args", ",", "*", "*", "kwargs", ")", ":", "return", "super", "(", "CustomerPermissionViewSet", ",", "self", ")", ".", "list", "(", "request", ",", "*", "args", ",", "*", "*", "kwargs", ")" ]
d6c17a9592bb6c49c33567542eef8d099605a46a
train
CustomerPermissionViewSet.retrieve
To remove a user from a customer owner group, delete corresponding connection (**url** field). Successful deletion will return status code 204. .. code-block:: http DELETE /api/customer-permissions/71/ HTTP/1.1 Authorization: Token 95a688962bf68678fd4c8cec4d138ddd9493c93b ...
waldur_core/structure/views.py
def retrieve(self, request, *args, **kwargs): """ To remove a user from a customer owner group, delete corresponding connection (**url** field). Successful deletion will return status code 204. .. code-block:: http DELETE /api/customer-permissions/71/ HTTP/1.1 A...
def retrieve(self, request, *args, **kwargs): """ To remove a user from a customer owner group, delete corresponding connection (**url** field). Successful deletion will return status code 204. .. code-block:: http DELETE /api/customer-permissions/71/ HTTP/1.1 A...
[ "To", "remove", "a", "user", "from", "a", "customer", "owner", "group", "delete", "corresponding", "connection", "(", "**", "url", "**", "field", ")", ".", "Successful", "deletion", "will", "return", "status", "code", "204", "." ]
opennode/waldur-core
python
https://github.com/opennode/waldur-core/blob/d6c17a9592bb6c49c33567542eef8d099605a46a/waldur_core/structure/views.py#L714-L725
[ "def", "retrieve", "(", "self", ",", "request", ",", "*", "args", ",", "*", "*", "kwargs", ")", ":", "return", "super", "(", "CustomerPermissionViewSet", ",", "self", ")", ".", "retrieve", "(", "request", ",", "*", "args", ",", "*", "*", "kwargs", ")...
d6c17a9592bb6c49c33567542eef8d099605a46a
train
CreationTimeStatsView.list
Available request parameters: - ?type=type_of_statistics_objects (required. Have to be from the list: 'customer', 'project') - ?from=timestamp (default: now - 30 days, for example: 1415910025) - ?to=timestamp (default: now, for example: 1415912625) - ?datapoints=how many data points hav...
waldur_core/structure/views.py
def list(self, request, *args, **kwargs): """ Available request parameters: - ?type=type_of_statistics_objects (required. Have to be from the list: 'customer', 'project') - ?from=timestamp (default: now - 30 days, for example: 1415910025) - ?to=timestamp (default: now, for examp...
def list(self, request, *args, **kwargs): """ Available request parameters: - ?type=type_of_statistics_objects (required. Have to be from the list: 'customer', 'project') - ?from=timestamp (default: now - 30 days, for example: 1415910025) - ?to=timestamp (default: now, for examp...
[ "Available", "request", "parameters", ":" ]
opennode/waldur-core
python
https://github.com/opennode/waldur-core/blob/d6c17a9592bb6c49c33567542eef8d099605a46a/waldur_core/structure/views.py#L757-L780
[ "def", "list", "(", "self", ",", "request", ",", "*", "args", ",", "*", "*", "kwargs", ")", ":", "return", "super", "(", "CreationTimeStatsView", ",", "self", ")", ".", "list", "(", "request", ",", "*", "args", ",", "*", "*", "kwargs", ")" ]
d6c17a9592bb6c49c33567542eef8d099605a46a
train
SshKeyViewSet.list
To get a list of SSH keys, run **GET** against */api/keys/* as authenticated user. A new SSH key can be created by any active users. Example of a valid request: .. code-block:: http POST /api/keys/ HTTP/1.1 Content-Type: application/json Accept: application/json ...
waldur_core/structure/views.py
def list(self, request, *args, **kwargs): """ To get a list of SSH keys, run **GET** against */api/keys/* as authenticated user. A new SSH key can be created by any active users. Example of a valid request: .. code-block:: http POST /api/keys/ HTTP/1.1 Content-...
def list(self, request, *args, **kwargs): """ To get a list of SSH keys, run **GET** against */api/keys/* as authenticated user. A new SSH key can be created by any active users. Example of a valid request: .. code-block:: http POST /api/keys/ HTTP/1.1 Content-...
[ "To", "get", "a", "list", "of", "SSH", "keys", "run", "**", "GET", "**", "against", "*", "/", "api", "/", "keys", "/", "*", "as", "authenticated", "user", "." ]
opennode/waldur-core
python
https://github.com/opennode/waldur-core/blob/d6c17a9592bb6c49c33567542eef8d099605a46a/waldur_core/structure/views.py#L816-L839
[ "def", "list", "(", "self", ",", "request", ",", "*", "args", ",", "*", "*", "kwargs", ")", ":", "return", "super", "(", "SshKeyViewSet", ",", "self", ")", ".", "list", "(", "request", ",", "*", "args", ",", "*", "*", "kwargs", ")" ]
d6c17a9592bb6c49c33567542eef8d099605a46a
train
ServiceSettingsViewSet.list
To get a list of service settings, run **GET** against */api/service-settings/* as an authenticated user. Only settings owned by this user or shared settings will be listed. Supported filters are: - ?name=<text> - partial matching used for searching - ?type=<type> - choices: OpenStack,...
waldur_core/structure/views.py
def list(self, request, *args, **kwargs): """ To get a list of service settings, run **GET** against */api/service-settings/* as an authenticated user. Only settings owned by this user or shared settings will be listed. Supported filters are: - ?name=<text> - partial matching u...
def list(self, request, *args, **kwargs): """ To get a list of service settings, run **GET** against */api/service-settings/* as an authenticated user. Only settings owned by this user or shared settings will be listed. Supported filters are: - ?name=<text> - partial matching u...
[ "To", "get", "a", "list", "of", "service", "settings", "run", "**", "GET", "**", "against", "*", "/", "api", "/", "service", "-", "settings", "/", "*", "as", "an", "authenticated", "user", ".", "Only", "settings", "owned", "by", "this", "user", "or", ...
opennode/waldur-core
python
https://github.com/opennode/waldur-core/blob/d6c17a9592bb6c49c33567542eef8d099605a46a/waldur_core/structure/views.py#L863-L875
[ "def", "list", "(", "self", ",", "request", ",", "*", "args", ",", "*", "*", "kwargs", ")", ":", "return", "super", "(", "ServiceSettingsViewSet", ",", "self", ")", ".", "list", "(", "request", ",", "*", "args", ",", "*", "*", "kwargs", ")" ]
d6c17a9592bb6c49c33567542eef8d099605a46a
train
ServiceSettingsViewSet.can_user_update_settings
Only staff can update shared settings, otherwise user has to be an owner of the settings.
waldur_core/structure/views.py
def can_user_update_settings(request, view, obj=None): """ Only staff can update shared settings, otherwise user has to be an owner of the settings.""" if obj is None: return # TODO [TM:3/21/17] clean it up after WAL-634. Clean up service settings update tests as well. if ob...
def can_user_update_settings(request, view, obj=None): """ Only staff can update shared settings, otherwise user has to be an owner of the settings.""" if obj is None: return # TODO [TM:3/21/17] clean it up after WAL-634. Clean up service settings update tests as well. if ob...
[ "Only", "staff", "can", "update", "shared", "settings", "otherwise", "user", "has", "to", "be", "an", "owner", "of", "the", "settings", "." ]
opennode/waldur-core
python
https://github.com/opennode/waldur-core/blob/d6c17a9592bb6c49c33567542eef8d099605a46a/waldur_core/structure/views.py#L877-L886
[ "def", "can_user_update_settings", "(", "request", ",", "view", ",", "obj", "=", "None", ")", ":", "if", "obj", "is", "None", ":", "return", "# TODO [TM:3/21/17] clean it up after WAL-634. Clean up service settings update tests as well.", "if", "obj", ".", "customer", "...
d6c17a9592bb6c49c33567542eef8d099605a46a
train
ServiceSettingsViewSet.update
To update service settings, issue a **PUT** or **PATCH** to */api/service-settings/<uuid>/* as a customer owner. You are allowed to change name and credentials only. Example of a request: .. code-block:: http PATCH /api/service-settings/9079705c17d64e6aa0af2e619b0e0702/ HTTP/1.1 ...
waldur_core/structure/views.py
def update(self, request, *args, **kwargs): """ To update service settings, issue a **PUT** or **PATCH** to */api/service-settings/<uuid>/* as a customer owner. You are allowed to change name and credentials only. Example of a request: .. code-block:: http PATCH /a...
def update(self, request, *args, **kwargs): """ To update service settings, issue a **PUT** or **PATCH** to */api/service-settings/<uuid>/* as a customer owner. You are allowed to change name and credentials only. Example of a request: .. code-block:: http PATCH /a...
[ "To", "update", "service", "settings", "issue", "a", "**", "PUT", "**", "or", "**", "PATCH", "**", "to", "*", "/", "api", "/", "service", "-", "settings", "/", "<uuid", ">", "/", "*", "as", "a", "customer", "owner", ".", "You", "are", "allowed", "t...
opennode/waldur-core
python
https://github.com/opennode/waldur-core/blob/d6c17a9592bb6c49c33567542eef8d099605a46a/waldur_core/structure/views.py#L888-L908
[ "def", "update", "(", "self", ",", "request", ",", "*", "args", ",", "*", "*", "kwargs", ")", ":", "return", "super", "(", "ServiceSettingsViewSet", ",", "self", ")", ".", "update", "(", "request", ",", "*", "args", ",", "*", "*", "kwargs", ")" ]
d6c17a9592bb6c49c33567542eef8d099605a46a
train
ServiceSettingsViewSet.stats
This endpoint returns allocation of resources for current service setting. Answer is service-specific dictionary. Example output for OpenStack: * vcpu - maximum number of vCPUs (from hypervisors) * vcpu_quota - maximum number of vCPUs(from quotas) * vcpu_usage - current number of used v...
waldur_core/structure/views.py
def stats(self, request, uuid=None): """ This endpoint returns allocation of resources for current service setting. Answer is service-specific dictionary. Example output for OpenStack: * vcpu - maximum number of vCPUs (from hypervisors) * vcpu_quota - maximum number of vCPUs(fro...
def stats(self, request, uuid=None): """ This endpoint returns allocation of resources for current service setting. Answer is service-specific dictionary. Example output for OpenStack: * vcpu - maximum number of vCPUs (from hypervisors) * vcpu_quota - maximum number of vCPUs(fro...
[ "This", "endpoint", "returns", "allocation", "of", "resources", "for", "current", "service", "setting", ".", "Answer", "is", "service", "-", "specific", "dictionary", ".", "Example", "output", "for", "OpenStack", ":" ]
opennode/waldur-core
python
https://github.com/opennode/waldur-core/blob/d6c17a9592bb6c49c33567542eef8d099605a46a/waldur_core/structure/views.py#L914-L952
[ "def", "stats", "(", "self", ",", "request", ",", "uuid", "=", "None", ")", ":", "service_settings", "=", "self", ".", "get_object", "(", ")", "backend", "=", "service_settings", ".", "get_backend", "(", ")", "try", ":", "stats", "=", "backend", ".", "...
d6c17a9592bb6c49c33567542eef8d099605a46a
train
ResourceSummaryViewSet.list
To get a list of supported resources' actions, run **OPTIONS** against */api/<resource_url>/* as an authenticated user. It is possible to filter and order by resource-specific fields, but this filters will be applied only to resources that support such filtering. For example it is possible to s...
waldur_core/structure/views.py
def list(self, request, *args, **kwargs): """ To get a list of supported resources' actions, run **OPTIONS** against */api/<resource_url>/* as an authenticated user. It is possible to filter and order by resource-specific fields, but this filters will be applied only to resource...
def list(self, request, *args, **kwargs): """ To get a list of supported resources' actions, run **OPTIONS** against */api/<resource_url>/* as an authenticated user. It is possible to filter and order by resource-specific fields, but this filters will be applied only to resource...
[ "To", "get", "a", "list", "of", "supported", "resources", "actions", "run", "**", "OPTIONS", "**", "against", "*", "/", "api", "/", "<resource_url", ">", "/", "*", "as", "an", "authenticated", "user", "." ]
opennode/waldur-core
python
https://github.com/opennode/waldur-core/blob/d6c17a9592bb6c49c33567542eef8d099605a46a/waldur_core/structure/views.py#L1029-L1128
[ "def", "list", "(", "self", ",", "request", ",", "*", "args", ",", "*", "*", "kwargs", ")", ":", "return", "super", "(", "ResourceSummaryViewSet", ",", "self", ")", ".", "list", "(", "request", ",", "*", "args", ",", "*", "*", "kwargs", ")" ]
d6c17a9592bb6c49c33567542eef8d099605a46a
train
ResourceSummaryViewSet.count
Count resources by type. Example output: .. code-block:: javascript { "Amazon.Instance": 0, "GitLab.Project": 3, "Azure.VirtualMachine": 0, "DigitalOcean.Droplet": 0, "OpenStack.Instance": 0, "GitLab.Gr...
waldur_core/structure/views.py
def count(self, request): """ Count resources by type. Example output: .. code-block:: javascript { "Amazon.Instance": 0, "GitLab.Project": 3, "Azure.VirtualMachine": 0, "DigitalOcean.Droplet": 0, "Open...
def count(self, request): """ Count resources by type. Example output: .. code-block:: javascript { "Amazon.Instance": 0, "GitLab.Project": 3, "Azure.VirtualMachine": 0, "DigitalOcean.Droplet": 0, "Open...
[ "Count", "resources", "by", "type", ".", "Example", "output", ":" ]
opennode/waldur-core
python
https://github.com/opennode/waldur-core/blob/d6c17a9592bb6c49c33567542eef8d099605a46a/waldur_core/structure/views.py#L1131-L1148
[ "def", "count", "(", "self", ",", "request", ")", ":", "queryset", "=", "self", ".", "filter_queryset", "(", "self", ".", "get_queryset", "(", ")", ")", "return", "Response", "(", "{", "SupportedServices", ".", "get_name_for_model", "(", "qs", ".", "model"...
d6c17a9592bb6c49c33567542eef8d099605a46a
train
ServicesViewSet.list
Filter services by type ^^^^^^^^^^^^^^^^^^^^^^^ It is possible to filter services by their types. Example: /api/services/?service_type=DigitalOcean&service_type=OpenStack
waldur_core/structure/views.py
def list(self, request, *args, **kwargs): """ Filter services by type ^^^^^^^^^^^^^^^^^^^^^^^ It is possible to filter services by their types. Example: /api/services/?service_type=DigitalOcean&service_type=OpenStack """ return super(ServicesViewSet, self).lis...
def list(self, request, *args, **kwargs): """ Filter services by type ^^^^^^^^^^^^^^^^^^^^^^^ It is possible to filter services by their types. Example: /api/services/?service_type=DigitalOcean&service_type=OpenStack """ return super(ServicesViewSet, self).lis...
[ "Filter", "services", "by", "type", "^^^^^^^^^^^^^^^^^^^^^^^" ]
opennode/waldur-core
python
https://github.com/opennode/waldur-core/blob/d6c17a9592bb6c49c33567542eef8d099605a46a/waldur_core/structure/views.py#L1172-L1181
[ "def", "list", "(", "self", ",", "request", ",", "*", "args", ",", "*", "*", "kwargs", ")", ":", "return", "super", "(", "ServicesViewSet", ",", "self", ")", ".", "list", "(", "request", ",", "*", "args", ",", "*", "*", "kwargs", ")" ]
d6c17a9592bb6c49c33567542eef8d099605a46a
train
BaseServiceViewSet.list
To list all services without regard to its type, run **GET** against */api/services/* as an authenticated user. To list services of specific type issue **GET** to specific endpoint from a list above as a customer owner. Individual endpoint used for every service type. To create a service, issu...
waldur_core/structure/views.py
def list(self, request, *args, **kwargs): """ To list all services without regard to its type, run **GET** against */api/services/* as an authenticated user. To list services of specific type issue **GET** to specific endpoint from a list above as a customer owner. Individual endpoint u...
def list(self, request, *args, **kwargs): """ To list all services without regard to its type, run **GET** against */api/services/* as an authenticated user. To list services of specific type issue **GET** to specific endpoint from a list above as a customer owner. Individual endpoint u...
[ "To", "list", "all", "services", "without", "regard", "to", "its", "type", "run", "**", "GET", "**", "against", "*", "/", "api", "/", "services", "/", "*", "as", "an", "authenticated", "user", "." ]
opennode/waldur-core
python
https://github.com/opennode/waldur-core/blob/d6c17a9592bb6c49c33567542eef8d099605a46a/waldur_core/structure/views.py#L1369-L1413
[ "def", "list", "(", "self", ",", "request", ",", "*", "args", ",", "*", "*", "kwargs", ")", ":", "return", "super", "(", "BaseServiceViewSet", ",", "self", ")", ".", "list", "(", "request", ",", "*", "args", ",", "*", "*", "kwargs", ")" ]
d6c17a9592bb6c49c33567542eef8d099605a46a
train
BaseServiceViewSet._require_staff_for_shared_settings
Allow to execute action only if service settings are not shared or user is staff
waldur_core/structure/views.py
def _require_staff_for_shared_settings(request, view, obj=None): """ Allow to execute action only if service settings are not shared or user is staff """ if obj is None: return if obj.settings.shared and not request.user.is_staff: raise PermissionDenied(_('Only staff use...
def _require_staff_for_shared_settings(request, view, obj=None): """ Allow to execute action only if service settings are not shared or user is staff """ if obj is None: return if obj.settings.shared and not request.user.is_staff: raise PermissionDenied(_('Only staff use...
[ "Allow", "to", "execute", "action", "only", "if", "service", "settings", "are", "not", "shared", "or", "user", "is", "staff" ]
opennode/waldur-core
python
https://github.com/opennode/waldur-core/blob/d6c17a9592bb6c49c33567542eef8d099605a46a/waldur_core/structure/views.py#L1452-L1458
[ "def", "_require_staff_for_shared_settings", "(", "request", ",", "view", ",", "obj", "=", "None", ")", ":", "if", "obj", "is", "None", ":", "return", "if", "obj", ".", "settings", ".", "shared", "and", "not", "request", ".", "user", ".", "is_staff", ":"...
d6c17a9592bb6c49c33567542eef8d099605a46a
train
BaseServiceViewSet.link
To get a list of resources available for import, run **GET** against */<service_endpoint>/link/* as an authenticated user. Optionally project_uuid parameter can be supplied for services requiring it like OpenStack. To import (link with Waldur) resource issue **POST** against the same endpoint w...
waldur_core/structure/views.py
def link(self, request, uuid=None): """ To get a list of resources available for import, run **GET** against */<service_endpoint>/link/* as an authenticated user. Optionally project_uuid parameter can be supplied for services requiring it like OpenStack. To import (link with Wal...
def link(self, request, uuid=None): """ To get a list of resources available for import, run **GET** against */<service_endpoint>/link/* as an authenticated user. Optionally project_uuid parameter can be supplied for services requiring it like OpenStack. To import (link with Wal...
[ "To", "get", "a", "list", "of", "resources", "available", "for", "import", "run", "**", "GET", "**", "against", "*", "/", "<service_endpoint", ">", "/", "link", "/", "*", "as", "an", "authenticated", "user", ".", "Optionally", "project_uuid", "parameter", ...
opennode/waldur-core
python
https://github.com/opennode/waldur-core/blob/d6c17a9592bb6c49c33567542eef8d099605a46a/waldur_core/structure/views.py#L1461-L1515
[ "def", "link", "(", "self", ",", "request", ",", "uuid", "=", "None", ")", ":", "service", "=", "self", ".", "get_object", "(", ")", "if", "self", ".", "request", ".", "method", "==", "'GET'", ":", "try", ":", "backend", "=", "self", ".", "get_back...
d6c17a9592bb6c49c33567542eef8d099605a46a
train
BaseServiceViewSet.unlink
Unlink all related resources, service project link and service itself.
waldur_core/structure/views.py
def unlink(self, request, uuid=None): """ Unlink all related resources, service project link and service itself. """ service = self.get_object() service.unlink_descendants() self.perform_destroy(service) return Response(status=status.HTTP_204_NO_CONTENT)
def unlink(self, request, uuid=None): """ Unlink all related resources, service project link and service itself. """ service = self.get_object() service.unlink_descendants() self.perform_destroy(service) return Response(status=status.HTTP_204_NO_CONTENT)
[ "Unlink", "all", "related", "resources", "service", "project", "link", "and", "service", "itself", "." ]
opennode/waldur-core
python
https://github.com/opennode/waldur-core/blob/d6c17a9592bb6c49c33567542eef8d099605a46a/waldur_core/structure/views.py#L1535-L1543
[ "def", "unlink", "(", "self", ",", "request", ",", "uuid", "=", "None", ")", ":", "service", "=", "self", ".", "get_object", "(", ")", "service", ".", "unlink_descendants", "(", ")", "self", ".", "perform_destroy", "(", "service", ")", "return", "Respons...
d6c17a9592bb6c49c33567542eef8d099605a46a
train
BaseServiceProjectLinkViewSet.list
To get a list of connections between a project and an service, run **GET** against service_project_link_url as authenticated user. Note that a user can only see connections of a project where a user has a role. If service has `available_for_all` flag, project-service connections are created automatical...
waldur_core/structure/views.py
def list(self, request, *args, **kwargs): """ To get a list of connections between a project and an service, run **GET** against service_project_link_url as authenticated user. Note that a user can only see connections of a project where a user has a role. If service has `available_for_...
def list(self, request, *args, **kwargs): """ To get a list of connections between a project and an service, run **GET** against service_project_link_url as authenticated user. Note that a user can only see connections of a project where a user has a role. If service has `available_for_...
[ "To", "get", "a", "list", "of", "connections", "between", "a", "project", "and", "an", "service", "run", "**", "GET", "**", "against", "service_project_link_url", "as", "authenticated", "user", ".", "Note", "that", "a", "user", "can", "only", "see", "connect...
opennode/waldur-core
python
https://github.com/opennode/waldur-core/blob/d6c17a9592bb6c49c33567542eef8d099605a46a/waldur_core/structure/views.py#L1560-L1570
[ "def", "list", "(", "self", ",", "request", ",", "*", "args", ",", "*", "*", "kwargs", ")", ":", "return", "super", "(", "BaseServiceProjectLinkViewSet", ",", "self", ")", ".", "list", "(", "request", ",", "*", "args", ",", "*", "*", "kwargs", ")" ]
d6c17a9592bb6c49c33567542eef8d099605a46a
train
BaseServiceProjectLinkViewSet.retrieve
To remove a link, issue **DELETE** to URL of the corresponding connection as stuff user or customer owner.
waldur_core/structure/views.py
def retrieve(self, request, *args, **kwargs): """ To remove a link, issue **DELETE** to URL of the corresponding connection as stuff user or customer owner. """ return super(BaseServiceProjectLinkViewSet, self).retrieve(request, *args, **kwargs)
def retrieve(self, request, *args, **kwargs): """ To remove a link, issue **DELETE** to URL of the corresponding connection as stuff user or customer owner. """ return super(BaseServiceProjectLinkViewSet, self).retrieve(request, *args, **kwargs)
[ "To", "remove", "a", "link", "issue", "**", "DELETE", "**", "to", "URL", "of", "the", "corresponding", "connection", "as", "stuff", "user", "or", "customer", "owner", "." ]
opennode/waldur-core
python
https://github.com/opennode/waldur-core/blob/d6c17a9592bb6c49c33567542eef8d099605a46a/waldur_core/structure/views.py#L1572-L1576
[ "def", "retrieve", "(", "self", ",", "request", ",", "*", "args", ",", "*", "*", "kwargs", ")", ":", "return", "super", "(", "BaseServiceProjectLinkViewSet", ",", "self", ")", ".", "retrieve", "(", "request", ",", "*", "args", ",", "*", "*", "kwargs", ...
d6c17a9592bb6c49c33567542eef8d099605a46a