repository_name
stringlengths
7
55
func_path_in_repository
stringlengths
4
223
func_name
stringlengths
1
134
whole_func_string
stringlengths
75
104k
language
stringclasses
1 value
func_code_string
stringlengths
75
104k
func_code_tokens
listlengths
19
28.4k
func_documentation_string
stringlengths
1
46.9k
func_documentation_tokens
listlengths
1
1.97k
split_name
stringclasses
1 value
func_code_url
stringlengths
87
315
deathbeds/importnb
src/importnb/ipython_extension.py
IPYTHON_MAIN
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"...
python
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", "(", ")", ":", "import", "pkg_resources", "runner_frame", "=", "inspect", ".", "getouterframes", "(", "inspect", ".", "currentframe", "(", ")", ")", "[", "-", "2", "]", "return", "(", "getattr", "(", "runner_frame", ",", "\"function\""...
Decide if the Ipython command line is running code.
[ "Decide", "if", "the", "Ipython", "command", "line", "is", "running", "code", "." ]
train
https://github.com/deathbeds/importnb/blob/ec870d1f8ab99fd5b363267f89787a3e442a779f/src/importnb/ipython_extension.py#L85-L93
nuagenetworks/bambou
bambou/nurest_modelcontroller.py
NURESTModelController.register_model
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...
python
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", ")", ":", "rest_name", "=", "model", ".", "rest_name", "resource_name", "=", "model", ".", "resource_name", "if", "rest_name", "not", "in", "cls", ".", "_model_rest_name_registry", ":", "cls", ".", "_model_res...
Register a model class according to its remote name Args: model: the model to register
[ "Register", "a", "model", "class", "according", "to", "its", "remote", "name" ]
train
https://github.com/nuagenetworks/bambou/blob/d334fea23e384d3df8e552fe1849ad707941c666/bambou/nurest_modelcontroller.py#L37-L54
nuagenetworks/bambou
bambou/nurest_modelcontroller.py
NURESTModelController.get_first_model_with_rest_name
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...
python
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", ")", ":", "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 Args: rest_name: the rest name
[ "Get", "the", "first", "model", "corresponding", "to", "a", "rest_name" ]
train
https://github.com/nuagenetworks/bambou/blob/d334fea23e384d3df8e552fe1849ad707941c666/bambou/nurest_modelcontroller.py#L87-L99
nuagenetworks/bambou
bambou/nurest_modelcontroller.py
NURESTModelController.get_first_model_with_resource_name
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 ...
python
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", ")", ":", "models", "=", "cls", ".", "get_models_with_resource_name", "(", "resource_name", ")", "if", "len", "(", "models", ")", ">", "0", ":", "return", "models", "[", "0", "]", ...
Get the first model corresponding to a resource_name Args: resource_name: the resource name
[ "Get", "the", "first", "model", "corresponding", "to", "a", "resource_name" ]
train
https://github.com/nuagenetworks/bambou/blob/d334fea23e384d3df8e552fe1849ad707941c666/bambou/nurest_modelcontroller.py#L121-L133
zeromake/aiosqlite3
aiosqlite3/sqlite_thread.py
SqliteThread.run
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 ...
python
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...
执行任务
[ "执行任务" ]
train
https://github.com/zeromake/aiosqlite3/blob/1a74a062507e2df8f833a70885e69dca0ab3e7e7/aiosqlite3/sqlite_thread.py#L22-L47
OpenDataScienceLab/skdata
skdata/widgets.py
SkDataWidget.build_layout
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...
python
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", ")", ":", "all_fields", "=", "list", "(", "self", ".", "get_data", "(", "dset_id", "=", "dset_id", ")", ".", "keys", "(", ")", ")", "try", ":", "field_reference", "=", "self", ".", "skd"...
:param dset_id: :return:
[ ":", "param", "dset_id", ":", ":", "return", ":" ]
train
https://github.com/OpenDataScienceLab/skdata/blob/34f06845a944ff4f048b55c7babdd8420f71a6b9/skdata/widgets.py#L108-L249
OpenDataScienceLab/skdata
skdata/widgets.py
SkDataWidget.display
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...
python
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", ")", ":", "# update result", "self", ".", "skd", "[", "dset_id", "]", ".", "compute", "(", ")", "# build layout", "self", ".", "build_layout", "(", "dset_id", "=", "dset_id", ")", "# display widget...
:param dset_id: :return:
[ ":", "param", "dset_id", ":", ":", "return", ":" ]
train
https://github.com/OpenDataScienceLab/skdata/blob/34f06845a944ff4f048b55c7babdd8420f71a6b9/skdata/widgets.py#L251-L264
deathbeds/importnb
src/importnb/finder.py
FuzzyFinder.find_spec
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 ...
python
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", ")", ":", "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.
[ "Try", "to", "finder", "the", "spec", "and", "if", "it", "cannot", "be", "found", "use", "the", "underscore", "starring", "syntax", "to", "identify", "potential", "matches", "." ]
train
https://github.com/deathbeds/importnb/blob/ec870d1f8ab99fd5b363267f89787a3e442a779f/src/importnb/finder.py#L58-L89
nuagenetworks/bambou
bambou/nurest_root_object.py
NURESTRootObject.get_resource_url
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)
python
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", ")", ":", "name", "=", "self", ".", "__class__", ".", "resource_name", "url", "=", "self", ".", "__class__", ".", "rest_base_url", "(", ")", "return", "\"%s/%s\"", "%", "(", "url", ",", "name", ")" ]
Get resource complete url
[ "Get", "resource", "complete", "url" ]
train
https://github.com/nuagenetworks/bambou/blob/d334fea23e384d3df8e552fe1849ad707941c666/bambou/nurest_root_object.py#L118-L124
nuagenetworks/bambou
bambou/nurest_root_object.py
NURESTRootObject.save
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...
python
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", ")", ":", "if", "self", ".", "_new_password", "and", "encrypted", ":", "self", ".", "password", "=", "Sha1", ".", "encrypt", "(", "se...
Updates the user and perform the callback method
[ "Updates", "the", "user", "and", "perform", "the", "callback", "method" ]
train
https://github.com/nuagenetworks/bambou/blob/d334fea23e384d3df8e552fe1849ad707941c666/bambou/nurest_root_object.py#L131-L148
nuagenetworks/bambou
bambou/nurest_root_object.py
NURESTRootObject._did_save
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: ...
python
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", ")", ":", "self", ".", "_new_password", "=", "None", "controller", "=", "NURESTSession", ".", "get_current_session", "(", ")", ".", "login_controller", "controller", ".", "password", "=", "None", "controller", ...
Launched when save has been successfully executed
[ "Launched", "when", "save", "has", "been", "successfully", "executed" ]
train
https://github.com/nuagenetworks/bambou/blob/d334fea23e384d3df8e552fe1849ad707941c666/bambou/nurest_root_object.py#L150-L167
nuagenetworks/bambou
bambou/nurest_root_object.py
NURESTRootObject.fetch
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 ...
python
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", ")", ":", "request", "=", "NURESTRequest", "(", "method", "=", "HTTP_METHOD_GET", ",", "url", "=", "self", ".", "get_resource_url", "(", ")", ")", "if", "async", ":"...
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...
[ "Fetch", "all", "information", "about", "the", "current", "object" ]
train
https://github.com/nuagenetworks/bambou/blob/d334fea23e384d3df8e552fe1849ad707941c666/bambou/nurest_root_object.py#L169-L191
noumar/iso639
iso639/iso639.py
_fabtabular
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...
python
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", "(", ")", ":", "import", "csv", "import", "sys", "from", "pkg_resources", "import", "resource_filename", "data", "=", "resource_filename", "(", "__package__", ",", "'iso-639-3.tab'", ")", "inverted", "=", "resource_filename", "(", "__package__"...
This function retrieves the ISO 639 and inverted names datasets as tsv files and returns them as lists.
[ "This", "function", "retrieves", "the", "ISO", "639", "and", "inverted", "names", "datasets", "as", "tsv", "files", "and", "returns", "them", "as", "lists", "." ]
train
https://github.com/noumar/iso639/blob/2175cf04b8b8cec79d99a6c4ad31295d67c22cd6/iso639/iso639.py#L14-L63
noumar/iso639
iso639/iso639.py
Iso639.retired
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...
python
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", ")", ":", "def", "gen", "(", ")", ":", "import", "csv", "import", "re", "from", "datetime", "import", "datetime", "from", "pkg_resources", "import", "resource_filename", "with", "open", "(", "resource_filename", "(", "__package__...
Function for generating retired languages. Returns a dict('code', (datetime, [language, ...], 'description')).
[ "Function", "for", "generating", "retired", "languages", ".", "Returns", "a", "dict", "(", "code", "(", "datetime", "[", "language", "...", "]", "description", "))", "." ]
train
https://github.com/noumar/iso639/blob/2175cf04b8b8cec79d99a6c4ad31295d67c22cd6/iso639/iso639.py#L230-L256
noumar/iso639
iso639/iso639.py
Iso639.get
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...
python
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", ")", ":", "if", "not", "len", "(", "kwargs", ")", "==", "1", ":", "raise", "AttributeError", "(", "'Only one keyword expected'", ")", "key", ",", "value", "=", "kwargs", ".", "popitem", "(", ")", "r...
Simple getter function for languages. Takes 1 keyword/value and returns 1 language object.
[ "Simple", "getter", "function", "for", "languages", ".", "Takes", "1", "keyword", "/", "value", "and", "returns", "1", "language", "object", "." ]
train
https://github.com/noumar/iso639/blob/2175cf04b8b8cec79d99a6c4ad31295d67c22cd6/iso639/iso639.py#L258-L265
opennode/waldur-core
waldur_core/structure/views.py
CustomerViewSet.list
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...
python
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", ")", ":", "return", "super", "(", "CustomerViewSet", ",", "self", ")", ".", "list", "(", "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 Staff also can filter customers by user UUID, for example /api/cu...
[ "To", "get", "a", "list", "of", "customers", "run", "GET", "against", "*", "/", "api", "/", "customers", "/", "*", "as", "authenticated", "user", ".", "Note", "that", "a", "user", "can", "only", "see", "connected", "customers", ":" ]
train
https://github.com/opennode/waldur-core/blob/d6c17a9592bb6c49c33567542eef8d099605a46a/waldur_core/structure/views.py#L71-L92
opennode/waldur-core
waldur_core/structure/views.py
CustomerViewSet.retrieve
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 { ...
python
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", ")", ":", "return", "super", "(", "CustomerViewSet", ",", "self", ")", ".", "retrieve", "(", "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 { "uuid": "90bcfe38b0124c9bbdadd617b5d739f5", ...
[ "Optional", "field", "query", "parameter", "(", "can", "be", "list", ")", "allows", "to", "limit", "what", "fields", "are", "returned", ".", "For", "example", "given", "request", "/", "api", "/", "customers", "/", "<uuid", ">", "/", "?field", "=", "uuid&...
train
https://github.com/opennode/waldur-core/blob/d6c17a9592bb6c49c33567542eef8d099605a46a/waldur_core/structure/views.py#L94-L106
opennode/waldur-core
waldur_core/structure/views.py
CustomerViewSet.create
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...
python
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", ")", ":", "return", "super", "(", "CustomerViewSet", ",", "self", ")", ".", "create", "(", "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 POST /api/customers/ HTTP/1.1 Content-Type: applicatio...
[ "A", "new", "customer", "can", "only", "be", "created", ":" ]
train
https://github.com/opennode/waldur-core/blob/d6c17a9592bb6c49c33567542eef8d099605a46a/waldur_core/structure/views.py#L108-L132
opennode/waldur-core
waldur_core/structure/views.py
CustomerViewSet.destroy
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...
python
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", ")", ":", "return", "super", "(", "CustomerViewSet", ",", "self", ")", ".", "destroy", "(", "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 user specific): .. code-block:: http DELETE ...
[ "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...
train
https://github.com/opennode/waldur-core/blob/d6c17a9592bb6c49c33567542eef8d099605a46a/waldur_core/structure/views.py#L134-L147
opennode/waldur-core
waldur_core/structure/views.py
ProjectViewSet.list
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...
python
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", ")", ":", "return", "super", "(", "ProjectViewSet", ",", "self", ")", ".", "list", "(", "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 user owns as a customer - projects where user has any r...
[ "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"...
train
https://github.com/opennode/waldur-core/blob/d6c17a9592bb6c49c33567542eef8d099605a46a/waldur_core/structure/views.py#L260-L275
opennode/waldur-core
waldur_core/structure/views.py
ProjectViewSet.retrieve
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 { ...
python
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", ")", ":", "return", "super", "(", "ProjectViewSet", ",", "self", ")", ".", "retrieve", "(", "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 { "uuid": "90bcfe38b0124c9bbdadd617b5d739f5", ...
[ "Optional", "field", "query", "parameter", "(", "can", "be", "list", ")", "allows", "to", "limit", "what", "fields", "are", "returned", ".", "For", "example", "given", "request", "/", "api", "/", "projects", "/", "<uuid", ">", "/", "?field", "=", "uuid&f...
train
https://github.com/opennode/waldur-core/blob/d6c17a9592bb6c49c33567542eef8d099605a46a/waldur_core/structure/views.py#L277-L289
opennode/waldur-core
waldur_core/structure/views.py
ProjectViewSet.create
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...
python
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", ")", ":", "return", "super", "(", "ProjectViewSet", ",", "self", ")", ".", "create", "(", "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 Content-Type: application/json Accept: application/json ...
[ "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",...
train
https://github.com/opennode/waldur-core/blob/d6c17a9592bb6c49c33567542eef8d099605a46a/waldur_core/structure/views.py#L291-L309
opennode/waldur-core
waldur_core/structure/views.py
ProjectViewSet.destroy
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...
python
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", ")", ":", "return", "super", "(", "ProjectViewSet", ",", "self", ")", ".", "destroy", "(", "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 user specific): .. code-block:: http DELETE /a...
[ "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"...
train
https://github.com/opennode/waldur-core/blob/d6c17a9592bb6c49c33567542eef8d099605a46a/waldur_core/structure/views.py#L311-L324
opennode/waldur-core
waldur_core/structure/views.py
ProjectViewSet.users
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...
python
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", ")", ":", "project", "=", "self", ".", "get_object", "(", ")", "queryset", "=", "project", ".", "get_users", "(", ")", "# we need to handle filtration manually because we want to filter only pr...
A list of users connected to the project
[ "A", "list", "of", "users", "connected", "to", "the", "project" ]
train
https://github.com/opennode/waldur-core/blob/d6c17a9592bb6c49c33567542eef8d099605a46a/waldur_core/structure/views.py#L374-L383
opennode/waldur-core
waldur_core/structure/views.py
UserViewSet.list
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...
python
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", ")", ":", "return", "super", "(", "UserViewSet", ",", "self", ")", ".", "list", "(", "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 below. All of the filters apart from ?organization are usi...
[ "User", "list", "is", "available", "to", "all", "authenticated", "users", ".", "To", "get", "a", "list", "issue", "authenticated", "**", "GET", "**", "request", "against", "*", "/", "api", "/", "users", "/", "*", "." ]
train
https://github.com/opennode/waldur-core/blob/d6c17a9592bb6c49c33567542eef8d099605a46a/waldur_core/structure/views.py#L417-L459
opennode/waldur-core
waldur_core/structure/views.py
UserViewSet.retrieve
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...
python
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", ")", ":", "return", "super", "(", "UserViewSet", ",", "self", ")", ".", "retrieve", "(", "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.org/en/stable/>`_ instead) - full_name - native_nam...
[ "User", "fields", "can", "be", "updated", "by", "account", "owner", "or", "user", "with", "staff", "privilege", "(", "is_staff", "=", "True", ")", ".", "Following", "user", "fields", "can", "be", "updated", ":" ]
train
https://github.com/opennode/waldur-core/blob/d6c17a9592bb6c49c33567542eef8d099605a46a/waldur_core/structure/views.py#L461-L490
opennode/waldur-core
waldur_core/structure/views.py
UserViewSet.password
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...
python
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", ")", ":", "user", "=", "self", ".", "get_object", "(", ")", "serializer", "=", "serializers", ".", "PasswordSerializer", "(", "data", "=", "request", ".", "data", ")", "serializer"...
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: ...
[ "To", "change", "a", "user", "password", "submit", "a", "**", "POST", "**", "request", "to", "the", "user", "s", "RPC", "URL", "specifying", "new", "password", "by", "staff", "user", "or", "account", "owner", "." ]
train
https://github.com/opennode/waldur-core/blob/d6c17a9592bb6c49c33567542eef8d099605a46a/waldur_core/structure/views.py#L493-L525
opennode/waldur-core
waldur_core/structure/views.py
ProjectPermissionViewSet.list
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...
python
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", ")", ":", "return", "super", "(", "ProjectPermissionViewSet", ",", "self", ")", ".", "list", "(", "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 that project permissions can be viewed and modified only by custo...
[ "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...
train
https://github.com/opennode/waldur-core/blob/d6c17a9592bb6c49c33567542eef8d099605a46a/waldur_core/structure/views.py#L611-L638
opennode/waldur-core
waldur_core/structure/views.py
ProjectPermissionViewSet.destroy
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...
python
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", ")", ":", "return", "super", "(", "ProjectPermissionViewSet", ",", "self", ")", ".", "destroy", "(", "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: Token 95a688962bf68678fd4c8cec4d138ddd9493c93b Host: e...
[ "To", "remove", "a", "user", "from", "a", "project", "delete", "corresponding", "connection", "(", "**", "url", "**", "field", ")", ".", "Successful", "deletion", "will", "return", "status", "code", "204", "." ]
train
https://github.com/opennode/waldur-core/blob/d6c17a9592bb6c49c33567542eef8d099605a46a/waldur_core/structure/views.py#L640-L651
opennode/waldur-core
waldur_core/structure/views.py
CustomerPermissionViewSet.list
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...
python
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", ")", ":", "return", "super", "(", "CustomerPermissionViewSet", ",", "self", ")", ".", "list", "(", "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 contain a list of customer owners and their brief data. ...
[ "Each", "customer", "is", "associated", "with", "a", "group", "of", "users", "that", "represent", "customer", "owners", ".", "The", "link", "is", "maintained", "through", "**", "api", "/", "customer", "-", "permissions", "/", "**", "endpoint", "." ]
train
https://github.com/opennode/waldur-core/blob/d6c17a9592bb6c49c33567542eef8d099605a46a/waldur_core/structure/views.py#L689-L712
opennode/waldur-core
waldur_core/structure/views.py
CustomerPermissionViewSet.retrieve
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...
python
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", ")", ":", "return", "super", "(", "CustomerPermissionViewSet", ",", "self", ")", ".", "retrieve", "(", "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 Authorization: Token 95a688962bf68678fd4c8cec4d138ddd9493c93b ...
[ "To", "remove", "a", "user", "from", "a", "customer", "owner", "group", "delete", "corresponding", "connection", "(", "**", "url", "**", "field", ")", ".", "Successful", "deletion", "will", "return", "status", "code", "204", "." ]
train
https://github.com/opennode/waldur-core/blob/d6c17a9592bb6c49c33567542eef8d099605a46a/waldur_core/structure/views.py#L714-L725
opennode/waldur-core
waldur_core/structure/views.py
CreationTimeStatsView.list
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...
python
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", ")", ":", "return", "super", "(", "CreationTimeStatsView", ",", "self", ")", ".", "list", "(", "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 example: 1415912625) - ?datapoints=how many data points hav...
[ "Available", "request", "parameters", ":" ]
train
https://github.com/opennode/waldur-core/blob/d6c17a9592bb6c49c33567542eef8d099605a46a/waldur_core/structure/views.py#L757-L780
opennode/waldur-core
waldur_core/structure/views.py
SshKeyViewSet.list
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-...
python
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", ")", ":", "return", "super", "(", "SshKeyViewSet", ",", "self", ")", ".", "list", "(", "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-Type: application/json Accept: application/json ...
[ "To", "get", "a", "list", "of", "SSH", "keys", "run", "**", "GET", "**", "against", "*", "/", "api", "/", "keys", "/", "*", "as", "authenticated", "user", "." ]
train
https://github.com/opennode/waldur-core/blob/d6c17a9592bb6c49c33567542eef8d099605a46a/waldur_core/structure/views.py#L816-L839
opennode/waldur-core
waldur_core/structure/views.py
ServiceSettingsViewSet.list
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...
python
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", ")", ":", "return", "super", "(", "ServiceSettingsViewSet", ",", "self", ")", ".", "list", "(", "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 used for searching - ?type=<type> - choices: OpenStack,...
[ "To", "get", "a", "list", "of", "service", "settings", "run", "**", "GET", "**", "against", "*", "/", "api", "/", "service", "-", "settings", "/", "*", "as", "an", "authenticated", "user", ".", "Only", "settings", "owned", "by", "this", "user", "or", ...
train
https://github.com/opennode/waldur-core/blob/d6c17a9592bb6c49c33567542eef8d099605a46a/waldur_core/structure/views.py#L863-L875
opennode/waldur-core
waldur_core/structure/views.py
ServiceSettingsViewSet.can_user_update_settings
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...
python
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", ")", ":", "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", "...
Only staff can update shared settings, otherwise user has to be an owner of the settings.
[ "Only", "staff", "can", "update", "shared", "settings", "otherwise", "user", "has", "to", "be", "an", "owner", "of", "the", "settings", "." ]
train
https://github.com/opennode/waldur-core/blob/d6c17a9592bb6c49c33567542eef8d099605a46a/waldur_core/structure/views.py#L877-L886
opennode/waldur-core
waldur_core/structure/views.py
ServiceSettingsViewSet.update
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...
python
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", ")", ":", "return", "super", "(", "ServiceSettingsViewSet", ",", "self", ")", ".", "update", "(", "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 /api/service-settings/9079705c17d64e6aa0af2e619b0e0702/ HTTP/1.1 ...
[ "To", "update", "service", "settings", "issue", "a", "**", "PUT", "**", "or", "**", "PATCH", "**", "to", "*", "/", "api", "/", "service", "-", "settings", "/", "<uuid", ">", "/", "*", "as", "a", "customer", "owner", ".", "You", "are", "allowed", "t...
train
https://github.com/opennode/waldur-core/blob/d6c17a9592bb6c49c33567542eef8d099605a46a/waldur_core/structure/views.py#L888-L908
opennode/waldur-core
waldur_core/structure/views.py
ServiceSettingsViewSet.stats
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...
python
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", ")", ":", "service_settings", "=", "self", ".", "get_object", "(", ")", "backend", "=", "service_settings", ".", "get_backend", "(", ")", "try", ":", "stats", "=", "backend", ".", "...
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...
[ "This", "endpoint", "returns", "allocation", "of", "resources", "for", "current", "service", "setting", ".", "Answer", "is", "service", "-", "specific", "dictionary", ".", "Example", "output", "for", "OpenStack", ":" ]
train
https://github.com/opennode/waldur-core/blob/d6c17a9592bb6c49c33567542eef8d099605a46a/waldur_core/structure/views.py#L914-L952
opennode/waldur-core
waldur_core/structure/views.py
ResourceSummaryViewSet.list
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...
python
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", ")", ":", "return", "super", "(", "ResourceSummaryViewSet", ",", "self", ")", ".", "list", "(", "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 resources that support such filtering. For example it is possible to s...
[ "To", "get", "a", "list", "of", "supported", "resources", "actions", "run", "**", "OPTIONS", "**", "against", "*", "/", "api", "/", "<resource_url", ">", "/", "*", "as", "an", "authenticated", "user", "." ]
train
https://github.com/opennode/waldur-core/blob/d6c17a9592bb6c49c33567542eef8d099605a46a/waldur_core/structure/views.py#L1029-L1128
opennode/waldur-core
waldur_core/structure/views.py
ResourceSummaryViewSet.count
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...
python
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", ")", ":", "queryset", "=", "self", ".", "filter_queryset", "(", "self", ".", "get_queryset", "(", ")", ")", "return", "Response", "(", "{", "SupportedServices", ".", "get_name_for_model", "(", "qs", ".", "model"...
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...
[ "Count", "resources", "by", "type", ".", "Example", "output", ":" ]
train
https://github.com/opennode/waldur-core/blob/d6c17a9592bb6c49c33567542eef8d099605a46a/waldur_core/structure/views.py#L1131-L1148
opennode/waldur-core
waldur_core/structure/views.py
ServicesViewSet.list
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...
python
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", ")", ":", "return", "super", "(", "ServicesViewSet", ",", "self", ")", ".", "list", "(", "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
[ "Filter", "services", "by", "type", "^^^^^^^^^^^^^^^^^^^^^^^" ]
train
https://github.com/opennode/waldur-core/blob/d6c17a9592bb6c49c33567542eef8d099605a46a/waldur_core/structure/views.py#L1172-L1181
opennode/waldur-core
waldur_core/structure/views.py
BaseServiceViewSet.list
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...
python
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", ")", ":", "return", "super", "(", "BaseServiceViewSet", ",", "self", ")", ".", "list", "(", "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 used for every service type. To create a service, issu...
[ "To", "list", "all", "services", "without", "regard", "to", "its", "type", "run", "**", "GET", "**", "against", "*", "/", "api", "/", "services", "/", "*", "as", "an", "authenticated", "user", "." ]
train
https://github.com/opennode/waldur-core/blob/d6c17a9592bb6c49c33567542eef8d099605a46a/waldur_core/structure/views.py#L1369-L1413
opennode/waldur-core
waldur_core/structure/views.py
BaseServiceViewSet._require_staff_for_shared_settings
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...
python
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", ")", ":", "if", "obj", "is", "None", ":", "return", "if", "obj", ".", "settings", ".", "shared", "and", "not", "request", ".", "user", ".", "is_staff", ":"...
Allow to execute action only if service settings are not shared or user is staff
[ "Allow", "to", "execute", "action", "only", "if", "service", "settings", "are", "not", "shared", "or", "user", "is", "staff" ]
train
https://github.com/opennode/waldur-core/blob/d6c17a9592bb6c49c33567542eef8d099605a46a/waldur_core/structure/views.py#L1452-L1458
opennode/waldur-core
waldur_core/structure/views.py
BaseServiceViewSet.link
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...
python
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", ")", ":", "service", "=", "self", ".", "get_object", "(", ")", "if", "self", ".", "request", ".", "method", "==", "'GET'", ":", "try", ":", "backend", "=", "self", ".", "get_back...
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...
[ "To", "get", "a", "list", "of", "resources", "available", "for", "import", "run", "**", "GET", "**", "against", "*", "/", "<service_endpoint", ">", "/", "link", "/", "*", "as", "an", "authenticated", "user", ".", "Optionally", "project_uuid", "parameter", ...
train
https://github.com/opennode/waldur-core/blob/d6c17a9592bb6c49c33567542eef8d099605a46a/waldur_core/structure/views.py#L1461-L1515
opennode/waldur-core
waldur_core/structure/views.py
BaseServiceViewSet.unlink
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)
python
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", ")", ":", "service", "=", "self", ".", "get_object", "(", ")", "service", ".", "unlink_descendants", "(", ")", "self", ".", "perform_destroy", "(", "service", ")", "return", "Respons...
Unlink all related resources, service project link and service itself.
[ "Unlink", "all", "related", "resources", "service", "project", "link", "and", "service", "itself", "." ]
train
https://github.com/opennode/waldur-core/blob/d6c17a9592bb6c49c33567542eef8d099605a46a/waldur_core/structure/views.py#L1535-L1543
opennode/waldur-core
waldur_core/structure/views.py
BaseServiceProjectLinkViewSet.list
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_...
python
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", ")", ":", "return", "super", "(", "BaseServiceProjectLinkViewSet", ",", "self", ")", ".", "list", "(", "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_all` flag, project-service connections are created automatical...
[ "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...
train
https://github.com/opennode/waldur-core/blob/d6c17a9592bb6c49c33567542eef8d099605a46a/waldur_core/structure/views.py#L1560-L1570
opennode/waldur-core
waldur_core/structure/views.py
BaseServiceProjectLinkViewSet.retrieve
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)
python
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", ")", ":", "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.
[ "To", "remove", "a", "link", "issue", "**", "DELETE", "**", "to", "URL", "of", "the", "corresponding", "connection", "as", "stuff", "user", "or", "customer", "owner", "." ]
train
https://github.com/opennode/waldur-core/blob/d6c17a9592bb6c49c33567542eef8d099605a46a/waldur_core/structure/views.py#L1572-L1576
opennode/waldur-core
waldur_core/quotas/fields.py
QuotaField.get_aggregator_quotas
def get_aggregator_quotas(self, quota): """ Fetch ancestors quotas that have the same name and are registered as aggregator quotas. """ ancestors = quota.scope.get_quota_ancestors() aggregator_quotas = [] for ancestor in ancestors: for ancestor_quota_field in ancestor.get_quo...
python
def get_aggregator_quotas(self, quota): """ Fetch ancestors quotas that have the same name and are registered as aggregator quotas. """ ancestors = quota.scope.get_quota_ancestors() aggregator_quotas = [] for ancestor in ancestors: for ancestor_quota_field in ancestor.get_quo...
[ "def", "get_aggregator_quotas", "(", "self", ",", "quota", ")", ":", "ancestors", "=", "quota", ".", "scope", ".", "get_quota_ancestors", "(", ")", "aggregator_quotas", "=", "[", "]", "for", "ancestor", "in", "ancestors", ":", "for", "ancestor_quota_field", "i...
Fetch ancestors quotas that have the same name and are registered as aggregator quotas.
[ "Fetch", "ancestors", "quotas", "that", "have", "the", "same", "name", "and", "are", "registered", "as", "aggregator", "quotas", "." ]
train
https://github.com/opennode/waldur-core/blob/d6c17a9592bb6c49c33567542eef8d099605a46a/waldur_core/quotas/fields.py#L122-L130
quora/qcore
qcore/events.py
EventHook.subscribe
def subscribe(self, handler): """Adds a new event handler.""" assert callable(handler), "Invalid handler %s" % handler self.handlers.append(handler)
python
def subscribe(self, handler): """Adds a new event handler.""" assert callable(handler), "Invalid handler %s" % handler self.handlers.append(handler)
[ "def", "subscribe", "(", "self", ",", "handler", ")", ":", "assert", "callable", "(", "handler", ")", ",", "\"Invalid handler %s\"", "%", "handler", "self", ".", "handlers", ".", "append", "(", "handler", ")" ]
Adds a new event handler.
[ "Adds", "a", "new", "event", "handler", "." ]
train
https://github.com/quora/qcore/blob/fa5cd438eea554db35fd29cbc8dfbde69f09961c/qcore/events.py#L46-L49
quora/qcore
qcore/events.py
EventHook.safe_trigger
def safe_trigger(self, *args): """*Safely* triggers the event by invoking all its handlers, even if few of them raise an exception. If a set of exceptions is raised during handler invocation sequence, this method rethrows the first one. :param args: the arguments to invoke even...
python
def safe_trigger(self, *args): """*Safely* triggers the event by invoking all its handlers, even if few of them raise an exception. If a set of exceptions is raised during handler invocation sequence, this method rethrows the first one. :param args: the arguments to invoke even...
[ "def", "safe_trigger", "(", "self", ",", "*", "args", ")", ":", "error", "=", "None", "# iterate over a copy of the original list because some event handlers", "# may mutate the list", "for", "handler", "in", "list", "(", "self", ".", "handlers", ")", ":", "try", ":...
*Safely* triggers the event by invoking all its handlers, even if few of them raise an exception. If a set of exceptions is raised during handler invocation sequence, this method rethrows the first one. :param args: the arguments to invoke event handlers with.
[ "*", "Safely", "*", "triggers", "the", "event", "by", "invoking", "all", "its", "handlers", "even", "if", "few", "of", "them", "raise", "an", "exception", "." ]
train
https://github.com/quora/qcore/blob/fa5cd438eea554db35fd29cbc8dfbde69f09961c/qcore/events.py#L55-L76
quora/qcore
qcore/events.py
EventHub.on
def on(self, event, handler): """Attaches the handler to the specified event. @param event: event to attach the handler to. Any object can be passed as event, but string is preferable. If qcore.EnumBase instance is passed, its name is used as event key. ...
python
def on(self, event, handler): """Attaches the handler to the specified event. @param event: event to attach the handler to. Any object can be passed as event, but string is preferable. If qcore.EnumBase instance is passed, its name is used as event key. ...
[ "def", "on", "(", "self", ",", "event", ",", "handler", ")", ":", "event_hook", "=", "self", ".", "get_or_create", "(", "event", ")", "event_hook", ".", "subscribe", "(", "handler", ")", "return", "self" ]
Attaches the handler to the specified event. @param event: event to attach the handler to. Any object can be passed as event, but string is preferable. If qcore.EnumBase instance is passed, its name is used as event key. @param handler: event handler. ...
[ "Attaches", "the", "handler", "to", "the", "specified", "event", "." ]
train
https://github.com/quora/qcore/blob/fa5cd438eea554db35fd29cbc8dfbde69f09961c/qcore/events.py#L217-L229
quora/qcore
qcore/events.py
EventHub.off
def off(self, event, handler): """Detaches the handler from the specified event. @param event: event to detach the handler to. Any object can be passed as event, but string is preferable. If qcore.EnumBase instance is passed, its name is used as event key. ...
python
def off(self, event, handler): """Detaches the handler from the specified event. @param event: event to detach the handler to. Any object can be passed as event, but string is preferable. If qcore.EnumBase instance is passed, its name is used as event key. ...
[ "def", "off", "(", "self", ",", "event", ",", "handler", ")", ":", "event_hook", "=", "self", ".", "get_or_create", "(", "event", ")", "event_hook", ".", "unsubscribe", "(", "handler", ")", "return", "self" ]
Detaches the handler from the specified event. @param event: event to detach the handler to. Any object can be passed as event, but string is preferable. If qcore.EnumBase instance is passed, its name is used as event key. @param handler: event handler. ...
[ "Detaches", "the", "handler", "from", "the", "specified", "event", "." ]
train
https://github.com/quora/qcore/blob/fa5cd438eea554db35fd29cbc8dfbde69f09961c/qcore/events.py#L231-L243
quora/qcore
qcore/events.py
EventHub.trigger
def trigger(self, event, *args): """Triggers the specified event by invoking EventHook.trigger under the hood. @param event: event to trigger. Any object can be passed as event, but string is preferable. If qcore.EnumBase instance is passed, its name is used ...
python
def trigger(self, event, *args): """Triggers the specified event by invoking EventHook.trigger under the hood. @param event: event to trigger. Any object can be passed as event, but string is preferable. If qcore.EnumBase instance is passed, its name is used ...
[ "def", "trigger", "(", "self", ",", "event", ",", "*", "args", ")", ":", "event_hook", "=", "self", ".", "get_or_create", "(", "event", ")", "event_hook", ".", "trigger", "(", "*", "args", ")", "return", "self" ]
Triggers the specified event by invoking EventHook.trigger under the hood. @param event: event to trigger. Any object can be passed as event, but string is preferable. If qcore.EnumBase instance is passed, its name is used as event key. @param args: event arg...
[ "Triggers", "the", "specified", "event", "by", "invoking", "EventHook", ".", "trigger", "under", "the", "hood", "." ]
train
https://github.com/quora/qcore/blob/fa5cd438eea554db35fd29cbc8dfbde69f09961c/qcore/events.py#L245-L257
quora/qcore
qcore/events.py
EventHub.safe_trigger
def safe_trigger(self, event, *args): """Safely triggers the specified event by invoking EventHook.safe_trigger under the hood. @param event: event to trigger. Any object can be passed as event, but string is preferable. If qcore.EnumBase instance is ...
python
def safe_trigger(self, event, *args): """Safely triggers the specified event by invoking EventHook.safe_trigger under the hood. @param event: event to trigger. Any object can be passed as event, but string is preferable. If qcore.EnumBase instance is ...
[ "def", "safe_trigger", "(", "self", ",", "event", ",", "*", "args", ")", ":", "event_hook", "=", "self", ".", "get_or_create", "(", "event", ")", "event_hook", ".", "safe_trigger", "(", "*", "args", ")", "return", "self" ]
Safely triggers the specified event by invoking EventHook.safe_trigger under the hood. @param event: event to trigger. Any object can be passed as event, but string is preferable. If qcore.EnumBase instance is passed, its name is used as event key. @p...
[ "Safely", "triggers", "the", "specified", "event", "by", "invoking", "EventHook", ".", "safe_trigger", "under", "the", "hood", "." ]
train
https://github.com/quora/qcore/blob/fa5cd438eea554db35fd29cbc8dfbde69f09961c/qcore/events.py#L259-L272
quora/qcore
qcore/events.py
EventHub.get_or_create
def get_or_create(self, event): """Gets or creates a new event hook for the specified event (key). This method treats qcore.EnumBase-typed event keys specially: enum_member.name is used as key instead of enum instance in case such a key is passed. Note that on/off/trigger/safe_...
python
def get_or_create(self, event): """Gets or creates a new event hook for the specified event (key). This method treats qcore.EnumBase-typed event keys specially: enum_member.name is used as key instead of enum instance in case such a key is passed. Note that on/off/trigger/safe_...
[ "def", "get_or_create", "(", "self", ",", "event", ")", ":", "if", "isinstance", "(", "event", ",", "EnumBase", ")", ":", "event", "=", "event", ".", "short_name", "return", "self", ".", "__dict__", ".", "setdefault", "(", "event", ",", "EventHook", "(",...
Gets or creates a new event hook for the specified event (key). This method treats qcore.EnumBase-typed event keys specially: enum_member.name is used as key instead of enum instance in case such a key is passed. Note that on/off/trigger/safe_trigger methods rely on this method, ...
[ "Gets", "or", "creates", "a", "new", "event", "hook", "for", "the", "specified", "event", "(", "key", ")", "." ]
train
https://github.com/quora/qcore/blob/fa5cd438eea554db35fd29cbc8dfbde69f09961c/qcore/events.py#L274-L287
opennode/waldur-core
waldur_core/users/tasks.py
cancel_expired_invitations
def cancel_expired_invitations(invitations=None): """ Invitation lifetime must be specified in Waldur Core settings with parameter "INVITATION_LIFETIME". If invitation creation time is less than expiration time, the invitation will set as expired. """ expiration_date = timezone.now() - settings.WALD...
python
def cancel_expired_invitations(invitations=None): """ Invitation lifetime must be specified in Waldur Core settings with parameter "INVITATION_LIFETIME". If invitation creation time is less than expiration time, the invitation will set as expired. """ expiration_date = timezone.now() - settings.WALD...
[ "def", "cancel_expired_invitations", "(", "invitations", "=", "None", ")", ":", "expiration_date", "=", "timezone", ".", "now", "(", ")", "-", "settings", ".", "WALDUR_CORE", "[", "'INVITATION_LIFETIME'", "]", "if", "not", "invitations", ":", "invitations", "=",...
Invitation lifetime must be specified in Waldur Core settings with parameter "INVITATION_LIFETIME". If invitation creation time is less than expiration time, the invitation will set as expired.
[ "Invitation", "lifetime", "must", "be", "specified", "in", "Waldur", "Core", "settings", "with", "parameter", "INVITATION_LIFETIME", ".", "If", "invitation", "creation", "time", "is", "less", "than", "expiration", "time", "the", "invitation", "will", "set", "as", ...
train
https://github.com/opennode/waldur-core/blob/d6c17a9592bb6c49c33567542eef8d099605a46a/waldur_core/users/tasks.py#L19-L28
tintinweb/ethereum-input-decoder
ethereum_input_decoder/decoder.py
FourByteDirectory.get_pseudo_abi_for_input
def get_pseudo_abi_for_input(s, timeout=None, proxies=None): """ Lookup sighash from 4bytes.directory, create a pseudo api and try to decode it with the parsed abi. May return multiple results as sighashes may collide. :param s: bytes input :return: pseudo abi for method ...
python
def get_pseudo_abi_for_input(s, timeout=None, proxies=None): """ Lookup sighash from 4bytes.directory, create a pseudo api and try to decode it with the parsed abi. May return multiple results as sighashes may collide. :param s: bytes input :return: pseudo abi for method ...
[ "def", "get_pseudo_abi_for_input", "(", "s", ",", "timeout", "=", "None", ",", "proxies", "=", "None", ")", ":", "sighash", "=", "Utils", ".", "bytes_to_str", "(", "s", "[", ":", "4", "]", ")", "for", "pseudo_abi", "in", "FourByteDirectory", ".", "get_ps...
Lookup sighash from 4bytes.directory, create a pseudo api and try to decode it with the parsed abi. May return multiple results as sighashes may collide. :param s: bytes input :return: pseudo abi for method
[ "Lookup", "sighash", "from", "4bytes", ".", "directory", "create", "a", "pseudo", "api", "and", "try", "to", "decode", "it", "with", "the", "parsed", "abi", ".", "May", "return", "multiple", "results", "as", "sighashes", "may", "collide", ".", ":", "param"...
train
https://github.com/tintinweb/ethereum-input-decoder/blob/aa96623e352fe096b6679cc3ea10ef62a260a711/ethereum_input_decoder/decoder.py#L70-L85
tintinweb/ethereum-input-decoder
ethereum_input_decoder/decoder.py
ContractAbi._prepare_abi
def _prepare_abi(self, jsonabi): """ Prepare the contract json abi for sighash lookups and fast access :param jsonabi: contracts abi in json format :return: """ self.signatures = {} for element_description in jsonabi: abi_e = AbiMethod(element_descrip...
python
def _prepare_abi(self, jsonabi): """ Prepare the contract json abi for sighash lookups and fast access :param jsonabi: contracts abi in json format :return: """ self.signatures = {} for element_description in jsonabi: abi_e = AbiMethod(element_descrip...
[ "def", "_prepare_abi", "(", "self", ",", "jsonabi", ")", ":", "self", ".", "signatures", "=", "{", "}", "for", "element_description", "in", "jsonabi", ":", "abi_e", "=", "AbiMethod", "(", "element_description", ")", "if", "abi_e", "[", "\"type\"", "]", "==...
Prepare the contract json abi for sighash lookups and fast access :param jsonabi: contracts abi in json format :return:
[ "Prepare", "the", "contract", "json", "abi", "for", "sighash", "lookups", "and", "fast", "access" ]
train
https://github.com/tintinweb/ethereum-input-decoder/blob/aa96623e352fe096b6679cc3ea10ef62a260a711/ethereum_input_decoder/decoder.py#L101-L125
tintinweb/ethereum-input-decoder
ethereum_input_decoder/decoder.py
ContractAbi.describe_constructor
def describe_constructor(self, s): """ Describe the input bytesequence (constructor arguments) s based on the loaded contract abi definition :param s: bytes constructor arguments :return: AbiMethod instance """ method = self.signatures.get(b"__constructor__") ...
python
def describe_constructor(self, s): """ Describe the input bytesequence (constructor arguments) s based on the loaded contract abi definition :param s: bytes constructor arguments :return: AbiMethod instance """ method = self.signatures.get(b"__constructor__") ...
[ "def", "describe_constructor", "(", "self", ",", "s", ")", ":", "method", "=", "self", ".", "signatures", ".", "get", "(", "b\"__constructor__\"", ")", "if", "not", "method", ":", "# constructor not available", "m", "=", "AbiMethod", "(", "{", "\"type\"", ":...
Describe the input bytesequence (constructor arguments) s based on the loaded contract abi definition :param s: bytes constructor arguments :return: AbiMethod instance
[ "Describe", "the", "input", "bytesequence", "(", "constructor", "arguments", ")", "s", "based", "on", "the", "loaded", "contract", "abi", "definition" ]
train
https://github.com/tintinweb/ethereum-input-decoder/blob/aa96623e352fe096b6679cc3ea10ef62a260a711/ethereum_input_decoder/decoder.py#L127-L153
tintinweb/ethereum-input-decoder
ethereum_input_decoder/decoder.py
ContractAbi.describe_input
def describe_input(self, s): """ Describe the input bytesequence s based on the loaded contract abi definition :param s: bytes input :return: AbiMethod instance """ signatures = self.signatures.items() for sighash, method in signatures: if sighash is...
python
def describe_input(self, s): """ Describe the input bytesequence s based on the loaded contract abi definition :param s: bytes input :return: AbiMethod instance """ signatures = self.signatures.items() for sighash, method in signatures: if sighash is...
[ "def", "describe_input", "(", "self", ",", "s", ")", ":", "signatures", "=", "self", ".", "signatures", ".", "items", "(", ")", "for", "sighash", ",", "method", "in", "signatures", ":", "if", "sighash", "is", "None", "or", "sighash", ".", "startswith", ...
Describe the input bytesequence s based on the loaded contract abi definition :param s: bytes input :return: AbiMethod instance
[ "Describe", "the", "input", "bytesequence", "s", "based", "on", "the", "loaded", "contract", "abi", "definition" ]
train
https://github.com/tintinweb/ethereum-input-decoder/blob/aa96623e352fe096b6679cc3ea10ef62a260a711/ethereum_input_decoder/decoder.py#L155-L197
tintinweb/ethereum-input-decoder
ethereum_input_decoder/decoder.py
AbiMethod.from_input_lookup
def from_input_lookup(s): """ Return a new AbiMethod object from an input stream :param s: binary input :return: new AbiMethod object matching the provided input stream """ for pseudo_abi in FourByteDirectory.get_pseudo_abi_for_input(s): method = AbiMethod(pse...
python
def from_input_lookup(s): """ Return a new AbiMethod object from an input stream :param s: binary input :return: new AbiMethod object matching the provided input stream """ for pseudo_abi in FourByteDirectory.get_pseudo_abi_for_input(s): method = AbiMethod(pse...
[ "def", "from_input_lookup", "(", "s", ")", ":", "for", "pseudo_abi", "in", "FourByteDirectory", ".", "get_pseudo_abi_for_input", "(", "s", ")", ":", "method", "=", "AbiMethod", "(", "pseudo_abi", ")", "types_def", "=", "pseudo_abi", "[", "\"inputs\"", "]", "ty...
Return a new AbiMethod object from an input stream :param s: binary input :return: new AbiMethod object matching the provided input stream
[ "Return", "a", "new", "AbiMethod", "object", "from", "an", "input", "stream", ":", "param", "s", ":", "binary", "input", ":", "return", ":", "new", "AbiMethod", "object", "matching", "the", "provided", "input", "stream" ]
train
https://github.com/tintinweb/ethereum-input-decoder/blob/aa96623e352fe096b6679cc3ea10ef62a260a711/ethereum_input_decoder/decoder.py#L213-L230
quora/qcore
qcore/asserts.py
assert_is
def assert_is(expected, actual, message=None, extra=None): """Raises an AssertionError if expected is not actual.""" assert expected is actual, _assert_fail_message( message, expected, actual, "is not", extra )
python
def assert_is(expected, actual, message=None, extra=None): """Raises an AssertionError if expected is not actual.""" assert expected is actual, _assert_fail_message( message, expected, actual, "is not", extra )
[ "def", "assert_is", "(", "expected", ",", "actual", ",", "message", "=", "None", ",", "extra", "=", "None", ")", ":", "assert", "expected", "is", "actual", ",", "_assert_fail_message", "(", "message", ",", "expected", ",", "actual", ",", "\"is not\"", ",",...
Raises an AssertionError if expected is not actual.
[ "Raises", "an", "AssertionError", "if", "expected", "is", "not", "actual", "." ]
train
https://github.com/quora/qcore/blob/fa5cd438eea554db35fd29cbc8dfbde69f09961c/qcore/asserts.py#L83-L87
quora/qcore
qcore/asserts.py
assert_is_not
def assert_is_not(expected, actual, message=None, extra=None): """Raises an AssertionError if expected is actual.""" assert expected is not actual, _assert_fail_message( message, expected, actual, "is", extra )
python
def assert_is_not(expected, actual, message=None, extra=None): """Raises an AssertionError if expected is actual.""" assert expected is not actual, _assert_fail_message( message, expected, actual, "is", extra )
[ "def", "assert_is_not", "(", "expected", ",", "actual", ",", "message", "=", "None", ",", "extra", "=", "None", ")", ":", "assert", "expected", "is", "not", "actual", ",", "_assert_fail_message", "(", "message", ",", "expected", ",", "actual", ",", "\"is\"...
Raises an AssertionError if expected is actual.
[ "Raises", "an", "AssertionError", "if", "expected", "is", "actual", "." ]
train
https://github.com/quora/qcore/blob/fa5cd438eea554db35fd29cbc8dfbde69f09961c/qcore/asserts.py#L90-L94
quora/qcore
qcore/asserts.py
assert_is_instance
def assert_is_instance(value, types, message=None, extra=None): """Raises an AssertionError if value is not an instance of type(s).""" assert isinstance(value, types), _assert_fail_message( message, value, types, "is not an instance of", extra )
python
def assert_is_instance(value, types, message=None, extra=None): """Raises an AssertionError if value is not an instance of type(s).""" assert isinstance(value, types), _assert_fail_message( message, value, types, "is not an instance of", extra )
[ "def", "assert_is_instance", "(", "value", ",", "types", ",", "message", "=", "None", ",", "extra", "=", "None", ")", ":", "assert", "isinstance", "(", "value", ",", "types", ")", ",", "_assert_fail_message", "(", "message", ",", "value", ",", "types", "...
Raises an AssertionError if value is not an instance of type(s).
[ "Raises", "an", "AssertionError", "if", "value", "is", "not", "an", "instance", "of", "type", "(", "s", ")", "." ]
train
https://github.com/quora/qcore/blob/fa5cd438eea554db35fd29cbc8dfbde69f09961c/qcore/asserts.py#L97-L101
quora/qcore
qcore/asserts.py
assert_eq
def assert_eq(expected, actual, message=None, tolerance=None, extra=None): """Raises an AssertionError if expected != actual. If tolerance is specified, raises an AssertionError if either - expected or actual isn't a number, or - the difference between expected and actual is larger than the tolerance. ...
python
def assert_eq(expected, actual, message=None, tolerance=None, extra=None): """Raises an AssertionError if expected != actual. If tolerance is specified, raises an AssertionError if either - expected or actual isn't a number, or - the difference between expected and actual is larger than the tolerance. ...
[ "def", "assert_eq", "(", "expected", ",", "actual", ",", "message", "=", "None", ",", "tolerance", "=", "None", ",", "extra", "=", "None", ")", ":", "if", "tolerance", "is", "None", ":", "assert", "expected", "==", "actual", ",", "_assert_fail_message", ...
Raises an AssertionError if expected != actual. If tolerance is specified, raises an AssertionError if either - expected or actual isn't a number, or - the difference between expected and actual is larger than the tolerance.
[ "Raises", "an", "AssertionError", "if", "expected", "!", "=", "actual", "." ]
train
https://github.com/quora/qcore/blob/fa5cd438eea554db35fd29cbc8dfbde69f09961c/qcore/asserts.py#L104-L130
quora/qcore
qcore/asserts.py
assert_dict_eq
def assert_dict_eq(expected, actual, number_tolerance=None, dict_path=[]): """Asserts that two dictionaries are equal, producing a custom message if they are not.""" assert_is_instance(expected, dict) assert_is_instance(actual, dict) expected_keys = set(expected.keys()) actual_keys = set(actual.key...
python
def assert_dict_eq(expected, actual, number_tolerance=None, dict_path=[]): """Asserts that two dictionaries are equal, producing a custom message if they are not.""" assert_is_instance(expected, dict) assert_is_instance(actual, dict) expected_keys = set(expected.keys()) actual_keys = set(actual.key...
[ "def", "assert_dict_eq", "(", "expected", ",", "actual", ",", "number_tolerance", "=", "None", ",", "dict_path", "=", "[", "]", ")", ":", "assert_is_instance", "(", "expected", ",", "dict", ")", "assert_is_instance", "(", "actual", ",", "dict", ")", "expecte...
Asserts that two dictionaries are equal, producing a custom message if they are not.
[ "Asserts", "that", "two", "dictionaries", "are", "equal", "producing", "a", "custom", "message", "if", "they", "are", "not", "." ]
train
https://github.com/quora/qcore/blob/fa5cd438eea554db35fd29cbc8dfbde69f09961c/qcore/asserts.py#L139-L187
quora/qcore
qcore/asserts.py
assert_gt
def assert_gt(left, right, message=None, extra=None): """Raises an AssertionError if left_hand <= right_hand.""" assert left > right, _assert_fail_message(message, left, right, "<=", extra)
python
def assert_gt(left, right, message=None, extra=None): """Raises an AssertionError if left_hand <= right_hand.""" assert left > right, _assert_fail_message(message, left, right, "<=", extra)
[ "def", "assert_gt", "(", "left", ",", "right", ",", "message", "=", "None", ",", "extra", "=", "None", ")", ":", "assert", "left", ">", "right", ",", "_assert_fail_message", "(", "message", ",", "left", ",", "right", ",", "\"<=\"", ",", "extra", ")" ]
Raises an AssertionError if left_hand <= right_hand.
[ "Raises", "an", "AssertionError", "if", "left_hand", "<", "=", "right_hand", "." ]
train
https://github.com/quora/qcore/blob/fa5cd438eea554db35fd29cbc8dfbde69f09961c/qcore/asserts.py#L219-L221
quora/qcore
qcore/asserts.py
assert_ge
def assert_ge(left, right, message=None, extra=None): """Raises an AssertionError if left_hand < right_hand.""" assert left >= right, _assert_fail_message(message, left, right, "<", extra)
python
def assert_ge(left, right, message=None, extra=None): """Raises an AssertionError if left_hand < right_hand.""" assert left >= right, _assert_fail_message(message, left, right, "<", extra)
[ "def", "assert_ge", "(", "left", ",", "right", ",", "message", "=", "None", ",", "extra", "=", "None", ")", ":", "assert", "left", ">=", "right", ",", "_assert_fail_message", "(", "message", ",", "left", ",", "right", ",", "\"<\"", ",", "extra", ")" ]
Raises an AssertionError if left_hand < right_hand.
[ "Raises", "an", "AssertionError", "if", "left_hand", "<", "right_hand", "." ]
train
https://github.com/quora/qcore/blob/fa5cd438eea554db35fd29cbc8dfbde69f09961c/qcore/asserts.py#L224-L226
quora/qcore
qcore/asserts.py
assert_lt
def assert_lt(left, right, message=None, extra=None): """Raises an AssertionError if left_hand >= right_hand.""" assert left < right, _assert_fail_message(message, left, right, ">=", extra)
python
def assert_lt(left, right, message=None, extra=None): """Raises an AssertionError if left_hand >= right_hand.""" assert left < right, _assert_fail_message(message, left, right, ">=", extra)
[ "def", "assert_lt", "(", "left", ",", "right", ",", "message", "=", "None", ",", "extra", "=", "None", ")", ":", "assert", "left", "<", "right", ",", "_assert_fail_message", "(", "message", ",", "left", ",", "right", ",", "\">=\"", ",", "extra", ")" ]
Raises an AssertionError if left_hand >= right_hand.
[ "Raises", "an", "AssertionError", "if", "left_hand", ">", "=", "right_hand", "." ]
train
https://github.com/quora/qcore/blob/fa5cd438eea554db35fd29cbc8dfbde69f09961c/qcore/asserts.py#L229-L231
quora/qcore
qcore/asserts.py
assert_le
def assert_le(left, right, message=None, extra=None): """Raises an AssertionError if left_hand > right_hand.""" assert left <= right, _assert_fail_message(message, left, right, ">", extra)
python
def assert_le(left, right, message=None, extra=None): """Raises an AssertionError if left_hand > right_hand.""" assert left <= right, _assert_fail_message(message, left, right, ">", extra)
[ "def", "assert_le", "(", "left", ",", "right", ",", "message", "=", "None", ",", "extra", "=", "None", ")", ":", "assert", "left", "<=", "right", ",", "_assert_fail_message", "(", "message", ",", "left", ",", "right", ",", "\">\"", ",", "extra", ")" ]
Raises an AssertionError if left_hand > right_hand.
[ "Raises", "an", "AssertionError", "if", "left_hand", ">", "right_hand", "." ]
train
https://github.com/quora/qcore/blob/fa5cd438eea554db35fd29cbc8dfbde69f09961c/qcore/asserts.py#L234-L236
quora/qcore
qcore/asserts.py
assert_in
def assert_in(obj, seq, message=None, extra=None): """Raises an AssertionError if obj is not in seq.""" assert obj in seq, _assert_fail_message(message, obj, seq, "is not in", extra)
python
def assert_in(obj, seq, message=None, extra=None): """Raises an AssertionError if obj is not in seq.""" assert obj in seq, _assert_fail_message(message, obj, seq, "is not in", extra)
[ "def", "assert_in", "(", "obj", ",", "seq", ",", "message", "=", "None", ",", "extra", "=", "None", ")", ":", "assert", "obj", "in", "seq", ",", "_assert_fail_message", "(", "message", ",", "obj", ",", "seq", ",", "\"is not in\"", ",", "extra", ")" ]
Raises an AssertionError if obj is not in seq.
[ "Raises", "an", "AssertionError", "if", "obj", "is", "not", "in", "seq", "." ]
train
https://github.com/quora/qcore/blob/fa5cd438eea554db35fd29cbc8dfbde69f09961c/qcore/asserts.py#L239-L241
quora/qcore
qcore/asserts.py
assert_not_in
def assert_not_in(obj, seq, message=None, extra=None): """Raises an AssertionError if obj is in iter.""" # for very long strings, provide a truncated error if isinstance(seq, six.string_types) and obj in seq and len(seq) > 200: index = seq.find(obj) start_index = index - 50 if start_...
python
def assert_not_in(obj, seq, message=None, extra=None): """Raises an AssertionError if obj is in iter.""" # for very long strings, provide a truncated error if isinstance(seq, six.string_types) and obj in seq and len(seq) > 200: index = seq.find(obj) start_index = index - 50 if start_...
[ "def", "assert_not_in", "(", "obj", ",", "seq", ",", "message", "=", "None", ",", "extra", "=", "None", ")", ":", "# for very long strings, provide a truncated error", "if", "isinstance", "(", "seq", ",", "six", ".", "string_types", ")", "and", "obj", "in", ...
Raises an AssertionError if obj is in iter.
[ "Raises", "an", "AssertionError", "if", "obj", "is", "in", "iter", "." ]
train
https://github.com/quora/qcore/blob/fa5cd438eea554db35fd29cbc8dfbde69f09961c/qcore/asserts.py#L244-L260
quora/qcore
qcore/asserts.py
assert_in_with_tolerance
def assert_in_with_tolerance(obj, seq, tolerance, message=None, extra=None): """Raises an AssertionError if obj is not in seq using assert_eq cmp.""" for i in seq: try: assert_eq(obj, i, tolerance=tolerance, message=message, extra=extra) return except AssertionError: ...
python
def assert_in_with_tolerance(obj, seq, tolerance, message=None, extra=None): """Raises an AssertionError if obj is not in seq using assert_eq cmp.""" for i in seq: try: assert_eq(obj, i, tolerance=tolerance, message=message, extra=extra) return except AssertionError: ...
[ "def", "assert_in_with_tolerance", "(", "obj", ",", "seq", ",", "tolerance", ",", "message", "=", "None", ",", "extra", "=", "None", ")", ":", "for", "i", "in", "seq", ":", "try", ":", "assert_eq", "(", "obj", ",", "i", ",", "tolerance", "=", "tolera...
Raises an AssertionError if obj is not in seq using assert_eq cmp.
[ "Raises", "an", "AssertionError", "if", "obj", "is", "not", "in", "seq", "using", "assert_eq", "cmp", "." ]
train
https://github.com/quora/qcore/blob/fa5cd438eea554db35fd29cbc8dfbde69f09961c/qcore/asserts.py#L263-L271
quora/qcore
qcore/asserts.py
assert_is_substring
def assert_is_substring(substring, subject, message=None, extra=None): """Raises an AssertionError if substring is not a substring of subject.""" assert ( (subject is not None) and (substring is not None) and (subject.find(substring) != -1) ), _assert_fail_message(message, substring,...
python
def assert_is_substring(substring, subject, message=None, extra=None): """Raises an AssertionError if substring is not a substring of subject.""" assert ( (subject is not None) and (substring is not None) and (subject.find(substring) != -1) ), _assert_fail_message(message, substring,...
[ "def", "assert_is_substring", "(", "substring", ",", "subject", ",", "message", "=", "None", ",", "extra", "=", "None", ")", ":", "assert", "(", "(", "subject", "is", "not", "None", ")", "and", "(", "substring", "is", "not", "None", ")", "and", "(", ...
Raises an AssertionError if substring is not a substring of subject.
[ "Raises", "an", "AssertionError", "if", "substring", "is", "not", "a", "substring", "of", "subject", "." ]
train
https://github.com/quora/qcore/blob/fa5cd438eea554db35fd29cbc8dfbde69f09961c/qcore/asserts.py#L274-L280
quora/qcore
qcore/asserts.py
assert_is_not_substring
def assert_is_not_substring(substring, subject, message=None, extra=None): """Raises an AssertionError if substring is a substring of subject.""" assert ( (subject is not None) and (substring is not None) and (subject.find(substring) == -1) ), _assert_fail_message(message, substring,...
python
def assert_is_not_substring(substring, subject, message=None, extra=None): """Raises an AssertionError if substring is a substring of subject.""" assert ( (subject is not None) and (substring is not None) and (subject.find(substring) == -1) ), _assert_fail_message(message, substring,...
[ "def", "assert_is_not_substring", "(", "substring", ",", "subject", ",", "message", "=", "None", ",", "extra", "=", "None", ")", ":", "assert", "(", "(", "subject", "is", "not", "None", ")", "and", "(", "substring", "is", "not", "None", ")", "and", "("...
Raises an AssertionError if substring is a substring of subject.
[ "Raises", "an", "AssertionError", "if", "substring", "is", "a", "substring", "of", "subject", "." ]
train
https://github.com/quora/qcore/blob/fa5cd438eea554db35fd29cbc8dfbde69f09961c/qcore/asserts.py#L283-L289
quora/qcore
qcore/asserts.py
assert_unordered_list_eq
def assert_unordered_list_eq(expected, actual, message=None): """Raises an AssertionError if the objects contained in expected are not equal to the objects contained in actual without regard to their order. This takes quadratic time in the umber of elements in actual; don't use it for very long lists....
python
def assert_unordered_list_eq(expected, actual, message=None): """Raises an AssertionError if the objects contained in expected are not equal to the objects contained in actual without regard to their order. This takes quadratic time in the umber of elements in actual; don't use it for very long lists....
[ "def", "assert_unordered_list_eq", "(", "expected", ",", "actual", ",", "message", "=", "None", ")", ":", "missing_in_actual", "=", "[", "]", "missing_in_expected", "=", "list", "(", "actual", ")", "for", "x", "in", "expected", ":", "try", ":", "missing_in_e...
Raises an AssertionError if the objects contained in expected are not equal to the objects contained in actual without regard to their order. This takes quadratic time in the umber of elements in actual; don't use it for very long lists.
[ "Raises", "an", "AssertionError", "if", "the", "objects", "contained", "in", "expected", "are", "not", "equal", "to", "the", "objects", "contained", "in", "actual", "without", "regard", "to", "their", "order", "." ]
train
https://github.com/quora/qcore/blob/fa5cd438eea554db35fd29cbc8dfbde69f09961c/qcore/asserts.py#L292-L314
opennode/waldur-core
waldur_core/logging/elasticsearch_client.py
_execute_if_not_empty
def _execute_if_not_empty(func): """ Execute function only if one of input parameters is not empty """ def wrapper(*args, **kwargs): if any(args[1:]) or any(kwargs.items()): return func(*args, **kwargs) return wrapper
python
def _execute_if_not_empty(func): """ Execute function only if one of input parameters is not empty """ def wrapper(*args, **kwargs): if any(args[1:]) or any(kwargs.items()): return func(*args, **kwargs) return wrapper
[ "def", "_execute_if_not_empty", "(", "func", ")", ":", "def", "wrapper", "(", "*", "args", ",", "*", "*", "kwargs", ")", ":", "if", "any", "(", "args", "[", "1", ":", "]", ")", "or", "any", "(", "kwargs", ".", "items", "(", ")", ")", ":", "retu...
Execute function only if one of input parameters is not empty
[ "Execute", "function", "only", "if", "one", "of", "input", "parameters", "is", "not", "empty" ]
train
https://github.com/opennode/waldur-core/blob/d6c17a9592bb6c49c33567542eef8d099605a46a/waldur_core/logging/elasticsearch_client.py#L89-L94
opennode/waldur-core
waldur_core/logging/elasticsearch_client.py
ElasticsearchClient.prepare_search_body
def prepare_search_body(self, should_terms=None, must_terms=None, must_not_terms=None, search_text='', start=None, end=None): """ Prepare body for elasticsearch query Search parameters ^^^^^^^^^^^^^^^^^ These parameters are dictionaries and have format: <term>: [<value 1>, <val...
python
def prepare_search_body(self, should_terms=None, must_terms=None, must_not_terms=None, search_text='', start=None, end=None): """ Prepare body for elasticsearch query Search parameters ^^^^^^^^^^^^^^^^^ These parameters are dictionaries and have format: <term>: [<value 1>, <val...
[ "def", "prepare_search_body", "(", "self", ",", "should_terms", "=", "None", ",", "must_terms", "=", "None", ",", "must_not_terms", "=", "None", ",", "search_text", "=", "''", ",", "start", "=", "None", ",", "end", "=", "None", ")", ":", "self", ".", "...
Prepare body for elasticsearch query Search parameters ^^^^^^^^^^^^^^^^^ These parameters are dictionaries and have format: <term>: [<value 1>, <value 2> ...] should_terms: it resembles logical OR must_terms: it resembles logical AND must_not_terms: it resembles logical...
[ "Prepare", "body", "for", "elasticsearch", "query" ]
train
https://github.com/opennode/waldur-core/blob/d6c17a9592bb6c49c33567542eef8d099605a46a/waldur_core/logging/elasticsearch_client.py#L227-L249
opennode/waldur-core
waldur_core/core/executors.py
BaseExecutor.execute
def execute(cls, instance, async=True, countdown=2, is_heavy_task=False, **kwargs): """ Execute high level-operation """ cls.pre_apply(instance, async=async, **kwargs) result = cls.apply_signature(instance, async=async, countdown=countdown, is_heavy_task=is_h...
python
def execute(cls, instance, async=True, countdown=2, is_heavy_task=False, **kwargs): """ Execute high level-operation """ cls.pre_apply(instance, async=async, **kwargs) result = cls.apply_signature(instance, async=async, countdown=countdown, is_heavy_task=is_h...
[ "def", "execute", "(", "cls", ",", "instance", ",", "async", "=", "True", ",", "countdown", "=", "2", ",", "is_heavy_task", "=", "False", ",", "*", "*", "kwargs", ")", ":", "cls", ".", "pre_apply", "(", "instance", ",", "async", "=", "async", ",", ...
Execute high level-operation
[ "Execute", "high", "level", "-", "operation" ]
train
https://github.com/opennode/waldur-core/blob/d6c17a9592bb6c49c33567542eef8d099605a46a/waldur_core/core/executors.py#L40-L46
opennode/waldur-core
waldur_core/core/executors.py
BaseExecutor.apply_signature
def apply_signature(cls, instance, async=True, countdown=None, is_heavy_task=False, **kwargs): """ Serialize input data and apply signature """ serialized_instance = utils.serialize_instance(instance) signature = cls.get_task_signature(instance, serialized_instance, **kwargs) link = cls...
python
def apply_signature(cls, instance, async=True, countdown=None, is_heavy_task=False, **kwargs): """ Serialize input data and apply signature """ serialized_instance = utils.serialize_instance(instance) signature = cls.get_task_signature(instance, serialized_instance, **kwargs) link = cls...
[ "def", "apply_signature", "(", "cls", ",", "instance", ",", "async", "=", "True", ",", "countdown", "=", "None", ",", "is_heavy_task", "=", "False", ",", "*", "*", "kwargs", ")", ":", "serialized_instance", "=", "utils", ".", "serialize_instance", "(", "in...
Serialize input data and apply signature
[ "Serialize", "input", "data", "and", "apply", "signature" ]
train
https://github.com/opennode/waldur-core/blob/d6c17a9592bb6c49c33567542eef8d099605a46a/waldur_core/core/executors.py#L59-L76
opennode/waldur-core
waldur_core/core/executors.py
BaseExecutor._apply_callback
def _apply_callback(cls, callback, result): """ Synchronously execute callback """ if not callback.immutable: callback.args = (result.id, ) + callback.args callback.apply()
python
def _apply_callback(cls, callback, result): """ Synchronously execute callback """ if not callback.immutable: callback.args = (result.id, ) + callback.args callback.apply()
[ "def", "_apply_callback", "(", "cls", ",", "callback", ",", "result", ")", ":", "if", "not", "callback", ".", "immutable", ":", "callback", ".", "args", "=", "(", "result", ".", "id", ",", ")", "+", "callback", ".", "args", "callback", ".", "apply", ...
Synchronously execute callback
[ "Synchronously", "execute", "callback" ]
train
https://github.com/opennode/waldur-core/blob/d6c17a9592bb6c49c33567542eef8d099605a46a/waldur_core/core/executors.py#L79-L83
opennode/waldur-core
waldur_core/core/schemas.py
get_entity_description
def get_entity_description(entity): """ Returns description in format: * entity human readable name * docstring """ try: entity_name = entity.__name__.strip('_') except AttributeError: # entity is a class instance entity_name = entity.__class__.__name__ label =...
python
def get_entity_description(entity): """ Returns description in format: * entity human readable name * docstring """ try: entity_name = entity.__name__.strip('_') except AttributeError: # entity is a class instance entity_name = entity.__class__.__name__ label =...
[ "def", "get_entity_description", "(", "entity", ")", ":", "try", ":", "entity_name", "=", "entity", ".", "__name__", ".", "strip", "(", "'_'", ")", "except", "AttributeError", ":", "# entity is a class instance", "entity_name", "=", "entity", ".", "__class__", "...
Returns description in format: * entity human readable name * docstring
[ "Returns", "description", "in", "format", ":", "*", "entity", "human", "readable", "name", "*", "docstring" ]
train
https://github.com/opennode/waldur-core/blob/d6c17a9592bb6c49c33567542eef8d099605a46a/waldur_core/core/schemas.py#L37-L55
opennode/waldur-core
waldur_core/core/schemas.py
get_validators_description
def get_validators_description(view): """ Returns validators description in format: ### Validators: * validator1 name * validator1 docstring * validator2 name * validator2 docstring """ action = getattr(view, 'action', None) if action is None: return '' description...
python
def get_validators_description(view): """ Returns validators description in format: ### Validators: * validator1 name * validator1 docstring * validator2 name * validator2 docstring """ action = getattr(view, 'action', None) if action is None: return '' description...
[ "def", "get_validators_description", "(", "view", ")", ":", "action", "=", "getattr", "(", "view", ",", "'action'", ",", "None", ")", "if", "action", "is", "None", ":", "return", "''", "description", "=", "''", "validators", "=", "getattr", "(", "view", ...
Returns validators description in format: ### Validators: * validator1 name * validator1 docstring * validator2 name * validator2 docstring
[ "Returns", "validators", "description", "in", "format", ":", "###", "Validators", ":", "*", "validator1", "name", "*", "validator1", "docstring", "*", "validator2", "name", "*", "validator2", "docstring" ]
train
https://github.com/opennode/waldur-core/blob/d6c17a9592bb6c49c33567542eef8d099605a46a/waldur_core/core/schemas.py#L58-L77
opennode/waldur-core
waldur_core/core/schemas.py
get_actions_permission_description
def get_actions_permission_description(view, method): """ Returns actions permissions description in format: * permission1 name * permission1 docstring * permission2 name * permission2 docstring """ action = getattr(view, 'action', None) if action is None: return '' if...
python
def get_actions_permission_description(view, method): """ Returns actions permissions description in format: * permission1 name * permission1 docstring * permission2 name * permission2 docstring """ action = getattr(view, 'action', None) if action is None: return '' if...
[ "def", "get_actions_permission_description", "(", "view", ",", "method", ")", ":", "action", "=", "getattr", "(", "view", ",", "'action'", ",", "None", ")", "if", "action", "is", "None", ":", "return", "''", "if", "hasattr", "(", "view", ",", "action", "...
Returns actions permissions description in format: * permission1 name * permission1 docstring * permission2 name * permission2 docstring
[ "Returns", "actions", "permissions", "description", "in", "format", ":", "*", "permission1", "name", "*", "permission1", "docstring", "*", "permission2", "name", "*", "permission2", "docstring" ]
train
https://github.com/opennode/waldur-core/blob/d6c17a9592bb6c49c33567542eef8d099605a46a/waldur_core/core/schemas.py#L80-L106
opennode/waldur-core
waldur_core/core/schemas.py
get_permissions_description
def get_permissions_description(view, method): """ Returns permissions description in format: ### Permissions: * permission1 name * permission1 docstring * permission2 name * permission2 docstring """ if not hasattr(view, 'permission_classes'): return '' description = ...
python
def get_permissions_description(view, method): """ Returns permissions description in format: ### Permissions: * permission1 name * permission1 docstring * permission2 name * permission2 docstring """ if not hasattr(view, 'permission_classes'): return '' description = ...
[ "def", "get_permissions_description", "(", "view", ",", "method", ")", ":", "if", "not", "hasattr", "(", "view", ",", "'permission_classes'", ")", ":", "return", "''", "description", "=", "''", "for", "permission_class", "in", "view", ".", "permission_classes", ...
Returns permissions description in format: ### Permissions: * permission1 name * permission1 docstring * permission2 name * permission2 docstring
[ "Returns", "permissions", "description", "in", "format", ":", "###", "Permissions", ":", "*", "permission1", "name", "*", "permission1", "docstring", "*", "permission2", "name", "*", "permission2", "docstring" ]
train
https://github.com/opennode/waldur-core/blob/d6c17a9592bb6c49c33567542eef8d099605a46a/waldur_core/core/schemas.py#L109-L131
opennode/waldur-core
waldur_core/core/schemas.py
get_validation_description
def get_validation_description(view, method): """ Returns validation description in format: ### Validation: validate method docstring * field1 name * field1 validation docstring * field2 name * field2 validation docstring """ if method not in ('PUT', 'PATCH', 'POST') or not has...
python
def get_validation_description(view, method): """ Returns validation description in format: ### Validation: validate method docstring * field1 name * field1 validation docstring * field2 name * field2 validation docstring """ if method not in ('PUT', 'PATCH', 'POST') or not has...
[ "def", "get_validation_description", "(", "view", ",", "method", ")", ":", "if", "method", "not", "in", "(", "'PUT'", ",", "'PATCH'", ",", "'POST'", ")", "or", "not", "hasattr", "(", "view", ",", "'get_serializer'", ")", ":", "return", "''", "serializer", ...
Returns validation description in format: ### Validation: validate method docstring * field1 name * field1 validation docstring * field2 name * field2 validation docstring
[ "Returns", "validation", "description", "in", "format", ":", "###", "Validation", ":", "validate", "method", "docstring", "*", "field1", "name", "*", "field1", "validation", "docstring", "*", "field2", "name", "*", "field2", "validation", "docstring" ]
train
https://github.com/opennode/waldur-core/blob/d6c17a9592bb6c49c33567542eef8d099605a46a/waldur_core/core/schemas.py#L134-L163
opennode/waldur-core
waldur_core/core/schemas.py
get_field_type
def get_field_type(field): """ Returns field type/possible values. """ if isinstance(field, core_filters.MappedMultipleChoiceFilter): return ' | '.join(['"%s"' % f for f in sorted(field.mapped_to_model)]) if isinstance(field, OrderingFilter) or isinstance(field, ChoiceFilter): return...
python
def get_field_type(field): """ Returns field type/possible values. """ if isinstance(field, core_filters.MappedMultipleChoiceFilter): return ' | '.join(['"%s"' % f for f in sorted(field.mapped_to_model)]) if isinstance(field, OrderingFilter) or isinstance(field, ChoiceFilter): return...
[ "def", "get_field_type", "(", "field", ")", ":", "if", "isinstance", "(", "field", ",", "core_filters", ".", "MappedMultipleChoiceFilter", ")", ":", "return", "' | '", ".", "join", "(", "[", "'\"%s\"'", "%", "f", "for", "f", "in", "sorted", "(", "field", ...
Returns field type/possible values.
[ "Returns", "field", "type", "/", "possible", "values", "." ]
train
https://github.com/opennode/waldur-core/blob/d6c17a9592bb6c49c33567542eef8d099605a46a/waldur_core/core/schemas.py#L185-L233
opennode/waldur-core
waldur_core/core/schemas.py
is_disabled_action
def is_disabled_action(view): """ Checks whether Link action is disabled. """ if not isinstance(view, core_views.ActionsViewSet): return False action = getattr(view, 'action', None) return action in view.disabled_actions if action is not None else False
python
def is_disabled_action(view): """ Checks whether Link action is disabled. """ if not isinstance(view, core_views.ActionsViewSet): return False action = getattr(view, 'action', None) return action in view.disabled_actions if action is not None else False
[ "def", "is_disabled_action", "(", "view", ")", ":", "if", "not", "isinstance", "(", "view", ",", "core_views", ".", "ActionsViewSet", ")", ":", "return", "False", "action", "=", "getattr", "(", "view", ",", "'action'", ",", "None", ")", "return", "action",...
Checks whether Link action is disabled.
[ "Checks", "whether", "Link", "action", "is", "disabled", "." ]
train
https://github.com/opennode/waldur-core/blob/d6c17a9592bb6c49c33567542eef8d099605a46a/waldur_core/core/schemas.py#L236-L244
opennode/waldur-core
waldur_core/core/schemas.py
WaldurEndpointInspector.get_allowed_methods
def get_allowed_methods(self, callback): """ Return a list of the valid HTTP methods for this endpoint. """ if hasattr(callback, 'actions'): return [method.upper() for method in callback.actions.keys() if method != 'head'] return [ method for method in ...
python
def get_allowed_methods(self, callback): """ Return a list of the valid HTTP methods for this endpoint. """ if hasattr(callback, 'actions'): return [method.upper() for method in callback.actions.keys() if method != 'head'] return [ method for method in ...
[ "def", "get_allowed_methods", "(", "self", ",", "callback", ")", ":", "if", "hasattr", "(", "callback", ",", "'actions'", ")", ":", "return", "[", "method", ".", "upper", "(", ")", "for", "method", "in", "callback", ".", "actions", ".", "keys", "(", ")...
Return a list of the valid HTTP methods for this endpoint.
[ "Return", "a", "list", "of", "the", "valid", "HTTP", "methods", "for", "this", "endpoint", "." ]
train
https://github.com/opennode/waldur-core/blob/d6c17a9592bb6c49c33567542eef8d099605a46a/waldur_core/core/schemas.py#L24-L34
opennode/waldur-core
waldur_core/core/schemas.py
WaldurSchemaGenerator.create_view
def create_view(self, callback, method, request=None): """ Given a callback, return an actual view instance. """ view = super(WaldurSchemaGenerator, self).create_view(callback, method, request) if is_disabled_action(view): view.exclude_from_schema = True retu...
python
def create_view(self, callback, method, request=None): """ Given a callback, return an actual view instance. """ view = super(WaldurSchemaGenerator, self).create_view(callback, method, request) if is_disabled_action(view): view.exclude_from_schema = True retu...
[ "def", "create_view", "(", "self", ",", "callback", ",", "method", ",", "request", "=", "None", ")", ":", "view", "=", "super", "(", "WaldurSchemaGenerator", ",", "self", ")", ".", "create_view", "(", "callback", ",", "method", ",", "request", ")", "if",...
Given a callback, return an actual view instance.
[ "Given", "a", "callback", "return", "an", "actual", "view", "instance", "." ]
train
https://github.com/opennode/waldur-core/blob/d6c17a9592bb6c49c33567542eef8d099605a46a/waldur_core/core/schemas.py#L250-L258
opennode/waldur-core
waldur_core/core/schemas.py
WaldurSchemaGenerator.get_description
def get_description(self, path, method, view): """ Determine a link description. This will be based on the method docstring if one exists, or else the class docstring. """ description = super(WaldurSchemaGenerator, self).get_description(path, method, view) permi...
python
def get_description(self, path, method, view): """ Determine a link description. This will be based on the method docstring if one exists, or else the class docstring. """ description = super(WaldurSchemaGenerator, self).get_description(path, method, view) permi...
[ "def", "get_description", "(", "self", ",", "path", ",", "method", ",", "view", ")", ":", "description", "=", "super", "(", "WaldurSchemaGenerator", ",", "self", ")", ".", "get_description", "(", "path", ",", "method", ",", "view", ")", "permissions_descript...
Determine a link description. This will be based on the method docstring if one exists, or else the class docstring.
[ "Determine", "a", "link", "description", "." ]
train
https://github.com/opennode/waldur-core/blob/d6c17a9592bb6c49c33567542eef8d099605a46a/waldur_core/core/schemas.py#L260-L282
opennode/waldur-core
waldur_core/core/schemas.py
WaldurSchemaGenerator.get_serializer_fields
def get_serializer_fields(self, path, method, view): """ Return a list of `coreapi.Field` instances corresponding to any request body input, as determined by the serializer class. """ if method not in ('PUT', 'PATCH', 'POST'): return [] if not hasattr(view, '...
python
def get_serializer_fields(self, path, method, view): """ Return a list of `coreapi.Field` instances corresponding to any request body input, as determined by the serializer class. """ if method not in ('PUT', 'PATCH', 'POST'): return [] if not hasattr(view, '...
[ "def", "get_serializer_fields", "(", "self", ",", "path", ",", "method", ",", "view", ")", ":", "if", "method", "not", "in", "(", "'PUT'", ",", "'PATCH'", ",", "'POST'", ")", ":", "return", "[", "]", "if", "not", "hasattr", "(", "view", ",", "'get_se...
Return a list of `coreapi.Field` instances corresponding to any request body input, as determined by the serializer class.
[ "Return", "a", "list", "of", "coreapi", ".", "Field", "instances", "corresponding", "to", "any", "request", "body", "input", "as", "determined", "by", "the", "serializer", "class", "." ]
train
https://github.com/opennode/waldur-core/blob/d6c17a9592bb6c49c33567542eef8d099605a46a/waldur_core/core/schemas.py#L315-L348
opennode/waldur-core
waldur_core/core/handlers.py
delete_error_message
def delete_error_message(sender, instance, name, source, target, **kwargs): """ Delete error message if instance state changed from erred """ if source != StateMixin.States.ERRED: return instance.error_message = '' instance.save(update_fields=['error_message'])
python
def delete_error_message(sender, instance, name, source, target, **kwargs): """ Delete error message if instance state changed from erred """ if source != StateMixin.States.ERRED: return instance.error_message = '' instance.save(update_fields=['error_message'])
[ "def", "delete_error_message", "(", "sender", ",", "instance", ",", "name", ",", "source", ",", "target", ",", "*", "*", "kwargs", ")", ":", "if", "source", "!=", "StateMixin", ".", "States", ".", "ERRED", ":", "return", "instance", ".", "error_message", ...
Delete error message if instance state changed from erred
[ "Delete", "error", "message", "if", "instance", "state", "changed", "from", "erred" ]
train
https://github.com/opennode/waldur-core/blob/d6c17a9592bb6c49c33567542eef8d099605a46a/waldur_core/core/handlers.py#L31-L36
zeromake/aiosqlite3
setup.py
find_version
def find_version(*file_paths): """ read __init__.py """ file_path = os.path.join(*file_paths) with open(file_path, 'r') as version_file: line = version_file.readline() while line: if line.startswith('__version__'): version_match = re.search( ...
python
def find_version(*file_paths): """ read __init__.py """ file_path = os.path.join(*file_paths) with open(file_path, 'r') as version_file: line = version_file.readline() while line: if line.startswith('__version__'): version_match = re.search( ...
[ "def", "find_version", "(", "*", "file_paths", ")", ":", "file_path", "=", "os", ".", "path", ".", "join", "(", "*", "file_paths", ")", "with", "open", "(", "file_path", ",", "'r'", ")", "as", "version_file", ":", "line", "=", "version_file", ".", "rea...
read __init__.py
[ "read", "__init__", ".", "py" ]
train
https://github.com/zeromake/aiosqlite3/blob/1a74a062507e2df8f833a70885e69dca0ab3e7e7/setup.py#L25-L42
quora/qcore
qcore/debug.py
trace
def trace(enter=False, exit=True): """ This decorator prints entry and exit message when the decorated method is called, as well as call arguments, result and thrown exception (if any). :param enter: indicates whether entry message should be printed. :param exit: indicates whether exit message ...
python
def trace(enter=False, exit=True): """ This decorator prints entry and exit message when the decorated method is called, as well as call arguments, result and thrown exception (if any). :param enter: indicates whether entry message should be printed. :param exit: indicates whether exit message ...
[ "def", "trace", "(", "enter", "=", "False", ",", "exit", "=", "True", ")", ":", "def", "decorate", "(", "fn", ")", ":", "@", "inspection", ".", "wraps", "(", "fn", ")", "def", "new_fn", "(", "*", "args", ",", "*", "*", "kwargs", ")", ":", "name...
This decorator prints entry and exit message when the decorated method is called, as well as call arguments, result and thrown exception (if any). :param enter: indicates whether entry message should be printed. :param exit: indicates whether exit message should be printed. :return: decorated funct...
[ "This", "decorator", "prints", "entry", "and", "exit", "message", "when", "the", "decorated", "method", "is", "called", "as", "well", "as", "call", "arguments", "result", "and", "thrown", "exception", "(", "if", "any", ")", "." ]
train
https://github.com/quora/qcore/blob/fa5cd438eea554db35fd29cbc8dfbde69f09961c/qcore/debug.py#L33-L71
quora/qcore
qcore/enum.py
EnumType._make_value
def _make_value(self, value): """Instantiates an enum with an arbitrary value.""" member = self.__new__(self, value) member.__init__(value) return member
python
def _make_value(self, value): """Instantiates an enum with an arbitrary value.""" member = self.__new__(self, value) member.__init__(value) return member
[ "def", "_make_value", "(", "self", ",", "value", ")", ":", "member", "=", "self", ".", "__new__", "(", "self", ",", "value", ")", "member", ".", "__init__", "(", "value", ")", "return", "member" ]
Instantiates an enum with an arbitrary value.
[ "Instantiates", "an", "enum", "with", "an", "arbitrary", "value", "." ]
train
https://github.com/quora/qcore/blob/fa5cd438eea554db35fd29cbc8dfbde69f09961c/qcore/enum.py#L89-L93
quora/qcore
qcore/enum.py
EnumBase.create
def create(cls, name, members): """Creates a new enum type based on this one (cls) and adds newly passed members to the newly created subclass of cls. This method helps to create enums having the same member values as values of other enum(s). :param name: name of the newly crea...
python
def create(cls, name, members): """Creates a new enum type based on this one (cls) and adds newly passed members to the newly created subclass of cls. This method helps to create enums having the same member values as values of other enum(s). :param name: name of the newly crea...
[ "def", "create", "(", "cls", ",", "name", ",", "members", ")", ":", "NewEnum", "=", "type", "(", "name", ",", "(", "cls", ",", ")", ",", "{", "}", ")", "if", "isinstance", "(", "members", ",", "dict", ")", ":", "members", "=", "members", ".", "...
Creates a new enum type based on this one (cls) and adds newly passed members to the newly created subclass of cls. This method helps to create enums having the same member values as values of other enum(s). :param name: name of the newly created type :param members: 1) a dict ...
[ "Creates", "a", "new", "enum", "type", "based", "on", "this", "one", "(", "cls", ")", "and", "adds", "newly", "passed", "members", "to", "the", "newly", "created", "subclass", "of", "cls", "." ]
train
https://github.com/quora/qcore/blob/fa5cd438eea554db35fd29cbc8dfbde69f09961c/qcore/enum.py#L175-L214
quora/qcore
qcore/enum.py
Enum.parse
def parse(cls, value, default=_no_default): """Parses an enum member name or value into an enum member. Accepts the following types: - Members of this enum class. These are returned directly. - Integers. If there is an enum member with the integer as a value, that member is returned. ...
python
def parse(cls, value, default=_no_default): """Parses an enum member name or value into an enum member. Accepts the following types: - Members of this enum class. These are returned directly. - Integers. If there is an enum member with the integer as a value, that member is returned. ...
[ "def", "parse", "(", "cls", ",", "value", ",", "default", "=", "_no_default", ")", ":", "if", "isinstance", "(", "value", ",", "cls", ")", ":", "return", "value", "elif", "isinstance", "(", "value", ",", "six", ".", "integer_types", ")", "and", "not", ...
Parses an enum member name or value into an enum member. Accepts the following types: - Members of this enum class. These are returned directly. - Integers. If there is an enum member with the integer as a value, that member is returned. - Strings. If there is an enum member with the st...
[ "Parses", "an", "enum", "member", "name", "or", "value", "into", "an", "enum", "member", "." ]
train
https://github.com/quora/qcore/blob/fa5cd438eea554db35fd29cbc8dfbde69f09961c/qcore/enum.py#L239-L272
quora/qcore
qcore/enum.py
Flags.parse
def parse(cls, value, default=_no_default): """Parses a flag integer or string into a Flags instance. Accepts the following types: - Members of this enum class. These are returned directly. - Integers. These are converted directly into a Flags instance with the given name. - Str...
python
def parse(cls, value, default=_no_default): """Parses a flag integer or string into a Flags instance. Accepts the following types: - Members of this enum class. These are returned directly. - Integers. These are converted directly into a Flags instance with the given name. - Str...
[ "def", "parse", "(", "cls", ",", "value", ",", "default", "=", "_no_default", ")", ":", "if", "isinstance", "(", "value", ",", "cls", ")", ":", "return", "value", "elif", "isinstance", "(", "value", ",", "int", ")", ":", "e", "=", "cls", ".", "_mak...
Parses a flag integer or string into a Flags instance. Accepts the following types: - Members of this enum class. These are returned directly. - Integers. These are converted directly into a Flags instance with the given name. - Strings. The function accepts a comma-delimited list of fl...
[ "Parses", "a", "flag", "integer", "or", "string", "into", "a", "Flags", "instance", "." ]
train
https://github.com/quora/qcore/blob/fa5cd438eea554db35fd29cbc8dfbde69f09961c/qcore/enum.py#L300-L344
opennode/waldur-core
waldur_core/cost_tracking/views.py
PriceEstimateViewSet.list
def list(self, request, *args, **kwargs): """ To get a list of price estimates, run **GET** against */api/price-estimates/* as authenticated user. You can filter price estimates by scope type, scope URL, customer UUID. `scope_type` is generic type of object for which price estimate is c...
python
def list(self, request, *args, **kwargs): """ To get a list of price estimates, run **GET** against */api/price-estimates/* as authenticated user. You can filter price estimates by scope type, scope URL, customer UUID. `scope_type` is generic type of object for which price estimate is c...
[ "def", "list", "(", "self", ",", "request", ",", "*", "args", ",", "*", "*", "kwargs", ")", ":", "return", "super", "(", "PriceEstimateViewSet", ",", "self", ")", ".", "list", "(", "request", ",", "*", "args", ",", "*", "*", "kwargs", ")" ]
To get a list of price estimates, run **GET** against */api/price-estimates/* as authenticated user. You can filter price estimates by scope type, scope URL, customer UUID. `scope_type` is generic type of object for which price estimate is calculated. Currently there are following types: custom...
[ "To", "get", "a", "list", "of", "price", "estimates", "run", "**", "GET", "**", "against", "*", "/", "api", "/", "price", "-", "estimates", "/", "*", "as", "authenticated", "user", ".", "You", "can", "filter", "price", "estimates", "by", "scope", "type...
train
https://github.com/opennode/waldur-core/blob/d6c17a9592bb6c49c33567542eef8d099605a46a/waldur_core/cost_tracking/views.py#L40-L54
opennode/waldur-core
waldur_core/cost_tracking/views.py
PriceListItemViewSet.list
def list(self, request, *args, **kwargs): """ To get a list of price list items, run **GET** against */api/price-list-items/* as an authenticated user. """ return super(PriceListItemViewSet, self).list(request, *args, **kwargs)
python
def list(self, request, *args, **kwargs): """ To get a list of price list items, run **GET** against */api/price-list-items/* as an authenticated user. """ return super(PriceListItemViewSet, self).list(request, *args, **kwargs)
[ "def", "list", "(", "self", ",", "request", ",", "*", "args", ",", "*", "*", "kwargs", ")", ":", "return", "super", "(", "PriceListItemViewSet", ",", "self", ")", ".", "list", "(", "request", ",", "*", "args", ",", "*", "*", "kwargs", ")" ]
To get a list of price list items, run **GET** against */api/price-list-items/* as an authenticated user.
[ "To", "get", "a", "list", "of", "price", "list", "items", "run", "**", "GET", "**", "against", "*", "/", "api", "/", "price", "-", "list", "-", "items", "/", "*", "as", "an", "authenticated", "user", "." ]
train
https://github.com/opennode/waldur-core/blob/d6c17a9592bb6c49c33567542eef8d099605a46a/waldur_core/cost_tracking/views.py#L73-L77