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
rfosterslo/wagtailplus
wagtailplus/wagtailrelations/models.py
EntryManager.get_for_tag
def get_for_tag(self, tag): """ Returns queryset of Entry instances assigned to specified tag, which can be a PK value, a slug value, or a Tag instance. :param tag: tag PK, slug, or instance. :rtype: django.db.models.query.QuerySet. """ tag_filter = {'tag': tag} ...
python
def get_for_tag(self, tag): """ Returns queryset of Entry instances assigned to specified tag, which can be a PK value, a slug value, or a Tag instance. :param tag: tag PK, slug, or instance. :rtype: django.db.models.query.QuerySet. """ tag_filter = {'tag': tag} ...
[ "def", "get_for_tag", "(", "self", ",", "tag", ")", ":", "tag_filter", "=", "{", "'tag'", ":", "tag", "}", "if", "isinstance", "(", "tag", ",", "six", ".", "integer_types", ")", ":", "tag_filter", "=", "{", "'tag_id'", ":", "tag", "}", "elif", "isins...
Returns queryset of Entry instances assigned to specified tag, which can be a PK value, a slug value, or a Tag instance. :param tag: tag PK, slug, or instance. :rtype: django.db.models.query.QuerySet.
[ "Returns", "queryset", "of", "Entry", "instances", "assigned", "to", "specified", "tag", "which", "can", "be", "a", "PK", "value", "a", "slug", "value", "or", "a", "Tag", "instance", "." ]
train
https://github.com/rfosterslo/wagtailplus/blob/22cac857175d8a6f77e470751831c14a92ccd768/wagtailplus/wagtailrelations/models.py#L132-L151
rfosterslo/wagtailplus
wagtailplus/wagtailrelations/models.py
EntryTagManager.for_category
def for_category(self, category, live_only=False): """ Returns queryset of EntryTag instances for specified category. :param category: the Category instance. :param live_only: flag to include only "live" entries. :rtype: django.db.models.query.QuerySet. """ filte...
python
def for_category(self, category, live_only=False): """ Returns queryset of EntryTag instances for specified category. :param category: the Category instance. :param live_only: flag to include only "live" entries. :rtype: django.db.models.query.QuerySet. """ filte...
[ "def", "for_category", "(", "self", ",", "category", ",", "live_only", "=", "False", ")", ":", "filters", "=", "{", "'tag'", ":", "category", ".", "tag", "}", "if", "live_only", ":", "filters", ".", "update", "(", "{", "'entry__live'", ":", "True", "}"...
Returns queryset of EntryTag instances for specified category. :param category: the Category instance. :param live_only: flag to include only "live" entries. :rtype: django.db.models.query.QuerySet.
[ "Returns", "queryset", "of", "EntryTag", "instances", "for", "specified", "category", "." ]
train
https://github.com/rfosterslo/wagtailplus/blob/22cac857175d8a6f77e470751831c14a92ccd768/wagtailplus/wagtailrelations/models.py#L343-L356
rfosterslo/wagtailplus
wagtailplus/wagtailrelations/models.py
EntryTagManager.related_to
def related_to(self, entry, live_only=False): """ Returns queryset of Entry instances related to specified Entry instance. :param entry: the Entry instance. :param live_only: flag to include only "live" entries. :rtype: django.db.models.query.QuerySet. """ ...
python
def related_to(self, entry, live_only=False): """ Returns queryset of Entry instances related to specified Entry instance. :param entry: the Entry instance. :param live_only: flag to include only "live" entries. :rtype: django.db.models.query.QuerySet. """ ...
[ "def", "related_to", "(", "self", ",", "entry", ",", "live_only", "=", "False", ")", ":", "filters", "=", "{", "'tag__in'", ":", "entry", ".", "tags", "}", "if", "live_only", ":", "filters", ".", "update", "(", "{", "'entry__live'", ":", "True", "}", ...
Returns queryset of Entry instances related to specified Entry instance. :param entry: the Entry instance. :param live_only: flag to include only "live" entries. :rtype: django.db.models.query.QuerySet.
[ "Returns", "queryset", "of", "Entry", "instances", "related", "to", "specified", "Entry", "instance", "." ]
train
https://github.com/rfosterslo/wagtailplus/blob/22cac857175d8a6f77e470751831c14a92ccd768/wagtailplus/wagtailrelations/models.py#L365-L379
rfosterslo/wagtailplus
wagtailplus/utils/views/chooser.py
chosen_view_factory
def chosen_view_factory(chooser_cls): """ Returns a ChosenView class that extends specified chooser class. :param chooser_cls: the class to extend. :rtype: class. """ class ChosenView(chooser_cls): #noinspection PyUnusedLocal def get(self, request, *args, **kwargs): ...
python
def chosen_view_factory(chooser_cls): """ Returns a ChosenView class that extends specified chooser class. :param chooser_cls: the class to extend. :rtype: class. """ class ChosenView(chooser_cls): #noinspection PyUnusedLocal def get(self, request, *args, **kwargs): ...
[ "def", "chosen_view_factory", "(", "chooser_cls", ")", ":", "class", "ChosenView", "(", "chooser_cls", ")", ":", "#noinspection PyUnusedLocal", "def", "get", "(", "self", ",", "request", ",", "*", "args", ",", "*", "*", "kwargs", ")", ":", "\"\"\"\n ...
Returns a ChosenView class that extends specified chooser class. :param chooser_cls: the class to extend. :rtype: class.
[ "Returns", "a", "ChosenView", "class", "that", "extends", "specified", "chooser", "class", "." ]
train
https://github.com/rfosterslo/wagtailplus/blob/22cac857175d8a6f77e470751831c14a92ccd768/wagtailplus/utils/views/chooser.py#L163-L215
rfosterslo/wagtailplus
wagtailplus/utils/views/chooser.py
ChooserView.form_invalid
def form_invalid(self, form): """ Processes an invalid form submittal. :param form: the form instance. :rtype: django.http.HttpResponse. """ context = self.get_context_data(form=form) #noinspection PyUnresolvedReferences return render_modal_workflow( ...
python
def form_invalid(self, form): """ Processes an invalid form submittal. :param form: the form instance. :rtype: django.http.HttpResponse. """ context = self.get_context_data(form=form) #noinspection PyUnresolvedReferences return render_modal_workflow( ...
[ "def", "form_invalid", "(", "self", ",", "form", ")", ":", "context", "=", "self", ".", "get_context_data", "(", "form", "=", "form", ")", "#noinspection PyUnresolvedReferences", "return", "render_modal_workflow", "(", "self", ".", "request", ",", "'{0}/chooser.ht...
Processes an invalid form submittal. :param form: the form instance. :rtype: django.http.HttpResponse.
[ "Processes", "an", "invalid", "form", "submittal", "." ]
train
https://github.com/rfosterslo/wagtailplus/blob/22cac857175d8a6f77e470751831c14a92ccd768/wagtailplus/utils/views/chooser.py#L20-L35
rfosterslo/wagtailplus
wagtailplus/utils/views/chooser.py
ChooserView.form_valid
def form_valid(self, form): """ Processes a valid form submittal. :param form: the form instance. :rtype: django.http.HttpResponse. """ #noinspection PyAttributeOutsideInit self.object = form.save() # Index the link. for backend in get_search_bac...
python
def form_valid(self, form): """ Processes a valid form submittal. :param form: the form instance. :rtype: django.http.HttpResponse. """ #noinspection PyAttributeOutsideInit self.object = form.save() # Index the link. for backend in get_search_bac...
[ "def", "form_valid", "(", "self", ",", "form", ")", ":", "#noinspection PyAttributeOutsideInit", "self", ".", "object", "=", "form", ".", "save", "(", ")", "# Index the link.", "for", "backend", "in", "get_search_backends", "(", ")", ":", "backend", ".", "add"...
Processes a valid form submittal. :param form: the form instance. :rtype: django.http.HttpResponse.
[ "Processes", "a", "valid", "form", "submittal", "." ]
train
https://github.com/rfosterslo/wagtailplus/blob/22cac857175d8a6f77e470751831c14a92ccd768/wagtailplus/utils/views/chooser.py#L37-L57
rfosterslo/wagtailplus
wagtailplus/utils/views/chooser.py
ChooserView.get
def get(self, request, *args, **kwargs): """ Returns GET response. :param request: the request instance. :rtype: django.http.HttpResponse. """ #noinspection PyAttributeOutsideInit self.object_list = self.get_queryset() context = self.get_co...
python
def get(self, request, *args, **kwargs): """ Returns GET response. :param request: the request instance. :rtype: django.http.HttpResponse. """ #noinspection PyAttributeOutsideInit self.object_list = self.get_queryset() context = self.get_co...
[ "def", "get", "(", "self", ",", "request", ",", "*", "args", ",", "*", "*", "kwargs", ")", ":", "#noinspection PyAttributeOutsideInit", "self", ".", "object_list", "=", "self", ".", "get_queryset", "(", ")", "context", "=", "self", ".", "get_context_data", ...
Returns GET response. :param request: the request instance. :rtype: django.http.HttpResponse.
[ "Returns", "GET", "response", "." ]
train
https://github.com/rfosterslo/wagtailplus/blob/22cac857175d8a6f77e470751831c14a92ccd768/wagtailplus/utils/views/chooser.py#L59-L85
rfosterslo/wagtailplus
wagtailplus/utils/views/chooser.py
ChooserView.get_form_kwargs
def get_form_kwargs(self): """ Returns the keyword arguments for instantiating the form. :rtype: dict. """ kwargs = { 'initial': self.get_initial(), 'prefix': self.get_prefix(), } #noinspection PyUnresolvedReferences if self.re...
python
def get_form_kwargs(self): """ Returns the keyword arguments for instantiating the form. :rtype: dict. """ kwargs = { 'initial': self.get_initial(), 'prefix': self.get_prefix(), } #noinspection PyUnresolvedReferences if self.re...
[ "def", "get_form_kwargs", "(", "self", ")", ":", "kwargs", "=", "{", "'initial'", ":", "self", ".", "get_initial", "(", ")", ",", "'prefix'", ":", "self", ".", "get_prefix", "(", ")", ",", "}", "#noinspection PyUnresolvedReferences", "if", "self", ".", "re...
Returns the keyword arguments for instantiating the form. :rtype: dict.
[ "Returns", "the", "keyword", "arguments", "for", "instantiating", "the", "form", "." ]
train
https://github.com/rfosterslo/wagtailplus/blob/22cac857175d8a6f77e470751831c14a92ccd768/wagtailplus/utils/views/chooser.py#L106-L128
rfosterslo/wagtailplus
wagtailplus/wagtailrelations/signals/handlers.py
create_entry_tag
def create_entry_tag(sender, instance, created, **kwargs): """ Creates EntryTag for Entry corresponding to specified ItemBase instance. :param sender: the sending ItemBase class. :param instance: the ItemBase instance. """ from ..models import ( Entry, EntryTag ) en...
python
def create_entry_tag(sender, instance, created, **kwargs): """ Creates EntryTag for Entry corresponding to specified ItemBase instance. :param sender: the sending ItemBase class. :param instance: the ItemBase instance. """ from ..models import ( Entry, EntryTag ) en...
[ "def", "create_entry_tag", "(", "sender", ",", "instance", ",", "created", ",", "*", "*", "kwargs", ")", ":", "from", ".", ".", "models", "import", "(", "Entry", ",", "EntryTag", ")", "entry", "=", "Entry", ".", "objects", ".", "get_for_model", "(", "i...
Creates EntryTag for Entry corresponding to specified ItemBase instance. :param sender: the sending ItemBase class. :param instance: the ItemBase instance.
[ "Creates", "EntryTag", "for", "Entry", "corresponding", "to", "specified", "ItemBase", "instance", "." ]
train
https://github.com/rfosterslo/wagtailplus/blob/22cac857175d8a6f77e470751831c14a92ccd768/wagtailplus/wagtailrelations/signals/handlers.py#L11-L28
rfosterslo/wagtailplus
wagtailplus/wagtailrelations/signals/handlers.py
delete_entry_tag
def delete_entry_tag(sender, instance, **kwargs): """ Deletes EntryTag for Entry corresponding to specified TaggedItemBase instance. :param sender: the sending TaggedItemBase class. :param instance: the TaggedItemBase instance. """ from ..models import ( Entry, EntryTag ...
python
def delete_entry_tag(sender, instance, **kwargs): """ Deletes EntryTag for Entry corresponding to specified TaggedItemBase instance. :param sender: the sending TaggedItemBase class. :param instance: the TaggedItemBase instance. """ from ..models import ( Entry, EntryTag ...
[ "def", "delete_entry_tag", "(", "sender", ",", "instance", ",", "*", "*", "kwargs", ")", ":", "from", ".", ".", "models", "import", "(", "Entry", ",", "EntryTag", ")", "entry", "=", "Entry", ".", "objects", ".", "get_for_model", "(", "instance", ".", "...
Deletes EntryTag for Entry corresponding to specified TaggedItemBase instance. :param sender: the sending TaggedItemBase class. :param instance: the TaggedItemBase instance.
[ "Deletes", "EntryTag", "for", "Entry", "corresponding", "to", "specified", "TaggedItemBase", "instance", "." ]
train
https://github.com/rfosterslo/wagtailplus/blob/22cac857175d8a6f77e470751831c14a92ccd768/wagtailplus/wagtailrelations/signals/handlers.py#L31-L47
rfosterslo/wagtailplus
wagtailplus/wagtailrelations/signals/handlers.py
delete_entry
def delete_entry(sender, instance, **kwargs): """ Deletes Entry instance corresponding to specified instance. :param sender: the sending class. :param instance: the instance being deleted. """ from ..models import Entry Entry.objects.get_for_model(instance)[0].delete()
python
def delete_entry(sender, instance, **kwargs): """ Deletes Entry instance corresponding to specified instance. :param sender: the sending class. :param instance: the instance being deleted. """ from ..models import Entry Entry.objects.get_for_model(instance)[0].delete()
[ "def", "delete_entry", "(", "sender", ",", "instance", ",", "*", "*", "kwargs", ")", ":", "from", ".", ".", "models", "import", "Entry", "Entry", ".", "objects", ".", "get_for_model", "(", "instance", ")", "[", "0", "]", ".", "delete", "(", ")" ]
Deletes Entry instance corresponding to specified instance. :param sender: the sending class. :param instance: the instance being deleted.
[ "Deletes", "Entry", "instance", "corresponding", "to", "specified", "instance", "." ]
train
https://github.com/rfosterslo/wagtailplus/blob/22cac857175d8a6f77e470751831c14a92ccd768/wagtailplus/wagtailrelations/signals/handlers.py#L50-L59
rfosterslo/wagtailplus
wagtailplus/wagtailrelations/signals/handlers.py
update_entry_attributes
def update_entry_attributes(sender, instance, **kwargs): """ Updates attributes for Entry instance corresponding to specified instance. :param sender: the sending class. :param instance: the instance being saved. """ from ..models import Entry entry = Entry.objects.get_for_model(instan...
python
def update_entry_attributes(sender, instance, **kwargs): """ Updates attributes for Entry instance corresponding to specified instance. :param sender: the sending class. :param instance: the instance being saved. """ from ..models import Entry entry = Entry.objects.get_for_model(instan...
[ "def", "update_entry_attributes", "(", "sender", ",", "instance", ",", "*", "*", "kwargs", ")", ":", "from", ".", ".", "models", "import", "Entry", "entry", "=", "Entry", ".", "objects", ".", "get_for_model", "(", "instance", ")", "[", "0", "]", "default...
Updates attributes for Entry instance corresponding to specified instance. :param sender: the sending class. :param instance: the instance being saved.
[ "Updates", "attributes", "for", "Entry", "instance", "corresponding", "to", "specified", "instance", "." ]
train
https://github.com/rfosterslo/wagtailplus/blob/22cac857175d8a6f77e470751831c14a92ccd768/wagtailplus/wagtailrelations/signals/handlers.py#L62-L79
rfosterslo/wagtailplus
wagtailplus/wagtailrollbacks/views.py
get_revisions
def get_revisions(page, page_num=1): """ Returns paginated queryset of PageRevision instances for specified Page instance. :param page: the page instance. :param page_num: the pagination page number. :rtype: django.db.models.query.QuerySet. """ revisions = page.revisions.order_by('-cr...
python
def get_revisions(page, page_num=1): """ Returns paginated queryset of PageRevision instances for specified Page instance. :param page: the page instance. :param page_num: the pagination page number. :rtype: django.db.models.query.QuerySet. """ revisions = page.revisions.order_by('-cr...
[ "def", "get_revisions", "(", "page", ",", "page_num", "=", "1", ")", ":", "revisions", "=", "page", ".", "revisions", ".", "order_by", "(", "'-created_at'", ")", "current", "=", "page", ".", "get_latest_revision", "(", ")", "if", "current", ":", "revisions...
Returns paginated queryset of PageRevision instances for specified Page instance. :param page: the page instance. :param page_num: the pagination page number. :rtype: django.db.models.query.QuerySet.
[ "Returns", "paginated", "queryset", "of", "PageRevision", "instances", "for", "specified", "Page", "instance", "." ]
train
https://github.com/rfosterslo/wagtailplus/blob/22cac857175d8a6f77e470751831c14a92ccd768/wagtailplus/wagtailrollbacks/views.py#L27-L51
rfosterslo/wagtailplus
wagtailplus/wagtailrollbacks/views.py
page_revisions
def page_revisions(request, page_id, template_name='wagtailrollbacks/edit_handlers/revisions.html'): """ Returns GET response for specified page revisions. :param request: the request instance. :param page_id: the page ID. :param template_name: the template name. :rtype: django.http.HttpRespons...
python
def page_revisions(request, page_id, template_name='wagtailrollbacks/edit_handlers/revisions.html'): """ Returns GET response for specified page revisions. :param request: the request instance. :param page_id: the page ID. :param template_name: the template name. :rtype: django.http.HttpRespons...
[ "def", "page_revisions", "(", "request", ",", "page_id", ",", "template_name", "=", "'wagtailrollbacks/edit_handlers/revisions.html'", ")", ":", "page", "=", "get_object_or_404", "(", "Page", ",", "pk", "=", "page_id", ")", "page_perms", "=", "page", ".", "permiss...
Returns GET response for specified page revisions. :param request: the request instance. :param page_id: the page ID. :param template_name: the template name. :rtype: django.http.HttpResponse.
[ "Returns", "GET", "response", "for", "specified", "page", "revisions", "." ]
train
https://github.com/rfosterslo/wagtailplus/blob/22cac857175d8a6f77e470751831c14a92ccd768/wagtailplus/wagtailrollbacks/views.py#L53-L79
rfosterslo/wagtailplus
wagtailplus/wagtailrollbacks/views.py
preview_page_version
def preview_page_version(request, revision_id): """ Returns GET response for specified page preview. :param request: the request instance. :param reversion_pk: the page revision ID. :rtype: django.http.HttpResponse. """ revision = get_object_or_404(PageRevision, pk=revision_id) if not ...
python
def preview_page_version(request, revision_id): """ Returns GET response for specified page preview. :param request: the request instance. :param reversion_pk: the page revision ID. :rtype: django.http.HttpResponse. """ revision = get_object_or_404(PageRevision, pk=revision_id) if not ...
[ "def", "preview_page_version", "(", "request", ",", "revision_id", ")", ":", "revision", "=", "get_object_or_404", "(", "PageRevision", ",", "pk", "=", "revision_id", ")", "if", "not", "revision", ".", "page", ".", "permissions_for_user", "(", "request", ".", ...
Returns GET response for specified page preview. :param request: the request instance. :param reversion_pk: the page revision ID. :rtype: django.http.HttpResponse.
[ "Returns", "GET", "response", "for", "specified", "page", "preview", "." ]
train
https://github.com/rfosterslo/wagtailplus/blob/22cac857175d8a6f77e470751831c14a92ccd768/wagtailplus/wagtailrollbacks/views.py#L81-L97
rfosterslo/wagtailplus
wagtailplus/wagtailrollbacks/views.py
confirm_page_reversion
def confirm_page_reversion(request, revision_id, template_name='wagtailrollbacks/pages/confirm_reversion.html'): """ Handles page reversion process (GET and POST). :param request: the request instance. :param revision_id: the page revision ID. :param template_name: the template name. :rtype: dj...
python
def confirm_page_reversion(request, revision_id, template_name='wagtailrollbacks/pages/confirm_reversion.html'): """ Handles page reversion process (GET and POST). :param request: the request instance. :param revision_id: the page revision ID. :param template_name: the template name. :rtype: dj...
[ "def", "confirm_page_reversion", "(", "request", ",", "revision_id", ",", "template_name", "=", "'wagtailrollbacks/pages/confirm_reversion.html'", ")", ":", "revision", "=", "get_object_or_404", "(", "PageRevision", ",", "pk", "=", "revision_id", ")", "page", "=", "re...
Handles page reversion process (GET and POST). :param request: the request instance. :param revision_id: the page revision ID. :param template_name: the template name. :rtype: django.http.HttpResponse.
[ "Handles", "page", "reversion", "process", "(", "GET", "and", "POST", ")", "." ]
train
https://github.com/rfosterslo/wagtailplus/blob/22cac857175d8a6f77e470751831c14a92ccd768/wagtailplus/wagtailrollbacks/views.py#L99-L176
jaraco/keyrings.alt
keyrings/alt/Google.py
DocsKeyring.get_password
def get_password(self, service, username): """Get password of the username for the service """ result = self._get_entry(self._keyring, service, username) if result: result = self._decrypt(result) return result
python
def get_password(self, service, username): """Get password of the username for the service """ result = self._get_entry(self._keyring, service, username) if result: result = self._decrypt(result) return result
[ "def", "get_password", "(", "self", ",", "service", ",", "username", ")", ":", "result", "=", "self", ".", "_get_entry", "(", "self", ".", "_keyring", ",", "service", ",", "username", ")", "if", "result", ":", "result", "=", "self", ".", "_decrypt", "(...
Get password of the username for the service
[ "Get", "password", "of", "the", "username", "for", "the", "service" ]
train
https://github.com/jaraco/keyrings.alt/blob/5b71223d12bf9ac6abd05b1b395f1efccb5ea660/keyrings/alt/Google.py#L85-L91
jaraco/keyrings.alt
keyrings/alt/Google.py
DocsKeyring.set_password
def set_password(self, service, username, password): """Set password for the username of the service """ password = self._encrypt(password or '') keyring_working_copy = copy.deepcopy(self._keyring) service_entries = keyring_working_copy.get(service) if not service_entries...
python
def set_password(self, service, username, password): """Set password for the username of the service """ password = self._encrypt(password or '') keyring_working_copy = copy.deepcopy(self._keyring) service_entries = keyring_working_copy.get(service) if not service_entries...
[ "def", "set_password", "(", "self", ",", "service", ",", "username", ",", "password", ")", ":", "password", "=", "self", ".", "_encrypt", "(", "password", "or", "''", ")", "keyring_working_copy", "=", "copy", ".", "deepcopy", "(", "self", ".", "_keyring", ...
Set password for the username of the service
[ "Set", "password", "for", "the", "username", "of", "the", "service" ]
train
https://github.com/jaraco/keyrings.alt/blob/5b71223d12bf9ac6abd05b1b395f1efccb5ea660/keyrings/alt/Google.py#L93-L137
jaraco/keyrings.alt
keyrings/alt/Google.py
DocsKeyring._save_keyring
def _save_keyring(self, keyring_dict): """Helper to actually write the keyring to Google""" import gdata result = self.OK file_contents = base64.urlsafe_b64encode(pickle.dumps(keyring_dict)) try: if self.docs_entry: extra_headers = {'Content-Type': 'te...
python
def _save_keyring(self, keyring_dict): """Helper to actually write the keyring to Google""" import gdata result = self.OK file_contents = base64.urlsafe_b64encode(pickle.dumps(keyring_dict)) try: if self.docs_entry: extra_headers = {'Content-Type': 'te...
[ "def", "_save_keyring", "(", "self", ",", "keyring_dict", ")", ":", "import", "gdata", "result", "=", "self", ".", "OK", "file_contents", "=", "base64", ".", "urlsafe_b64encode", "(", "pickle", ".", "dumps", "(", "keyring_dict", ")", ")", "try", ":", "if",...
Helper to actually write the keyring to Google
[ "Helper", "to", "actually", "write", "the", "keyring", "to", "Google" ]
train
https://github.com/jaraco/keyrings.alt/blob/5b71223d12bf9ac6abd05b1b395f1efccb5ea660/keyrings/alt/Google.py#L247-L306
Boudewijn26/gTTS-token
gtts_token/gtts_token.py
Token.calculate_token
def calculate_token(self, text, seed=None): """ Calculate the request token (`tk`) of a string :param text: str The text to calculate a token for :param seed: str The seed to use. By default this is the number of hours since epoch """ if seed is None: seed = self._ge...
python
def calculate_token(self, text, seed=None): """ Calculate the request token (`tk`) of a string :param text: str The text to calculate a token for :param seed: str The seed to use. By default this is the number of hours since epoch """ if seed is None: seed = self._ge...
[ "def", "calculate_token", "(", "self", ",", "text", ",", "seed", "=", "None", ")", ":", "if", "seed", "is", "None", ":", "seed", "=", "self", ".", "_get_token_key", "(", ")", "[", "first_seed", ",", "second_seed", "]", "=", "seed", ".", "split", "(",...
Calculate the request token (`tk`) of a string :param text: str The text to calculate a token for :param seed: str The seed to use. By default this is the number of hours since epoch
[ "Calculate", "the", "request", "token", "(", "tk", ")", "of", "a", "string", ":", "param", "text", ":", "str", "The", "text", "to", "calculate", "a", "token", "for", ":", "param", "seed", ":", "str", "The", "seed", "to", "use", ".", "By", "default", ...
train
https://github.com/Boudewijn26/gTTS-token/blob/9a1bb569bcce1ec091bfd9586dd54f9c879e7d3c/gtts_token/gtts_token.py#L21-L49
paddycarey/dweepy
dweepy/api.py
_request
def _request(method, url, session=None, **kwargs): """Make HTTP request, raising an exception if it fails. """ url = BASE_URL + url if session: request_func = getattr(session, method) else: request_func = getattr(requests, method) response = request_func(url, **kwargs) # rai...
python
def _request(method, url, session=None, **kwargs): """Make HTTP request, raising an exception if it fails. """ url = BASE_URL + url if session: request_func = getattr(session, method) else: request_func = getattr(requests, method) response = request_func(url, **kwargs) # rai...
[ "def", "_request", "(", "method", ",", "url", ",", "session", "=", "None", ",", "*", "*", "kwargs", ")", ":", "url", "=", "BASE_URL", "+", "url", "if", "session", ":", "request_func", "=", "getattr", "(", "session", ",", "method", ")", "else", ":", ...
Make HTTP request, raising an exception if it fails.
[ "Make", "HTTP", "request", "raising", "an", "exception", "if", "it", "fails", "." ]
train
https://github.com/paddycarey/dweepy/blob/1eb69de4a20c929c57be2a21e2aa39ae9a0ae298/dweepy/api.py#L29-L45
paddycarey/dweepy
dweepy/api.py
_send_dweet
def _send_dweet(payload, url, params=None, session=None): """Send a dweet to dweet.io """ data = json.dumps(payload) headers = {'Content-type': 'application/json'} return _request('post', url, data=data, headers=headers, params=params, session=session)
python
def _send_dweet(payload, url, params=None, session=None): """Send a dweet to dweet.io """ data = json.dumps(payload) headers = {'Content-type': 'application/json'} return _request('post', url, data=data, headers=headers, params=params, session=session)
[ "def", "_send_dweet", "(", "payload", ",", "url", ",", "params", "=", "None", ",", "session", "=", "None", ")", ":", "data", "=", "json", ".", "dumps", "(", "payload", ")", "headers", "=", "{", "'Content-type'", ":", "'application/json'", "}", "return", ...
Send a dweet to dweet.io
[ "Send", "a", "dweet", "to", "dweet", ".", "io" ]
train
https://github.com/paddycarey/dweepy/blob/1eb69de4a20c929c57be2a21e2aa39ae9a0ae298/dweepy/api.py#L48-L53
paddycarey/dweepy
dweepy/api.py
dweet_for
def dweet_for(thing_name, payload, key=None, session=None): """Send a dweet to dweet.io for a thing with a known name """ if key is not None: params = {'key': key} else: params = None return _send_dweet(payload, '/dweet/for/{0}'.format(thing_name), params=params, session=session)
python
def dweet_for(thing_name, payload, key=None, session=None): """Send a dweet to dweet.io for a thing with a known name """ if key is not None: params = {'key': key} else: params = None return _send_dweet(payload, '/dweet/for/{0}'.format(thing_name), params=params, session=session)
[ "def", "dweet_for", "(", "thing_name", ",", "payload", ",", "key", "=", "None", ",", "session", "=", "None", ")", ":", "if", "key", "is", "not", "None", ":", "params", "=", "{", "'key'", ":", "key", "}", "else", ":", "params", "=", "None", "return"...
Send a dweet to dweet.io for a thing with a known name
[ "Send", "a", "dweet", "to", "dweet", ".", "io", "for", "a", "thing", "with", "a", "known", "name" ]
train
https://github.com/paddycarey/dweepy/blob/1eb69de4a20c929c57be2a21e2aa39ae9a0ae298/dweepy/api.py#L62-L69
paddycarey/dweepy
dweepy/api.py
get_dweets_for
def get_dweets_for(thing_name, key=None, session=None): """Read all the dweets for a dweeter """ if key is not None: params = {'key': key} else: params = None return _request('get', '/get/dweets/for/{0}'.format(thing_name), params=params, session=None)
python
def get_dweets_for(thing_name, key=None, session=None): """Read all the dweets for a dweeter """ if key is not None: params = {'key': key} else: params = None return _request('get', '/get/dweets/for/{0}'.format(thing_name), params=params, session=None)
[ "def", "get_dweets_for", "(", "thing_name", ",", "key", "=", "None", ",", "session", "=", "None", ")", ":", "if", "key", "is", "not", "None", ":", "params", "=", "{", "'key'", ":", "key", "}", "else", ":", "params", "=", "None", "return", "_request",...
Read all the dweets for a dweeter
[ "Read", "all", "the", "dweets", "for", "a", "dweeter" ]
train
https://github.com/paddycarey/dweepy/blob/1eb69de4a20c929c57be2a21e2aa39ae9a0ae298/dweepy/api.py#L82-L89
paddycarey/dweepy
dweepy/api.py
remove_lock
def remove_lock(lock, key, session=None): """Remove a lock (no matter what it's connected to). """ return _request('get', '/remove/lock/{0}'.format(lock), params={'key': key}, session=session)
python
def remove_lock(lock, key, session=None): """Remove a lock (no matter what it's connected to). """ return _request('get', '/remove/lock/{0}'.format(lock), params={'key': key}, session=session)
[ "def", "remove_lock", "(", "lock", ",", "key", ",", "session", "=", "None", ")", ":", "return", "_request", "(", "'get'", ",", "'/remove/lock/{0}'", ".", "format", "(", "lock", ")", ",", "params", "=", "{", "'key'", ":", "key", "}", ",", "session", "...
Remove a lock (no matter what it's connected to).
[ "Remove", "a", "lock", "(", "no", "matter", "what", "it", "s", "connected", "to", ")", "." ]
train
https://github.com/paddycarey/dweepy/blob/1eb69de4a20c929c57be2a21e2aa39ae9a0ae298/dweepy/api.py#L92-L95
paddycarey/dweepy
dweepy/api.py
lock
def lock(thing_name, lock, key, session=None): """Lock a thing (prevents unauthed dweets for the locked thing) """ return _request('get', '/lock/{0}'.format(thing_name), params={'key': key, 'lock': lock}, session=session)
python
def lock(thing_name, lock, key, session=None): """Lock a thing (prevents unauthed dweets for the locked thing) """ return _request('get', '/lock/{0}'.format(thing_name), params={'key': key, 'lock': lock}, session=session)
[ "def", "lock", "(", "thing_name", ",", "lock", ",", "key", ",", "session", "=", "None", ")", ":", "return", "_request", "(", "'get'", ",", "'/lock/{0}'", ".", "format", "(", "thing_name", ")", ",", "params", "=", "{", "'key'", ":", "key", ",", "'lock...
Lock a thing (prevents unauthed dweets for the locked thing)
[ "Lock", "a", "thing", "(", "prevents", "unauthed", "dweets", "for", "the", "locked", "thing", ")" ]
train
https://github.com/paddycarey/dweepy/blob/1eb69de4a20c929c57be2a21e2aa39ae9a0ae298/dweepy/api.py#L98-L101
paddycarey/dweepy
dweepy/api.py
unlock
def unlock(thing_name, key, session=None): """Unlock a thing """ return _request('get', '/unlock/{0}'.format(thing_name), params={'key': key}, session=session)
python
def unlock(thing_name, key, session=None): """Unlock a thing """ return _request('get', '/unlock/{0}'.format(thing_name), params={'key': key}, session=session)
[ "def", "unlock", "(", "thing_name", ",", "key", ",", "session", "=", "None", ")", ":", "return", "_request", "(", "'get'", ",", "'/unlock/{0}'", ".", "format", "(", "thing_name", ")", ",", "params", "=", "{", "'key'", ":", "key", "}", ",", "session", ...
Unlock a thing
[ "Unlock", "a", "thing" ]
train
https://github.com/paddycarey/dweepy/blob/1eb69de4a20c929c57be2a21e2aa39ae9a0ae298/dweepy/api.py#L104-L107
paddycarey/dweepy
dweepy/api.py
set_alert
def set_alert(thing_name, who, condition, key, session=None): """Set an alert on a thing with the given condition """ return _request('get', '/alert/{0}/when/{1}/{2}'.format( ','.join(who), thing_name, quote(condition), ), params={'key': key}, session=session)
python
def set_alert(thing_name, who, condition, key, session=None): """Set an alert on a thing with the given condition """ return _request('get', '/alert/{0}/when/{1}/{2}'.format( ','.join(who), thing_name, quote(condition), ), params={'key': key}, session=session)
[ "def", "set_alert", "(", "thing_name", ",", "who", ",", "condition", ",", "key", ",", "session", "=", "None", ")", ":", "return", "_request", "(", "'get'", ",", "'/alert/{0}/when/{1}/{2}'", ".", "format", "(", "','", ".", "join", "(", "who", ")", ",", ...
Set an alert on a thing with the given condition
[ "Set", "an", "alert", "on", "a", "thing", "with", "the", "given", "condition" ]
train
https://github.com/paddycarey/dweepy/blob/1eb69de4a20c929c57be2a21e2aa39ae9a0ae298/dweepy/api.py#L110-L117
paddycarey/dweepy
dweepy/api.py
get_alert
def get_alert(thing_name, key, session=None): """Set an alert on a thing with the given condition """ return _request('get', '/get/alert/for/{0}'.format(thing_name), params={'key': key}, session=session)
python
def get_alert(thing_name, key, session=None): """Set an alert on a thing with the given condition """ return _request('get', '/get/alert/for/{0}'.format(thing_name), params={'key': key}, session=session)
[ "def", "get_alert", "(", "thing_name", ",", "key", ",", "session", "=", "None", ")", ":", "return", "_request", "(", "'get'", ",", "'/get/alert/for/{0}'", ".", "format", "(", "thing_name", ")", ",", "params", "=", "{", "'key'", ":", "key", "}", ",", "s...
Set an alert on a thing with the given condition
[ "Set", "an", "alert", "on", "a", "thing", "with", "the", "given", "condition" ]
train
https://github.com/paddycarey/dweepy/blob/1eb69de4a20c929c57be2a21e2aa39ae9a0ae298/dweepy/api.py#L120-L123
paddycarey/dweepy
dweepy/api.py
remove_alert
def remove_alert(thing_name, key, session=None): """Remove an alert for the given thing """ return _request('get', '/remove/alert/for/{0}'.format(thing_name), params={'key': key}, session=session)
python
def remove_alert(thing_name, key, session=None): """Remove an alert for the given thing """ return _request('get', '/remove/alert/for/{0}'.format(thing_name), params={'key': key}, session=session)
[ "def", "remove_alert", "(", "thing_name", ",", "key", ",", "session", "=", "None", ")", ":", "return", "_request", "(", "'get'", ",", "'/remove/alert/for/{0}'", ".", "format", "(", "thing_name", ")", ",", "params", "=", "{", "'key'", ":", "key", "}", ","...
Remove an alert for the given thing
[ "Remove", "an", "alert", "for", "the", "given", "thing" ]
train
https://github.com/paddycarey/dweepy/blob/1eb69de4a20c929c57be2a21e2aa39ae9a0ae298/dweepy/api.py#L126-L129
MalongTech/productai-python-sdk
productai/__init__.py
ProductSetAPI.get_product_sets
def get_product_sets(self): """ list all product sets for current user """ # ensure we are using api url without a specific product set id api_url = super(ProductSetAPI, self).base_url return self.client.get(api_url)
python
def get_product_sets(self): """ list all product sets for current user """ # ensure we are using api url without a specific product set id api_url = super(ProductSetAPI, self).base_url return self.client.get(api_url)
[ "def", "get_product_sets", "(", "self", ")", ":", "# ensure we are using api url without a specific product set id", "api_url", "=", "super", "(", "ProductSetAPI", ",", "self", ")", ".", "base_url", "return", "self", ".", "client", ".", "get", "(", "api_url", ")" ]
list all product sets for current user
[ "list", "all", "product", "sets", "for", "current", "user" ]
train
https://github.com/MalongTech/productai-python-sdk/blob/2227783dbef4ce8e94613c08e67d65d6eecee21c/productai/__init__.py#L488-L494
MalongTech/productai-python-sdk
productai/__init__.py
ProductSetAPI.delete_all_product_sets
def delete_all_product_sets(self): """ BE NOTICED: this will delete all product sets for current user """ # ensure we are using api url without a specific product set id api_url = super(ProductSetAPI, self).base_url return self.client.delete(api_url)
python
def delete_all_product_sets(self): """ BE NOTICED: this will delete all product sets for current user """ # ensure we are using api url without a specific product set id api_url = super(ProductSetAPI, self).base_url return self.client.delete(api_url)
[ "def", "delete_all_product_sets", "(", "self", ")", ":", "# ensure we are using api url without a specific product set id", "api_url", "=", "super", "(", "ProductSetAPI", ",", "self", ")", ".", "base_url", "return", "self", ".", "client", ".", "delete", "(", "api_url"...
BE NOTICED: this will delete all product sets for current user
[ "BE", "NOTICED", ":", "this", "will", "delete", "all", "product", "sets", "for", "current", "user" ]
train
https://github.com/MalongTech/productai-python-sdk/blob/2227783dbef4ce8e94613c08e67d65d6eecee21c/productai/__init__.py#L496-L502
MalongTech/productai-python-sdk
productai/__init__.py
ProductSetAPI.get_products
def get_products(self, product_ids): """ This function (and backend API) is being obsoleted. Don't use it anymore. """ if self.product_set_id is None: raise ValueError('product_set_id must be specified') data = {'ids': product_ids} return self.client.get(self....
python
def get_products(self, product_ids): """ This function (and backend API) is being obsoleted. Don't use it anymore. """ if self.product_set_id is None: raise ValueError('product_set_id must be specified') data = {'ids': product_ids} return self.client.get(self....
[ "def", "get_products", "(", "self", ",", "product_ids", ")", ":", "if", "self", ".", "product_set_id", "is", "None", ":", "raise", "ValueError", "(", "'product_set_id must be specified'", ")", "data", "=", "{", "'ids'", ":", "product_ids", "}", "return", "self...
This function (and backend API) is being obsoleted. Don't use it anymore.
[ "This", "function", "(", "and", "backend", "API", ")", "is", "being", "obsoleted", ".", "Don", "t", "use", "it", "anymore", "." ]
train
https://github.com/MalongTech/productai-python-sdk/blob/2227783dbef4ce8e94613c08e67d65d6eecee21c/productai/__init__.py#L544-L551
paddycarey/dweepy
dweepy/streaming.py
_check_stream_timeout
def _check_stream_timeout(started, timeout): """Check if the timeout has been reached and raise a `StopIteration` if so. """ if timeout: elapsed = datetime.datetime.utcnow() - started if elapsed.seconds > timeout: raise StopIteration
python
def _check_stream_timeout(started, timeout): """Check if the timeout has been reached and raise a `StopIteration` if so. """ if timeout: elapsed = datetime.datetime.utcnow() - started if elapsed.seconds > timeout: raise StopIteration
[ "def", "_check_stream_timeout", "(", "started", ",", "timeout", ")", ":", "if", "timeout", ":", "elapsed", "=", "datetime", ".", "datetime", ".", "utcnow", "(", ")", "-", "started", "if", "elapsed", ".", "seconds", ">", "timeout", ":", "raise", "StopIterat...
Check if the timeout has been reached and raise a `StopIteration` if so.
[ "Check", "if", "the", "timeout", "has", "been", "reached", "and", "raise", "a", "StopIteration", "if", "so", "." ]
train
https://github.com/paddycarey/dweepy/blob/1eb69de4a20c929c57be2a21e2aa39ae9a0ae298/dweepy/streaming.py#L32-L38
paddycarey/dweepy
dweepy/streaming.py
_listen_for_dweets_from_response
def _listen_for_dweets_from_response(response): """Yields dweets as received from dweet.io's streaming API """ streambuffer = '' for byte in response.iter_content(): if byte: streambuffer += byte.decode('ascii') try: dweet = json.loads(streambuffer.splitli...
python
def _listen_for_dweets_from_response(response): """Yields dweets as received from dweet.io's streaming API """ streambuffer = '' for byte in response.iter_content(): if byte: streambuffer += byte.decode('ascii') try: dweet = json.loads(streambuffer.splitli...
[ "def", "_listen_for_dweets_from_response", "(", "response", ")", ":", "streambuffer", "=", "''", "for", "byte", "in", "response", ".", "iter_content", "(", ")", ":", "if", "byte", ":", "streambuffer", "+=", "byte", ".", "decode", "(", "'ascii'", ")", "try", ...
Yields dweets as received from dweet.io's streaming API
[ "Yields", "dweets", "as", "received", "from", "dweet", ".", "io", "s", "streaming", "API" ]
train
https://github.com/paddycarey/dweepy/blob/1eb69de4a20c929c57be2a21e2aa39ae9a0ae298/dweepy/streaming.py#L41-L54
paddycarey/dweepy
dweepy/streaming.py
listen_for_dweets_from
def listen_for_dweets_from(thing_name, timeout=900, key=None, session=None): """Create a real-time subscription to dweets """ url = BASE_URL + '/listen/for/dweets/from/{0}'.format(thing_name) session = session or requests.Session() if key is not None: params = {'key': key} else: ...
python
def listen_for_dweets_from(thing_name, timeout=900, key=None, session=None): """Create a real-time subscription to dweets """ url = BASE_URL + '/listen/for/dweets/from/{0}'.format(thing_name) session = session or requests.Session() if key is not None: params = {'key': key} else: ...
[ "def", "listen_for_dweets_from", "(", "thing_name", ",", "timeout", "=", "900", ",", "key", "=", "None", ",", "session", "=", "None", ")", ":", "url", "=", "BASE_URL", "+", "'/listen/for/dweets/from/{0}'", ".", "format", "(", "thing_name", ")", "session", "=...
Create a real-time subscription to dweets
[ "Create", "a", "real", "-", "time", "subscription", "to", "dweets" ]
train
https://github.com/paddycarey/dweepy/blob/1eb69de4a20c929c57be2a21e2aa39ae9a0ae298/dweepy/streaming.py#L57-L77
MalongTech/productai-python-sdk
productai/bad_case.py
BadCaseApi.add
def add(self, service_id, request_id, description=None, details=None): if not service_id: raise ValueError('service_id is required') if not request_id: raise ValueError('request_id is required') """ curl -X POST \ -H 'x-ca-version: 1.0' \ ...
python
def add(self, service_id, request_id, description=None, details=None): if not service_id: raise ValueError('service_id is required') if not request_id: raise ValueError('request_id is required') """ curl -X POST \ -H 'x-ca-version: 1.0' \ ...
[ "def", "add", "(", "self", ",", "service_id", ",", "request_id", ",", "description", "=", "None", ",", "details", "=", "None", ")", ":", "if", "not", "service_id", ":", "raise", "ValueError", "(", "'service_id is required'", ")", "if", "not", "request_id", ...
curl -X POST \ -H 'x-ca-version: 1.0' \ -H 'x-ca-accesskeyid: YourAccessId' \ -d "service_id=p4dkh2sg&request_id=c13ed5aa-d6d2-11e8-ba11-02420a582a05&description=blahlblah" \ https://api.productai.cn/bad_cases/_0000204
[ "curl", "-", "X", "POST", "\\", "-", "H", "x", "-", "ca", "-", "version", ":", "1", ".", "0", "\\", "-", "H", "x", "-", "ca", "-", "accesskeyid", ":", "YourAccessId", "\\", "-", "d", "service_id", "=", "p4dkh2sg&request_id", "=", "c13ed5aa", "-", ...
train
https://github.com/MalongTech/productai-python-sdk/blob/2227783dbef4ce8e94613c08e67d65d6eecee21c/productai/bad_case.py#L9-L47
nir0s/python-packer
packer.py
Packer.build
def build(self, parallel=True, debug=False, force=False, machine_readable=False): """Executes a `packer build` :param bool parallel: Run builders in parallel :param bool debug: Run in debug mode :param bool force: Force artifact output even if exists :param bool ma...
python
def build(self, parallel=True, debug=False, force=False, machine_readable=False): """Executes a `packer build` :param bool parallel: Run builders in parallel :param bool debug: Run in debug mode :param bool force: Force artifact output even if exists :param bool ma...
[ "def", "build", "(", "self", ",", "parallel", "=", "True", ",", "debug", "=", "False", ",", "force", "=", "False", ",", "machine_readable", "=", "False", ")", ":", "self", ".", "packer_cmd", "=", "self", ".", "packer", ".", "build", "self", ".", "_ad...
Executes a `packer build` :param bool parallel: Run builders in parallel :param bool debug: Run in debug mode :param bool force: Force artifact output even if exists :param bool machine_readable: Make output machine-readable
[ "Executes", "a", "packer", "build" ]
train
https://github.com/nir0s/python-packer/blob/aebb9936e1f7fbfc75131cf2b0284239298faced/packer.py#L44-L62
nir0s/python-packer
packer.py
Packer.fix
def fix(self, to_file=None): """Implements the `packer fix` function :param string to_file: File to output fixed template to """ self.packer_cmd = self.packer.fix self._add_opt(self.packerfile) result = self.packer_cmd() if to_file: with open(to_fil...
python
def fix(self, to_file=None): """Implements the `packer fix` function :param string to_file: File to output fixed template to """ self.packer_cmd = self.packer.fix self._add_opt(self.packerfile) result = self.packer_cmd() if to_file: with open(to_fil...
[ "def", "fix", "(", "self", ",", "to_file", "=", "None", ")", ":", "self", ".", "packer_cmd", "=", "self", ".", "packer", ".", "fix", "self", ".", "_add_opt", "(", "self", ".", "packerfile", ")", "result", "=", "self", ".", "packer_cmd", "(", ")", "...
Implements the `packer fix` function :param string to_file: File to output fixed template to
[ "Implements", "the", "packer", "fix", "function" ]
train
https://github.com/nir0s/python-packer/blob/aebb9936e1f7fbfc75131cf2b0284239298faced/packer.py#L64-L78
nir0s/python-packer
packer.py
Packer.inspect
def inspect(self, mrf=True): """Inspects a Packer Templates file (`packer inspect -machine-readable`) To return the output in a readable form, the `-machine-readable` flag is appended automatically, afterwhich the output is parsed and returned as a dict of the following format: ...
python
def inspect(self, mrf=True): """Inspects a Packer Templates file (`packer inspect -machine-readable`) To return the output in a readable form, the `-machine-readable` flag is appended automatically, afterwhich the output is parsed and returned as a dict of the following format: ...
[ "def", "inspect", "(", "self", ",", "mrf", "=", "True", ")", ":", "self", ".", "packer_cmd", "=", "self", ".", "packer", ".", "inspect", "self", ".", "_add_opt", "(", "'-machine-readable'", "if", "mrf", "else", "None", ")", "self", ".", "_add_opt", "("...
Inspects a Packer Templates file (`packer inspect -machine-readable`) To return the output in a readable form, the `-machine-readable` flag is appended automatically, afterwhich the output is parsed and returned as a dict of the following format: "variables": [ { ...
[ "Inspects", "a", "Packer", "Templates", "file", "(", "packer", "inspect", "-", "machine", "-", "readable", ")" ]
train
https://github.com/nir0s/python-packer/blob/aebb9936e1f7fbfc75131cf2b0284239298faced/packer.py#L80-L121
nir0s/python-packer
packer.py
Packer.push
def push(self, create=True, token=False): """Implmenets the `packer push` function UNTESTED! Must be used alongside an Atlas account """ self.packer_cmd = self.packer.push self._add_opt('-create=true' if create else None) self._add_opt('-tokn={0}'.format(token) if token...
python
def push(self, create=True, token=False): """Implmenets the `packer push` function UNTESTED! Must be used alongside an Atlas account """ self.packer_cmd = self.packer.push self._add_opt('-create=true' if create else None) self._add_opt('-tokn={0}'.format(token) if token...
[ "def", "push", "(", "self", ",", "create", "=", "True", ",", "token", "=", "False", ")", ":", "self", ".", "packer_cmd", "=", "self", ".", "packer", ".", "push", "self", ".", "_add_opt", "(", "'-create=true'", "if", "create", "else", "None", ")", "se...
Implmenets the `packer push` function UNTESTED! Must be used alongside an Atlas account
[ "Implmenets", "the", "packer", "push", "function" ]
train
https://github.com/nir0s/python-packer/blob/aebb9936e1f7fbfc75131cf2b0284239298faced/packer.py#L123-L134
nir0s/python-packer
packer.py
Packer.validate
def validate(self, syntax_only=False): """Validates a Packer Template file (`packer validate`) If the validation failed, an `sh` exception will be raised. :param bool syntax_only: Whether to validate the syntax only without validating the configuration itself. """ self.p...
python
def validate(self, syntax_only=False): """Validates a Packer Template file (`packer validate`) If the validation failed, an `sh` exception will be raised. :param bool syntax_only: Whether to validate the syntax only without validating the configuration itself. """ self.p...
[ "def", "validate", "(", "self", ",", "syntax_only", "=", "False", ")", ":", "self", ".", "packer_cmd", "=", "self", ".", "packer", ".", "validate", "self", ".", "_add_opt", "(", "'-syntax-only'", "if", "syntax_only", "else", "None", ")", "self", ".", "_a...
Validates a Packer Template file (`packer validate`) If the validation failed, an `sh` exception will be raised. :param bool syntax_only: Whether to validate the syntax only without validating the configuration itself.
[ "Validates", "a", "Packer", "Template", "file", "(", "packer", "validate", ")" ]
train
https://github.com/nir0s/python-packer/blob/aebb9936e1f7fbfc75131cf2b0284239298faced/packer.py#L136-L161
nir0s/python-packer
packer.py
Packer._append_base_arguments
def _append_base_arguments(self): """Appends base arguments to packer commands. -except, -only, -var and -var-file are appeneded to almost all subcommands in packer. As such this can be called to add these flags to the subcommand. """ if self.exc and self.only: ...
python
def _append_base_arguments(self): """Appends base arguments to packer commands. -except, -only, -var and -var-file are appeneded to almost all subcommands in packer. As such this can be called to add these flags to the subcommand. """ if self.exc and self.only: ...
[ "def", "_append_base_arguments", "(", "self", ")", ":", "if", "self", ".", "exc", "and", "self", ".", "only", ":", "raise", "PackerException", "(", "'Cannot provide both \"except\" and \"only\"'", ")", "elif", "self", ".", "exc", ":", "self", ".", "_add_opt", ...
Appends base arguments to packer commands. -except, -only, -var and -var-file are appeneded to almost all subcommands in packer. As such this can be called to add these flags to the subcommand.
[ "Appends", "base", "arguments", "to", "packer", "commands", "." ]
train
https://github.com/nir0s/python-packer/blob/aebb9936e1f7fbfc75131cf2b0284239298faced/packer.py#L183-L200
nir0s/python-packer
packer.py
Packer._parse_inspection_output
def _parse_inspection_output(self, output): """Parses the machine-readable output `packer inspect` provides. See the inspect method for more info. This has been tested vs. Packer v0.7.5 """ parts = {'variables': [], 'builders': [], 'provisioners': []} for line in output....
python
def _parse_inspection_output(self, output): """Parses the machine-readable output `packer inspect` provides. See the inspect method for more info. This has been tested vs. Packer v0.7.5 """ parts = {'variables': [], 'builders': [], 'provisioners': []} for line in output....
[ "def", "_parse_inspection_output", "(", "self", ",", "output", ")", ":", "parts", "=", "{", "'variables'", ":", "[", "]", ",", "'builders'", ":", "[", "]", ",", "'provisioners'", ":", "[", "]", "}", "for", "line", "in", "output", ".", "splitlines", "("...
Parses the machine-readable output `packer inspect` provides. See the inspect method for more info. This has been tested vs. Packer v0.7.5
[ "Parses", "the", "machine", "-", "readable", "output", "packer", "inspect", "provides", "." ]
train
https://github.com/nir0s/python-packer/blob/aebb9936e1f7fbfc75131cf2b0284239298faced/packer.py#L206-L227
versae/neo4j-rest-client
neo4jrestclient/request.py
Request.post
def post(self, url, data, headers=None): """ Perform an HTTP POST request for a given url. Returns the response object. """ return self._request('POST', url, data, headers=headers)
python
def post(self, url, data, headers=None): """ Perform an HTTP POST request for a given url. Returns the response object. """ return self._request('POST', url, data, headers=headers)
[ "def", "post", "(", "self", ",", "url", ",", "data", ",", "headers", "=", "None", ")", ":", "return", "self", ".", "_request", "(", "'POST'", ",", "url", ",", "data", ",", "headers", "=", "headers", ")" ]
Perform an HTTP POST request for a given url. Returns the response object.
[ "Perform", "an", "HTTP", "POST", "request", "for", "a", "given", "url", ".", "Returns", "the", "response", "object", "." ]
train
https://github.com/versae/neo4j-rest-client/blob/b03c09c8f598fa4dbad8ea8998ffb1c885805074/neo4jrestclient/request.py#L65-L70
versae/neo4j-rest-client
neo4jrestclient/request.py
Request.put
def put(self, url, data, headers=None): """ Perform an HTTP PUT request for a given url. Returns the response object. """ return self._request('PUT', url, data, headers=headers)
python
def put(self, url, data, headers=None): """ Perform an HTTP PUT request for a given url. Returns the response object. """ return self._request('PUT', url, data, headers=headers)
[ "def", "put", "(", "self", ",", "url", ",", "data", ",", "headers", "=", "None", ")", ":", "return", "self", ".", "_request", "(", "'PUT'", ",", "url", ",", "data", ",", "headers", "=", "headers", ")" ]
Perform an HTTP PUT request for a given url. Returns the response object.
[ "Perform", "an", "HTTP", "PUT", "request", "for", "a", "given", "url", ".", "Returns", "the", "response", "object", "." ]
train
https://github.com/versae/neo4j-rest-client/blob/b03c09c8f598fa4dbad8ea8998ffb1c885805074/neo4jrestclient/request.py#L72-L77
versae/neo4j-rest-client
neo4jrestclient/client.py
Index.query
def query(self, *args): """ Query a fulltext index by key and query or just a plain Lucene query, i1 = gdb.nodes.indexes.get('people',type='fulltext', provider='lucene') i1.query('name','do*') i1.query('name:do*') In this example, the last two line are equivalent. ...
python
def query(self, *args): """ Query a fulltext index by key and query or just a plain Lucene query, i1 = gdb.nodes.indexes.get('people',type='fulltext', provider='lucene') i1.query('name','do*') i1.query('name:do*') In this example, the last two line are equivalent. ...
[ "def", "query", "(", "self", ",", "*", "args", ")", ":", "if", "not", "args", "or", "len", "(", "args", ")", ">", "2", ":", "raise", "TypeError", "(", "'query() takes 2 or 3 arguments (a query or a key '", "'and a query) (%d given)'", "%", "(", "len", "(", "...
Query a fulltext index by key and query or just a plain Lucene query, i1 = gdb.nodes.indexes.get('people',type='fulltext', provider='lucene') i1.query('name','do*') i1.query('name:do*') In this example, the last two line are equivalent.
[ "Query", "a", "fulltext", "index", "by", "key", "and", "query", "or", "just", "a", "plain", "Lucene", "query" ]
train
https://github.com/versae/neo4j-rest-client/blob/b03c09c8f598fa4dbad8ea8998ffb1c885805074/neo4jrestclient/client.py#L1788-L1813
versae/neo4j-rest-client
neo4jrestclient/query.py
QuerySequence._plot_graph
def _plot_graph(self, graph, title=None, width=None, height=None): """ Return a HTML representation for a particular QuerySequence. Mainly for IPython Notebook. """ if not self._elements_row and not self._elements_graph: raise ValueError('Unable to display the graph o...
python
def _plot_graph(self, graph, title=None, width=None, height=None): """ Return a HTML representation for a particular QuerySequence. Mainly for IPython Notebook. """ if not self._elements_row and not self._elements_graph: raise ValueError('Unable to display the graph o...
[ "def", "_plot_graph", "(", "self", ",", "graph", ",", "title", "=", "None", ",", "width", "=", "None", ",", "height", "=", "None", ")", ":", "if", "not", "self", ".", "_elements_row", "and", "not", "self", ".", "_elements_graph", ":", "raise", "ValueEr...
Return a HTML representation for a particular QuerySequence. Mainly for IPython Notebook.
[ "Return", "a", "HTML", "representation", "for", "a", "particular", "QuerySequence", ".", "Mainly", "for", "IPython", "Notebook", "." ]
train
https://github.com/versae/neo4j-rest-client/blob/b03c09c8f598fa4dbad8ea8998ffb1c885805074/neo4jrestclient/query.py#L422-L642
bkjones/pyrabbit
pyrabbit/http.py
HTTPClient.do_call
def do_call(self, path, method, body=None, headers=None): """ Send an HTTP request to the REST API. :param string path: A URL :param string method: The HTTP method (GET, POST, etc.) to use in the request. :param string body: A string representing any data to be sent ...
python
def do_call(self, path, method, body=None, headers=None): """ Send an HTTP request to the REST API. :param string path: A URL :param string method: The HTTP method (GET, POST, etc.) to use in the request. :param string body: A string representing any data to be sent ...
[ "def", "do_call", "(", "self", ",", "path", ",", "method", ",", "body", "=", "None", ",", "headers", "=", "None", ")", ":", "url", "=", "urljoin", "(", "self", ".", "base_url", ",", "path", ")", "try", ":", "resp", "=", "requests", ".", "request", ...
Send an HTTP request to the REST API. :param string path: A URL :param string method: The HTTP method (GET, POST, etc.) to use in the request. :param string body: A string representing any data to be sent in the body of the HTTP request. :param dictionary headers...
[ "Send", "an", "HTTP", "request", "to", "the", "REST", "API", "." ]
train
https://github.com/bkjones/pyrabbit/blob/e8a9f74ed5c6bba958994fb9a72c396e6a99ea0f/pyrabbit/http.py#L72-L107
bkjones/pyrabbit
pyrabbit/api.py
Client._call
def _call(self, path, method, body=None, headers=None): """ Wrapper around http.do_call that transforms some HTTPError into our own exceptions """ try: resp = self.http.do_call(path, method, body, headers) except http.HTTPError as err: if err.statu...
python
def _call(self, path, method, body=None, headers=None): """ Wrapper around http.do_call that transforms some HTTPError into our own exceptions """ try: resp = self.http.do_call(path, method, body, headers) except http.HTTPError as err: if err.statu...
[ "def", "_call", "(", "self", ",", "path", ",", "method", ",", "body", "=", "None", ",", "headers", "=", "None", ")", ":", "try", ":", "resp", "=", "self", ".", "http", ".", "do_call", "(", "path", ",", "method", ",", "body", ",", "headers", ")", ...
Wrapper around http.do_call that transforms some HTTPError into our own exceptions
[ "Wrapper", "around", "http", ".", "do_call", "that", "transforms", "some", "HTTPError", "into", "our", "own", "exceptions" ]
train
https://github.com/bkjones/pyrabbit/blob/e8a9f74ed5c6bba958994fb9a72c396e6a99ea0f/pyrabbit/api.py#L102-L114
bkjones/pyrabbit
pyrabbit/api.py
Client.is_alive
def is_alive(self, vhost='%2F'): """ Uses the aliveness-test API call to determine if the server is alive and the vhost is active. The broker (not this code) creates a queue and then sends/consumes a message from it. :param string vhost: There should be no real reason to ever ch...
python
def is_alive(self, vhost='%2F'): """ Uses the aliveness-test API call to determine if the server is alive and the vhost is active. The broker (not this code) creates a queue and then sends/consumes a message from it. :param string vhost: There should be no real reason to ever ch...
[ "def", "is_alive", "(", "self", ",", "vhost", "=", "'%2F'", ")", ":", "uri", "=", "Client", ".", "urls", "[", "'live_test'", "]", "%", "vhost", "try", ":", "resp", "=", "self", ".", "_call", "(", "uri", ",", "'GET'", ")", "except", "http", ".", "...
Uses the aliveness-test API call to determine if the server is alive and the vhost is active. The broker (not this code) creates a queue and then sends/consumes a message from it. :param string vhost: There should be no real reason to ever change this from the default value, but it'...
[ "Uses", "the", "aliveness", "-", "test", "API", "call", "to", "determine", "if", "the", "server", "is", "alive", "and", "the", "vhost", "is", "active", ".", "The", "broker", "(", "not", "this", "code", ")", "creates", "a", "queue", "and", "then", "send...
train
https://github.com/bkjones/pyrabbit/blob/e8a9f74ed5c6bba958994fb9a72c396e6a99ea0f/pyrabbit/api.py#L117-L141
bkjones/pyrabbit
pyrabbit/api.py
Client.get_whoami
def get_whoami(self): """ A convenience function used in the event that you need to confirm that the broker thinks you are who you think you are. :returns dict whoami: Dict structure contains: * administrator: whether the user is has admin privileges * name: user...
python
def get_whoami(self): """ A convenience function used in the event that you need to confirm that the broker thinks you are who you think you are. :returns dict whoami: Dict structure contains: * administrator: whether the user is has admin privileges * name: user...
[ "def", "get_whoami", "(", "self", ")", ":", "path", "=", "Client", ".", "urls", "[", "'whoami'", "]", "whoami", "=", "self", ".", "_call", "(", "path", ",", "'GET'", ")", "return", "whoami" ]
A convenience function used in the event that you need to confirm that the broker thinks you are who you think you are. :returns dict whoami: Dict structure contains: * administrator: whether the user is has admin privileges * name: user name * auth_backend: backend ...
[ "A", "convenience", "function", "used", "in", "the", "event", "that", "you", "need", "to", "confirm", "that", "the", "broker", "thinks", "you", "are", "who", "you", "think", "you", "are", "." ]
train
https://github.com/bkjones/pyrabbit/blob/e8a9f74ed5c6bba958994fb9a72c396e6a99ea0f/pyrabbit/api.py#L143-L155
bkjones/pyrabbit
pyrabbit/api.py
Client.get_vhost_names
def get_vhost_names(self): """ A convenience function for getting back only the vhost names instead of the larger vhost dicts. :returns list vhost_names: A list of just the vhost names. """ vhosts = self.get_all_vhosts() vhost_names = [i['name'] for i in vhosts] ...
python
def get_vhost_names(self): """ A convenience function for getting back only the vhost names instead of the larger vhost dicts. :returns list vhost_names: A list of just the vhost names. """ vhosts = self.get_all_vhosts() vhost_names = [i['name'] for i in vhosts] ...
[ "def", "get_vhost_names", "(", "self", ")", ":", "vhosts", "=", "self", ".", "get_all_vhosts", "(", ")", "vhost_names", "=", "[", "i", "[", "'name'", "]", "for", "i", "in", "vhosts", "]", "return", "vhost_names" ]
A convenience function for getting back only the vhost names instead of the larger vhost dicts. :returns list vhost_names: A list of just the vhost names.
[ "A", "convenience", "function", "for", "getting", "back", "only", "the", "vhost", "names", "instead", "of", "the", "larger", "vhost", "dicts", "." ]
train
https://github.com/bkjones/pyrabbit/blob/e8a9f74ed5c6bba958994fb9a72c396e6a99ea0f/pyrabbit/api.py#L207-L216
bkjones/pyrabbit
pyrabbit/api.py
Client.get_vhost
def get_vhost(self, vname): """ Returns the attributes of a single named vhost in a dict. :param string vname: Name of the vhost to get. :returns dict vhost: Attribute dict for the named vhost """ vname = quote(vname, '') path = Client.urls['vhosts_by_name'] % ...
python
def get_vhost(self, vname): """ Returns the attributes of a single named vhost in a dict. :param string vname: Name of the vhost to get. :returns dict vhost: Attribute dict for the named vhost """ vname = quote(vname, '') path = Client.urls['vhosts_by_name'] % ...
[ "def", "get_vhost", "(", "self", ",", "vname", ")", ":", "vname", "=", "quote", "(", "vname", ",", "''", ")", "path", "=", "Client", ".", "urls", "[", "'vhosts_by_name'", "]", "%", "vname", "vhost", "=", "self", ".", "_call", "(", "path", ",", "'GE...
Returns the attributes of a single named vhost in a dict. :param string vname: Name of the vhost to get. :returns dict vhost: Attribute dict for the named vhost
[ "Returns", "the", "attributes", "of", "a", "single", "named", "vhost", "in", "a", "dict", "." ]
train
https://github.com/bkjones/pyrabbit/blob/e8a9f74ed5c6bba958994fb9a72c396e6a99ea0f/pyrabbit/api.py#L218-L230
bkjones/pyrabbit
pyrabbit/api.py
Client.create_vhost
def create_vhost(self, vname): """ Creates a vhost on the server to house exchanges. :param string vname: The name to give to the vhost on the server :returns: boolean """ vname = quote(vname, '') path = Client.urls['vhosts_by_name'] % vname return self._...
python
def create_vhost(self, vname): """ Creates a vhost on the server to house exchanges. :param string vname: The name to give to the vhost on the server :returns: boolean """ vname = quote(vname, '') path = Client.urls['vhosts_by_name'] % vname return self._...
[ "def", "create_vhost", "(", "self", ",", "vname", ")", ":", "vname", "=", "quote", "(", "vname", ",", "''", ")", "path", "=", "Client", ".", "urls", "[", "'vhosts_by_name'", "]", "%", "vname", "return", "self", ".", "_call", "(", "path", ",", "'PUT'"...
Creates a vhost on the server to house exchanges. :param string vname: The name to give to the vhost on the server :returns: boolean
[ "Creates", "a", "vhost", "on", "the", "server", "to", "house", "exchanges", "." ]
train
https://github.com/bkjones/pyrabbit/blob/e8a9f74ed5c6bba958994fb9a72c396e6a99ea0f/pyrabbit/api.py#L232-L242
bkjones/pyrabbit
pyrabbit/api.py
Client.delete_vhost
def delete_vhost(self, vname): """ Deletes a vhost from the server. Note that this also deletes any exchanges or queues that belong to this vhost. :param string vname: Name of the vhost to delete from the server. """ vname = quote(vname, '') path = Client.urls['v...
python
def delete_vhost(self, vname): """ Deletes a vhost from the server. Note that this also deletes any exchanges or queues that belong to this vhost. :param string vname: Name of the vhost to delete from the server. """ vname = quote(vname, '') path = Client.urls['v...
[ "def", "delete_vhost", "(", "self", ",", "vname", ")", ":", "vname", "=", "quote", "(", "vname", ",", "''", ")", "path", "=", "Client", ".", "urls", "[", "'vhosts_by_name'", "]", "%", "vname", "return", "self", ".", "_call", "(", "path", ",", "'DELET...
Deletes a vhost from the server. Note that this also deletes any exchanges or queues that belong to this vhost. :param string vname: Name of the vhost to delete from the server.
[ "Deletes", "a", "vhost", "from", "the", "server", ".", "Note", "that", "this", "also", "deletes", "any", "exchanges", "or", "queues", "that", "belong", "to", "this", "vhost", "." ]
train
https://github.com/bkjones/pyrabbit/blob/e8a9f74ed5c6bba958994fb9a72c396e6a99ea0f/pyrabbit/api.py#L244-L253
bkjones/pyrabbit
pyrabbit/api.py
Client.get_permissions
def get_permissions(self): """ :returns: list of dicts, or an empty list if there are no permissions. """ path = Client.urls['all_permissions'] conns = self._call(path, 'GET') return conns
python
def get_permissions(self): """ :returns: list of dicts, or an empty list if there are no permissions. """ path = Client.urls['all_permissions'] conns = self._call(path, 'GET') return conns
[ "def", "get_permissions", "(", "self", ")", ":", "path", "=", "Client", ".", "urls", "[", "'all_permissions'", "]", "conns", "=", "self", ".", "_call", "(", "path", ",", "'GET'", ")", "return", "conns" ]
:returns: list of dicts, or an empty list if there are no permissions.
[ ":", "returns", ":", "list", "of", "dicts", "or", "an", "empty", "list", "if", "there", "are", "no", "permissions", "." ]
train
https://github.com/bkjones/pyrabbit/blob/e8a9f74ed5c6bba958994fb9a72c396e6a99ea0f/pyrabbit/api.py#L258-L264
bkjones/pyrabbit
pyrabbit/api.py
Client.get_vhost_permissions
def get_vhost_permissions(self, vname): """ :returns: list of dicts, or an empty list if there are no permissions. :param string vname: Name of the vhost to set perms on. """ vname = quote(vname, '') path = Client.urls['vhost_permissions_get'] % (vname,) conns = ...
python
def get_vhost_permissions(self, vname): """ :returns: list of dicts, or an empty list if there are no permissions. :param string vname: Name of the vhost to set perms on. """ vname = quote(vname, '') path = Client.urls['vhost_permissions_get'] % (vname,) conns = ...
[ "def", "get_vhost_permissions", "(", "self", ",", "vname", ")", ":", "vname", "=", "quote", "(", "vname", ",", "''", ")", "path", "=", "Client", ".", "urls", "[", "'vhost_permissions_get'", "]", "%", "(", "vname", ",", ")", "conns", "=", "self", ".", ...
:returns: list of dicts, or an empty list if there are no permissions. :param string vname: Name of the vhost to set perms on.
[ ":", "returns", ":", "list", "of", "dicts", "or", "an", "empty", "list", "if", "there", "are", "no", "permissions", "." ]
train
https://github.com/bkjones/pyrabbit/blob/e8a9f74ed5c6bba958994fb9a72c396e6a99ea0f/pyrabbit/api.py#L266-L275
bkjones/pyrabbit
pyrabbit/api.py
Client.get_user_permissions
def get_user_permissions(self, username): """ :returns: list of dicts, or an empty list if there are no permissions. :param string username: User to set permissions for. """ path = Client.urls['user_permissions'] % (username,) conns = self._call(path, 'GET') ret...
python
def get_user_permissions(self, username): """ :returns: list of dicts, or an empty list if there are no permissions. :param string username: User to set permissions for. """ path = Client.urls['user_permissions'] % (username,) conns = self._call(path, 'GET') ret...
[ "def", "get_user_permissions", "(", "self", ",", "username", ")", ":", "path", "=", "Client", ".", "urls", "[", "'user_permissions'", "]", "%", "(", "username", ",", ")", "conns", "=", "self", ".", "_call", "(", "path", ",", "'GET'", ")", "return", "co...
:returns: list of dicts, or an empty list if there are no permissions. :param string username: User to set permissions for.
[ ":", "returns", ":", "list", "of", "dicts", "or", "an", "empty", "list", "if", "there", "are", "no", "permissions", "." ]
train
https://github.com/bkjones/pyrabbit/blob/e8a9f74ed5c6bba958994fb9a72c396e6a99ea0f/pyrabbit/api.py#L277-L286
bkjones/pyrabbit
pyrabbit/api.py
Client.set_vhost_permissions
def set_vhost_permissions(self, vname, username, config, rd, wr): """ Set permissions for a given username on a given vhost. Both must already exist. :param string vname: Name of the vhost to set perms on. :param string username: User to set permissions for. :param strin...
python
def set_vhost_permissions(self, vname, username, config, rd, wr): """ Set permissions for a given username on a given vhost. Both must already exist. :param string vname: Name of the vhost to set perms on. :param string username: User to set permissions for. :param strin...
[ "def", "set_vhost_permissions", "(", "self", ",", "vname", ",", "username", ",", "config", ",", "rd", ",", "wr", ")", ":", "vname", "=", "quote", "(", "vname", ",", "''", ")", "body", "=", "json", ".", "dumps", "(", "{", "\"configure\"", ":", "config...
Set permissions for a given username on a given vhost. Both must already exist. :param string vname: Name of the vhost to set perms on. :param string username: User to set permissions for. :param string config: Permission pattern for configuration operations for this user in...
[ "Set", "permissions", "for", "a", "given", "username", "on", "a", "given", "vhost", ".", "Both", "must", "already", "exist", "." ]
train
https://github.com/bkjones/pyrabbit/blob/e8a9f74ed5c6bba958994fb9a72c396e6a99ea0f/pyrabbit/api.py#L288-L311
bkjones/pyrabbit
pyrabbit/api.py
Client.delete_permission
def delete_permission(self, vname, username): """ Delete permission for a given username on a given vhost. Both must already exist. :param string vname: Name of the vhost to set perms on. :param string username: User to set permissions for. """ vname = quote(vnam...
python
def delete_permission(self, vname, username): """ Delete permission for a given username on a given vhost. Both must already exist. :param string vname: Name of the vhost to set perms on. :param string username: User to set permissions for. """ vname = quote(vnam...
[ "def", "delete_permission", "(", "self", ",", "vname", ",", "username", ")", ":", "vname", "=", "quote", "(", "vname", ",", "''", ")", "path", "=", "Client", ".", "urls", "[", "'vhost_permissions'", "]", "%", "(", "vname", ",", "username", ")", "return...
Delete permission for a given username on a given vhost. Both must already exist. :param string vname: Name of the vhost to set perms on. :param string username: User to set permissions for.
[ "Delete", "permission", "for", "a", "given", "username", "on", "a", "given", "vhost", ".", "Both", "must", "already", "exist", "." ]
train
https://github.com/bkjones/pyrabbit/blob/e8a9f74ed5c6bba958994fb9a72c396e6a99ea0f/pyrabbit/api.py#L313-L323
bkjones/pyrabbit
pyrabbit/api.py
Client.get_exchanges
def get_exchanges(self, vhost=None): """ :returns: A list of dicts :param string vhost: A vhost to query for exchanges, or None (default), which triggers a query for all exchanges in all vhosts. """ if vhost: vhost = quote(vhost, '') path = Cl...
python
def get_exchanges(self, vhost=None): """ :returns: A list of dicts :param string vhost: A vhost to query for exchanges, or None (default), which triggers a query for all exchanges in all vhosts. """ if vhost: vhost = quote(vhost, '') path = Cl...
[ "def", "get_exchanges", "(", "self", ",", "vhost", "=", "None", ")", ":", "if", "vhost", ":", "vhost", "=", "quote", "(", "vhost", ",", "''", ")", "path", "=", "Client", ".", "urls", "[", "'exchanges_by_vhost'", "]", "%", "vhost", "else", ":", "path"...
:returns: A list of dicts :param string vhost: A vhost to query for exchanges, or None (default), which triggers a query for all exchanges in all vhosts.
[ ":", "returns", ":", "A", "list", "of", "dicts", ":", "param", "string", "vhost", ":", "A", "vhost", "to", "query", "for", "exchanges", "or", "None", "(", "default", ")", "which", "triggers", "a", "query", "for", "all", "exchanges", "in", "all", "vhost...
train
https://github.com/bkjones/pyrabbit/blob/e8a9f74ed5c6bba958994fb9a72c396e6a99ea0f/pyrabbit/api.py#L339-L353
bkjones/pyrabbit
pyrabbit/api.py
Client.get_exchange
def get_exchange(self, vhost, name): """ Gets a single exchange which requires a vhost and name. :param string vhost: The vhost containing the target exchange :param string name: The name of the exchange :returns: dict """ vhost = quote(vhost, '') name =...
python
def get_exchange(self, vhost, name): """ Gets a single exchange which requires a vhost and name. :param string vhost: The vhost containing the target exchange :param string name: The name of the exchange :returns: dict """ vhost = quote(vhost, '') name =...
[ "def", "get_exchange", "(", "self", ",", "vhost", ",", "name", ")", ":", "vhost", "=", "quote", "(", "vhost", ",", "''", ")", "name", "=", "quote", "(", "name", ",", "''", ")", "path", "=", "Client", ".", "urls", "[", "'exchange_by_name'", "]", "%"...
Gets a single exchange which requires a vhost and name. :param string vhost: The vhost containing the target exchange :param string name: The name of the exchange :returns: dict
[ "Gets", "a", "single", "exchange", "which", "requires", "a", "vhost", "and", "name", "." ]
train
https://github.com/bkjones/pyrabbit/blob/e8a9f74ed5c6bba958994fb9a72c396e6a99ea0f/pyrabbit/api.py#L355-L368
bkjones/pyrabbit
pyrabbit/api.py
Client.create_exchange
def create_exchange(self, vhost, name, xtype, auto_delete=False, durable=True, internal=False, arguments=None): """ Creates an exchange ...
python
def create_exchange(self, vhost, name, xtype, auto_delete=False, durable=True, internal=False, arguments=None): """ Creates an exchange ...
[ "def", "create_exchange", "(", "self", ",", "vhost", ",", "name", ",", "xtype", ",", "auto_delete", "=", "False", ",", "durable", "=", "True", ",", "internal", "=", "False", ",", "arguments", "=", "None", ")", ":", "vhost", "=", "quote", "(", "vhost", ...
Creates an exchange in the given vhost with the given name. As per the RabbitMQ API documentation, a JSON body also needs to be included that "looks something like this": {"type":"direct", "auto_delete":false, "durable":true, "internal":false, "arguments":[]} ...
[ "Creates", "an", "exchange", "in", "the", "given", "vhost", "with", "the", "given", "name", ".", "As", "per", "the", "RabbitMQ", "API", "documentation", "a", "JSON", "body", "also", "needs", "to", "be", "included", "that", "looks", "something", "like", "th...
train
https://github.com/bkjones/pyrabbit/blob/e8a9f74ed5c6bba958994fb9a72c396e6a99ea0f/pyrabbit/api.py#L370-L416
bkjones/pyrabbit
pyrabbit/api.py
Client.publish
def publish(self, vhost, xname, rt_key, payload, payload_enc='string', properties=None): """ Publish a message to an exchange. :param string vhost: vhost housing the target exchange :param string xname: name of the target exchange :param string rt_key: routing ke...
python
def publish(self, vhost, xname, rt_key, payload, payload_enc='string', properties=None): """ Publish a message to an exchange. :param string vhost: vhost housing the target exchange :param string xname: name of the target exchange :param string rt_key: routing ke...
[ "def", "publish", "(", "self", ",", "vhost", ",", "xname", ",", "rt_key", ",", "payload", ",", "payload_enc", "=", "'string'", ",", "properties", "=", "None", ")", ":", "vhost", "=", "quote", "(", "vhost", ",", "''", ")", "xname", "=", "quote", "(", ...
Publish a message to an exchange. :param string vhost: vhost housing the target exchange :param string xname: name of the target exchange :param string rt_key: routing key for message :param string payload: the message body for publishing :param string payload_enc: encoding of t...
[ "Publish", "a", "message", "to", "an", "exchange", "." ]
train
https://github.com/bkjones/pyrabbit/blob/e8a9f74ed5c6bba958994fb9a72c396e6a99ea0f/pyrabbit/api.py#L418-L439
bkjones/pyrabbit
pyrabbit/api.py
Client.delete_exchange
def delete_exchange(self, vhost, name): """ Delete the named exchange from the named vhost. The API returns a 204 on success, in which case this method returns True, otherwise the error is raised. :param string vhost: Vhost where target exchange was created :param string...
python
def delete_exchange(self, vhost, name): """ Delete the named exchange from the named vhost. The API returns a 204 on success, in which case this method returns True, otherwise the error is raised. :param string vhost: Vhost where target exchange was created :param string...
[ "def", "delete_exchange", "(", "self", ",", "vhost", ",", "name", ")", ":", "vhost", "=", "quote", "(", "vhost", ",", "''", ")", "name", "=", "quote", "(", "name", ",", "''", ")", "path", "=", "Client", ".", "urls", "[", "'exchange_by_name'", "]", ...
Delete the named exchange from the named vhost. The API returns a 204 on success, in which case this method returns True, otherwise the error is raised. :param string vhost: Vhost where target exchange was created :param string name: The name of the exchange to delete. :returns ...
[ "Delete", "the", "named", "exchange", "from", "the", "named", "vhost", ".", "The", "API", "returns", "a", "204", "on", "success", "in", "which", "case", "this", "method", "returns", "True", "otherwise", "the", "error", "is", "raised", "." ]
train
https://github.com/bkjones/pyrabbit/blob/e8a9f74ed5c6bba958994fb9a72c396e6a99ea0f/pyrabbit/api.py#L441-L455
bkjones/pyrabbit
pyrabbit/api.py
Client.get_queues
def get_queues(self, vhost=None): """ Get all queues, or all queues in a vhost if vhost is not None. Returns a list. :param string vhost: The virtual host to list queues for. If This is None (the default), all queues for the broker instance are re...
python
def get_queues(self, vhost=None): """ Get all queues, or all queues in a vhost if vhost is not None. Returns a list. :param string vhost: The virtual host to list queues for. If This is None (the default), all queues for the broker instance are re...
[ "def", "get_queues", "(", "self", ",", "vhost", "=", "None", ")", ":", "if", "vhost", ":", "vhost", "=", "quote", "(", "vhost", ",", "''", ")", "path", "=", "Client", ".", "urls", "[", "'queues_by_vhost'", "]", "%", "vhost", "else", ":", "path", "=...
Get all queues, or all queues in a vhost if vhost is not None. Returns a list. :param string vhost: The virtual host to list queues for. If This is None (the default), all queues for the broker instance are returned. :returns: A list of dicts, each repres...
[ "Get", "all", "queues", "or", "all", "queues", "in", "a", "vhost", "if", "vhost", "is", "not", "None", ".", "Returns", "a", "list", "." ]
train
https://github.com/bkjones/pyrabbit/blob/e8a9f74ed5c6bba958994fb9a72c396e6a99ea0f/pyrabbit/api.py#L460-L479
bkjones/pyrabbit
pyrabbit/api.py
Client.get_queue
def get_queue(self, vhost, name): """ Get a single queue, which requires both vhost and name. :param string vhost: The virtual host for the queue being requested. If the vhost is '/', note that it will be translated to '%2F' to conform to URL encoding requirements. ...
python
def get_queue(self, vhost, name): """ Get a single queue, which requires both vhost and name. :param string vhost: The virtual host for the queue being requested. If the vhost is '/', note that it will be translated to '%2F' to conform to URL encoding requirements. ...
[ "def", "get_queue", "(", "self", ",", "vhost", ",", "name", ")", ":", "vhost", "=", "quote", "(", "vhost", ",", "''", ")", "name", "=", "quote", "(", "name", ",", "''", ")", "path", "=", "Client", ".", "urls", "[", "'queues_by_name'", "]", "%", "...
Get a single queue, which requires both vhost and name. :param string vhost: The virtual host for the queue being requested. If the vhost is '/', note that it will be translated to '%2F' to conform to URL encoding requirements. :param string name: The name of the queue being req...
[ "Get", "a", "single", "queue", "which", "requires", "both", "vhost", "and", "name", "." ]
train
https://github.com/bkjones/pyrabbit/blob/e8a9f74ed5c6bba958994fb9a72c396e6a99ea0f/pyrabbit/api.py#L481-L497
bkjones/pyrabbit
pyrabbit/api.py
Client.get_queue_depth
def get_queue_depth(self, vhost, name): """ Get the number of messages currently in a queue. This is a convenience function that just calls :meth:`Client.get_queue` and pulls out/returns the 'messages' field from the dictionary it returns. :param string vhost: The vhost of the...
python
def get_queue_depth(self, vhost, name): """ Get the number of messages currently in a queue. This is a convenience function that just calls :meth:`Client.get_queue` and pulls out/returns the 'messages' field from the dictionary it returns. :param string vhost: The vhost of the...
[ "def", "get_queue_depth", "(", "self", ",", "vhost", ",", "name", ")", ":", "vhost", "=", "quote", "(", "vhost", ",", "''", ")", "name", "=", "quote", "(", "name", ",", "''", ")", "path", "=", "Client", ".", "urls", "[", "'queues_by_name'", "]", "%...
Get the number of messages currently in a queue. This is a convenience function that just calls :meth:`Client.get_queue` and pulls out/returns the 'messages' field from the dictionary it returns. :param string vhost: The vhost of the queue being queried. :param string name: The name o...
[ "Get", "the", "number", "of", "messages", "currently", "in", "a", "queue", ".", "This", "is", "a", "convenience", "function", "that", "just", "calls", ":", "meth", ":", "Client", ".", "get_queue", "and", "pulls", "out", "/", "returns", "the", "messages", ...
train
https://github.com/bkjones/pyrabbit/blob/e8a9f74ed5c6bba958994fb9a72c396e6a99ea0f/pyrabbit/api.py#L499-L517
bkjones/pyrabbit
pyrabbit/api.py
Client.get_queue_depths
def get_queue_depths(self, vhost, names=None): """ Get the number of messages currently sitting in either the queue names listed in 'names', or all queues in 'vhost' if no 'names' are given. :param str vhost: Vhost where queues in 'names' live. :param list names: OPTIONA...
python
def get_queue_depths(self, vhost, names=None): """ Get the number of messages currently sitting in either the queue names listed in 'names', or all queues in 'vhost' if no 'names' are given. :param str vhost: Vhost where queues in 'names' live. :param list names: OPTIONA...
[ "def", "get_queue_depths", "(", "self", ",", "vhost", ",", "names", "=", "None", ")", ":", "vhost", "=", "quote", "(", "vhost", ",", "''", ")", "if", "not", "names", ":", "# get all queues in vhost", "path", "=", "Client", ".", "urls", "[", "'queues_by_v...
Get the number of messages currently sitting in either the queue names listed in 'names', or all queues in 'vhost' if no 'names' are given. :param str vhost: Vhost where queues in 'names' live. :param list names: OPTIONAL - Specific queues to show depths for. If None, sh...
[ "Get", "the", "number", "of", "messages", "currently", "sitting", "in", "either", "the", "queue", "names", "listed", "in", "names", "or", "all", "queues", "in", "vhost", "if", "no", "names", "are", "given", "." ]
train
https://github.com/bkjones/pyrabbit/blob/e8a9f74ed5c6bba958994fb9a72c396e6a99ea0f/pyrabbit/api.py#L519-L542
bkjones/pyrabbit
pyrabbit/api.py
Client.purge_queues
def purge_queues(self, queues): """ Purge all messages from one or more queues. :param list queues: A list of ('qname', 'vhost') tuples. :returns: True on success """ for name, vhost in queues: vhost = quote(vhost, '') name = quote(name, '') ...
python
def purge_queues(self, queues): """ Purge all messages from one or more queues. :param list queues: A list of ('qname', 'vhost') tuples. :returns: True on success """ for name, vhost in queues: vhost = quote(vhost, '') name = quote(name, '') ...
[ "def", "purge_queues", "(", "self", ",", "queues", ")", ":", "for", "name", ",", "vhost", "in", "queues", ":", "vhost", "=", "quote", "(", "vhost", ",", "''", ")", "name", "=", "quote", "(", "name", ",", "''", ")", "path", "=", "Client", ".", "ur...
Purge all messages from one or more queues. :param list queues: A list of ('qname', 'vhost') tuples. :returns: True on success
[ "Purge", "all", "messages", "from", "one", "or", "more", "queues", "." ]
train
https://github.com/bkjones/pyrabbit/blob/e8a9f74ed5c6bba958994fb9a72c396e6a99ea0f/pyrabbit/api.py#L544-L557
bkjones/pyrabbit
pyrabbit/api.py
Client.purge_queue
def purge_queue(self, vhost, name): """ Purge all messages from a single queue. This is a convenience method so you aren't forced to supply a list containing a single tuple to the purge_queues method. :param string vhost: The vhost of the queue being purged. :param strin...
python
def purge_queue(self, vhost, name): """ Purge all messages from a single queue. This is a convenience method so you aren't forced to supply a list containing a single tuple to the purge_queues method. :param string vhost: The vhost of the queue being purged. :param strin...
[ "def", "purge_queue", "(", "self", ",", "vhost", ",", "name", ")", ":", "vhost", "=", "quote", "(", "vhost", ",", "''", ")", "name", "=", "quote", "(", "name", ",", "''", ")", "path", "=", "Client", ".", "urls", "[", "'purge_queue'", "]", "%", "(...
Purge all messages from a single queue. This is a convenience method so you aren't forced to supply a list containing a single tuple to the purge_queues method. :param string vhost: The vhost of the queue being purged. :param string name: The name of the queue being purged. :rty...
[ "Purge", "all", "messages", "from", "a", "single", "queue", ".", "This", "is", "a", "convenience", "method", "so", "you", "aren", "t", "forced", "to", "supply", "a", "list", "containing", "a", "single", "tuple", "to", "the", "purge_queues", "method", "." ]
train
https://github.com/bkjones/pyrabbit/blob/e8a9f74ed5c6bba958994fb9a72c396e6a99ea0f/pyrabbit/api.py#L559-L573
bkjones/pyrabbit
pyrabbit/api.py
Client.create_queue
def create_queue(self, vhost, name, **kwargs): """ Create a queue. The API documentation specifies that all of the body elements are optional, so this method only requires arguments needed to form the URI :param string vhost: The vhost to create the queue in. :param stri...
python
def create_queue(self, vhost, name, **kwargs): """ Create a queue. The API documentation specifies that all of the body elements are optional, so this method only requires arguments needed to form the URI :param string vhost: The vhost to create the queue in. :param stri...
[ "def", "create_queue", "(", "self", ",", "vhost", ",", "name", ",", "*", "*", "kwargs", ")", ":", "vhost", "=", "quote", "(", "vhost", ",", "''", ")", "name", "=", "quote", "(", "name", ",", "''", ")", "path", "=", "Client", ".", "urls", "[", "...
Create a queue. The API documentation specifies that all of the body elements are optional, so this method only requires arguments needed to form the URI :param string vhost: The vhost to create the queue in. :param string name: The name of the queue More on these operations ca...
[ "Create", "a", "queue", ".", "The", "API", "documentation", "specifies", "that", "all", "of", "the", "body", "elements", "are", "optional", "so", "this", "method", "only", "requires", "arguments", "needed", "to", "form", "the", "URI" ]
train
https://github.com/bkjones/pyrabbit/blob/e8a9f74ed5c6bba958994fb9a72c396e6a99ea0f/pyrabbit/api.py#L575-L598
bkjones/pyrabbit
pyrabbit/api.py
Client.delete_queue
def delete_queue(self, vhost, qname): """ Deletes the named queue from the named vhost. :param string vhost: Vhost housing the queue to be deleted. :param string qname: Name of the queue to delete. Note that if you just want to delete the messages from a queue, you shou...
python
def delete_queue(self, vhost, qname): """ Deletes the named queue from the named vhost. :param string vhost: Vhost housing the queue to be deleted. :param string qname: Name of the queue to delete. Note that if you just want to delete the messages from a queue, you shou...
[ "def", "delete_queue", "(", "self", ",", "vhost", ",", "qname", ")", ":", "vhost", "=", "quote", "(", "vhost", ",", "''", ")", "qname", "=", "quote", "(", "qname", ",", "''", ")", "path", "=", "Client", ".", "urls", "[", "'queues_by_name'", "]", "%...
Deletes the named queue from the named vhost. :param string vhost: Vhost housing the queue to be deleted. :param string qname: Name of the queue to delete. Note that if you just want to delete the messages from a queue, you should use purge_queue instead of deleting/recreating a queue.
[ "Deletes", "the", "named", "queue", "from", "the", "named", "vhost", "." ]
train
https://github.com/bkjones/pyrabbit/blob/e8a9f74ed5c6bba958994fb9a72c396e6a99ea0f/pyrabbit/api.py#L600-L613
bkjones/pyrabbit
pyrabbit/api.py
Client.get_messages
def get_messages(self, vhost, qname, count=1, requeue=False, truncate=None, encoding='auto'): """ Gets <count> messages from the queue. :param string vhost: Name of vhost containing the queue :param string qname: Name of the queue to consume from :param int ...
python
def get_messages(self, vhost, qname, count=1, requeue=False, truncate=None, encoding='auto'): """ Gets <count> messages from the queue. :param string vhost: Name of vhost containing the queue :param string qname: Name of the queue to consume from :param int ...
[ "def", "get_messages", "(", "self", ",", "vhost", ",", "qname", ",", "count", "=", "1", ",", "requeue", "=", "False", ",", "truncate", "=", "None", ",", "encoding", "=", "'auto'", ")", ":", "vhost", "=", "quote", "(", "vhost", ",", "''", ")", "base...
Gets <count> messages from the queue. :param string vhost: Name of vhost containing the queue :param string qname: Name of the queue to consume from :param int count: Number of messages to get. :param bool requeue: Whether to requeue the message after getting it. This will c...
[ "Gets", "<count", ">", "messages", "from", "the", "queue", "." ]
train
https://github.com/bkjones/pyrabbit/blob/e8a9f74ed5c6bba958994fb9a72c396e6a99ea0f/pyrabbit/api.py#L615-L642
bkjones/pyrabbit
pyrabbit/api.py
Client.get_connections
def get_connections(self): """ :returns: list of dicts, or an empty list if there are no connections. """ path = Client.urls['all_connections'] conns = self._call(path, 'GET') return conns
python
def get_connections(self): """ :returns: list of dicts, or an empty list if there are no connections. """ path = Client.urls['all_connections'] conns = self._call(path, 'GET') return conns
[ "def", "get_connections", "(", "self", ")", ":", "path", "=", "Client", ".", "urls", "[", "'all_connections'", "]", "conns", "=", "self", ".", "_call", "(", "path", ",", "'GET'", ")", "return", "conns" ]
:returns: list of dicts, or an empty list if there are no connections.
[ ":", "returns", ":", "list", "of", "dicts", "or", "an", "empty", "list", "if", "there", "are", "no", "connections", "." ]
train
https://github.com/bkjones/pyrabbit/blob/e8a9f74ed5c6bba958994fb9a72c396e6a99ea0f/pyrabbit/api.py#L647-L653
bkjones/pyrabbit
pyrabbit/api.py
Client.get_connection
def get_connection(self, name): """ Get a connection by name. To get the names, use get_connections. :param string name: Name of connection to get :returns dict conn: A connection attribute dictionary. """ name = quote(name, '') path = Client.urls['connections_b...
python
def get_connection(self, name): """ Get a connection by name. To get the names, use get_connections. :param string name: Name of connection to get :returns dict conn: A connection attribute dictionary. """ name = quote(name, '') path = Client.urls['connections_b...
[ "def", "get_connection", "(", "self", ",", "name", ")", ":", "name", "=", "quote", "(", "name", ",", "''", ")", "path", "=", "Client", ".", "urls", "[", "'connections_by_name'", "]", "%", "name", "conn", "=", "self", ".", "_call", "(", "path", ",", ...
Get a connection by name. To get the names, use get_connections. :param string name: Name of connection to get :returns dict conn: A connection attribute dictionary.
[ "Get", "a", "connection", "by", "name", ".", "To", "get", "the", "names", "use", "get_connections", "." ]
train
https://github.com/bkjones/pyrabbit/blob/e8a9f74ed5c6bba958994fb9a72c396e6a99ea0f/pyrabbit/api.py#L655-L666
bkjones/pyrabbit
pyrabbit/api.py
Client.delete_connection
def delete_connection(self, name): """ Close the named connection. The API returns a 204 on success, in which case this method returns True, otherwise the error is raised. :param string name: The name of the connection to delete. :returns bool: True on success. "...
python
def delete_connection(self, name): """ Close the named connection. The API returns a 204 on success, in which case this method returns True, otherwise the error is raised. :param string name: The name of the connection to delete. :returns bool: True on success. "...
[ "def", "delete_connection", "(", "self", ",", "name", ")", ":", "name", "=", "quote", "(", "name", ",", "''", ")", "path", "=", "Client", ".", "urls", "[", "'connections_by_name'", "]", "%", "name", "self", ".", "_call", "(", "path", ",", "'DELETE'", ...
Close the named connection. The API returns a 204 on success, in which case this method returns True, otherwise the error is raised. :param string name: The name of the connection to delete. :returns bool: True on success.
[ "Close", "the", "named", "connection", ".", "The", "API", "returns", "a", "204", "on", "success", "in", "which", "case", "this", "method", "returns", "True", "otherwise", "the", "error", "is", "raised", "." ]
train
https://github.com/bkjones/pyrabbit/blob/e8a9f74ed5c6bba958994fb9a72c396e6a99ea0f/pyrabbit/api.py#L668-L680
bkjones/pyrabbit
pyrabbit/api.py
Client.get_channels
def get_channels(self): """ Return a list of dicts containing details about broker connections. :returns: list of dicts """ path = Client.urls['all_channels'] chans = self._call(path, 'GET') return chans
python
def get_channels(self): """ Return a list of dicts containing details about broker connections. :returns: list of dicts """ path = Client.urls['all_channels'] chans = self._call(path, 'GET') return chans
[ "def", "get_channels", "(", "self", ")", ":", "path", "=", "Client", ".", "urls", "[", "'all_channels'", "]", "chans", "=", "self", ".", "_call", "(", "path", ",", "'GET'", ")", "return", "chans" ]
Return a list of dicts containing details about broker connections. :returns: list of dicts
[ "Return", "a", "list", "of", "dicts", "containing", "details", "about", "broker", "connections", ".", ":", "returns", ":", "list", "of", "dicts" ]
train
https://github.com/bkjones/pyrabbit/blob/e8a9f74ed5c6bba958994fb9a72c396e6a99ea0f/pyrabbit/api.py#L682-L689
bkjones/pyrabbit
pyrabbit/api.py
Client.get_channel
def get_channel(self, name): """ Get a channel by name. To get the names, use get_channels. :param string name: Name of channel to get :returns dict conn: A channel attribute dictionary. """ name = quote(name, '') path = Client.urls['channels_by_name'] % name ...
python
def get_channel(self, name): """ Get a channel by name. To get the names, use get_channels. :param string name: Name of channel to get :returns dict conn: A channel attribute dictionary. """ name = quote(name, '') path = Client.urls['channels_by_name'] % name ...
[ "def", "get_channel", "(", "self", ",", "name", ")", ":", "name", "=", "quote", "(", "name", ",", "''", ")", "path", "=", "Client", ".", "urls", "[", "'channels_by_name'", "]", "%", "name", "chan", "=", "self", ".", "_call", "(", "path", ",", "'GET...
Get a channel by name. To get the names, use get_channels. :param string name: Name of channel to get :returns dict conn: A channel attribute dictionary.
[ "Get", "a", "channel", "by", "name", ".", "To", "get", "the", "names", "use", "get_channels", "." ]
train
https://github.com/bkjones/pyrabbit/blob/e8a9f74ed5c6bba958994fb9a72c396e6a99ea0f/pyrabbit/api.py#L691-L702
bkjones/pyrabbit
pyrabbit/api.py
Client.get_bindings
def get_bindings(self): """ :returns: list of dicts """ path = Client.urls['all_bindings'] bindings = self._call(path, 'GET') return bindings
python
def get_bindings(self): """ :returns: list of dicts """ path = Client.urls['all_bindings'] bindings = self._call(path, 'GET') return bindings
[ "def", "get_bindings", "(", "self", ")", ":", "path", "=", "Client", ".", "urls", "[", "'all_bindings'", "]", "bindings", "=", "self", ".", "_call", "(", "path", ",", "'GET'", ")", "return", "bindings" ]
:returns: list of dicts
[ ":", "returns", ":", "list", "of", "dicts" ]
train
https://github.com/bkjones/pyrabbit/blob/e8a9f74ed5c6bba958994fb9a72c396e6a99ea0f/pyrabbit/api.py#L704-L711
bkjones/pyrabbit
pyrabbit/api.py
Client.get_queue_bindings
def get_queue_bindings(self, vhost, qname): """ Return a list of dicts, one dict per binding. The dict format coming from RabbitMQ for queue named 'testq' is: {"source":"sourceExch","vhost":"/","destination":"testq", "destination_type":"queue","routing_key":"*.*","arguments":{}...
python
def get_queue_bindings(self, vhost, qname): """ Return a list of dicts, one dict per binding. The dict format coming from RabbitMQ for queue named 'testq' is: {"source":"sourceExch","vhost":"/","destination":"testq", "destination_type":"queue","routing_key":"*.*","arguments":{}...
[ "def", "get_queue_bindings", "(", "self", ",", "vhost", ",", "qname", ")", ":", "vhost", "=", "quote", "(", "vhost", ",", "''", ")", "qname", "=", "quote", "(", "qname", ",", "''", ")", "path", "=", "Client", ".", "urls", "[", "'bindings_on_queue'", ...
Return a list of dicts, one dict per binding. The dict format coming from RabbitMQ for queue named 'testq' is: {"source":"sourceExch","vhost":"/","destination":"testq", "destination_type":"queue","routing_key":"*.*","arguments":{}, "properties_key":"%2A.%2A"}
[ "Return", "a", "list", "of", "dicts", "one", "dict", "per", "binding", ".", "The", "dict", "format", "coming", "from", "RabbitMQ", "for", "queue", "named", "testq", "is", ":" ]
train
https://github.com/bkjones/pyrabbit/blob/e8a9f74ed5c6bba958994fb9a72c396e6a99ea0f/pyrabbit/api.py#L713-L726
bkjones/pyrabbit
pyrabbit/api.py
Client.create_binding
def create_binding(self, vhost, exchange, queue, rt_key=None, args=None): """ Creates a binding between an exchange and a queue on a given vhost. :param string vhost: vhost housing the exchange/queue to bind :param string exchange: the target exchange of the binding :param strin...
python
def create_binding(self, vhost, exchange, queue, rt_key=None, args=None): """ Creates a binding between an exchange and a queue on a given vhost. :param string vhost: vhost housing the exchange/queue to bind :param string exchange: the target exchange of the binding :param strin...
[ "def", "create_binding", "(", "self", ",", "vhost", ",", "exchange", ",", "queue", ",", "rt_key", "=", "None", ",", "args", "=", "None", ")", ":", "vhost", "=", "quote", "(", "vhost", ",", "''", ")", "exchange", "=", "quote", "(", "exchange", ",", ...
Creates a binding between an exchange and a queue on a given vhost. :param string vhost: vhost housing the exchange/queue to bind :param string exchange: the target exchange of the binding :param string queue: the queue to bind to the exchange :param string rt_key: the routing key to us...
[ "Creates", "a", "binding", "between", "an", "exchange", "and", "a", "queue", "on", "a", "given", "vhost", "." ]
train
https://github.com/bkjones/pyrabbit/blob/e8a9f74ed5c6bba958994fb9a72c396e6a99ea0f/pyrabbit/api.py#L737-L758
bkjones/pyrabbit
pyrabbit/api.py
Client.delete_binding
def delete_binding(self, vhost, exchange, queue, rt_key): """ Deletes a binding between an exchange and a queue on a given vhost. :param string vhost: vhost housing the exchange/queue to bind :param string exchange: the target exchange of the binding :param string queue: the que...
python
def delete_binding(self, vhost, exchange, queue, rt_key): """ Deletes a binding between an exchange and a queue on a given vhost. :param string vhost: vhost housing the exchange/queue to bind :param string exchange: the target exchange of the binding :param string queue: the que...
[ "def", "delete_binding", "(", "self", ",", "vhost", ",", "exchange", ",", "queue", ",", "rt_key", ")", ":", "vhost", "=", "quote", "(", "vhost", ",", "''", ")", "exchange", "=", "quote", "(", "exchange", ",", "''", ")", "queue", "=", "quote", "(", ...
Deletes a binding between an exchange and a queue on a given vhost. :param string vhost: vhost housing the exchange/queue to bind :param string exchange: the target exchange of the binding :param string queue: the queue to bind to the exchange :param string rt_key: the routing key to us...
[ "Deletes", "a", "binding", "between", "an", "exchange", "and", "a", "queue", "on", "a", "given", "vhost", "." ]
train
https://github.com/bkjones/pyrabbit/blob/e8a9f74ed5c6bba958994fb9a72c396e6a99ea0f/pyrabbit/api.py#L760-L778
bkjones/pyrabbit
pyrabbit/api.py
Client.create_user
def create_user(self, username, password, tags=""): """ Creates a user. :param string username: The name to give to the new user :param string password: Password for the new user :param string tags: Comma-separated list of tags for the user :returns: boolean """ ...
python
def create_user(self, username, password, tags=""): """ Creates a user. :param string username: The name to give to the new user :param string password: Password for the new user :param string tags: Comma-separated list of tags for the user :returns: boolean """ ...
[ "def", "create_user", "(", "self", ",", "username", ",", "password", ",", "tags", "=", "\"\"", ")", ":", "path", "=", "Client", ".", "urls", "[", "'users_by_name'", "]", "%", "username", "body", "=", "json", ".", "dumps", "(", "{", "'password'", ":", ...
Creates a user. :param string username: The name to give to the new user :param string password: Password for the new user :param string tags: Comma-separated list of tags for the user :returns: boolean
[ "Creates", "a", "user", "." ]
train
https://github.com/bkjones/pyrabbit/blob/e8a9f74ed5c6bba958994fb9a72c396e6a99ea0f/pyrabbit/api.py#L780-L792
bkjones/pyrabbit
pyrabbit/api.py
Client.delete_user
def delete_user(self, username): """ Deletes a user from the server. :param string username: Name of the user to delete from the server. """ path = Client.urls['users_by_name'] % username return self._call(path, 'DELETE')
python
def delete_user(self, username): """ Deletes a user from the server. :param string username: Name of the user to delete from the server. """ path = Client.urls['users_by_name'] % username return self._call(path, 'DELETE')
[ "def", "delete_user", "(", "self", ",", "username", ")", ":", "path", "=", "Client", ".", "urls", "[", "'users_by_name'", "]", "%", "username", "return", "self", ".", "_call", "(", "path", ",", "'DELETE'", ")" ]
Deletes a user from the server. :param string username: Name of the user to delete from the server.
[ "Deletes", "a", "user", "from", "the", "server", "." ]
train
https://github.com/bkjones/pyrabbit/blob/e8a9f74ed5c6bba958994fb9a72c396e6a99ea0f/pyrabbit/api.py#L794-L801
bartTC/django-wakawaka
wakawaka/views.py
index
def index(request): """ Redirects to the default wiki index name. """ kwargs = {'slug': getattr(settings, 'WAKAWAKA_DEFAULT_INDEX', 'WikiIndex')} redirect_to = reverse('wakawaka_page', kwargs=kwargs) return HttpResponseRedirect(redirect_to)
python
def index(request): """ Redirects to the default wiki index name. """ kwargs = {'slug': getattr(settings, 'WAKAWAKA_DEFAULT_INDEX', 'WikiIndex')} redirect_to = reverse('wakawaka_page', kwargs=kwargs) return HttpResponseRedirect(redirect_to)
[ "def", "index", "(", "request", ")", ":", "kwargs", "=", "{", "'slug'", ":", "getattr", "(", "settings", ",", "'WAKAWAKA_DEFAULT_INDEX'", ",", "'WikiIndex'", ")", "}", "redirect_to", "=", "reverse", "(", "'wakawaka_page'", ",", "kwargs", "=", "kwargs", ")", ...
Redirects to the default wiki index name.
[ "Redirects", "to", "the", "default", "wiki", "index", "name", "." ]
train
https://github.com/bartTC/django-wakawaka/blob/95daff9703a1de07d3393e4b2145bcb903f80e72/wakawaka/views.py#L21-L27
bartTC/django-wakawaka
wakawaka/views.py
page
def page( request, slug, rev_id=None, template_name='wakawaka/page.html', extra_context=None, ): """ Displays a wiki page. Redirects to the edit view if the page doesn't exist. """ try: queryset = WikiPage.objects.all() page = queryset.get(slug=slug) rev = pag...
python
def page( request, slug, rev_id=None, template_name='wakawaka/page.html', extra_context=None, ): """ Displays a wiki page. Redirects to the edit view if the page doesn't exist. """ try: queryset = WikiPage.objects.all() page = queryset.get(slug=slug) rev = pag...
[ "def", "page", "(", "request", ",", "slug", ",", "rev_id", "=", "None", ",", "template_name", "=", "'wakawaka/page.html'", ",", "extra_context", "=", "None", ",", ")", ":", "try", ":", "queryset", "=", "WikiPage", ".", "objects", ".", "all", "(", ")", ...
Displays a wiki page. Redirects to the edit view if the page doesn't exist.
[ "Displays", "a", "wiki", "page", ".", "Redirects", "to", "the", "edit", "view", "if", "the", "page", "doesn", "t", "exist", "." ]
train
https://github.com/bartTC/django-wakawaka/blob/95daff9703a1de07d3393e4b2145bcb903f80e72/wakawaka/views.py#L30-L63
bartTC/django-wakawaka
wakawaka/views.py
edit
def edit( request, slug, rev_id=None, template_name='wakawaka/edit.html', extra_context=None, wiki_page_form=WikiPageForm, wiki_delete_form=DeleteWikiPageForm, ): """ Displays the form for editing and deleting a page. """ # Get the page for slug and get a specific revision, i...
python
def edit( request, slug, rev_id=None, template_name='wakawaka/edit.html', extra_context=None, wiki_page_form=WikiPageForm, wiki_delete_form=DeleteWikiPageForm, ): """ Displays the form for editing and deleting a page. """ # Get the page for slug and get a specific revision, i...
[ "def", "edit", "(", "request", ",", "slug", ",", "rev_id", "=", "None", ",", "template_name", "=", "'wakawaka/edit.html'", ",", "extra_context", "=", "None", ",", "wiki_page_form", "=", "WikiPageForm", ",", "wiki_delete_form", "=", "DeleteWikiPageForm", ",", ")"...
Displays the form for editing and deleting a page.
[ "Displays", "the", "form", "for", "editing", "and", "deleting", "a", "page", "." ]
train
https://github.com/bartTC/django-wakawaka/blob/95daff9703a1de07d3393e4b2145bcb903f80e72/wakawaka/views.py#L66-L178
bartTC/django-wakawaka
wakawaka/views.py
revisions
def revisions( request, slug, template_name='wakawaka/revisions.html', extra_context=None ): """ Displays the list of all revisions for a specific WikiPage """ queryset = WikiPage.objects.all() page = get_object_or_404(queryset, slug=slug) template_context = {'page': page} template_cont...
python
def revisions( request, slug, template_name='wakawaka/revisions.html', extra_context=None ): """ Displays the list of all revisions for a specific WikiPage """ queryset = WikiPage.objects.all() page = get_object_or_404(queryset, slug=slug) template_context = {'page': page} template_cont...
[ "def", "revisions", "(", "request", ",", "slug", ",", "template_name", "=", "'wakawaka/revisions.html'", ",", "extra_context", "=", "None", ")", ":", "queryset", "=", "WikiPage", ".", "objects", ".", "all", "(", ")", "page", "=", "get_object_or_404", "(", "q...
Displays the list of all revisions for a specific WikiPage
[ "Displays", "the", "list", "of", "all", "revisions", "for", "a", "specific", "WikiPage" ]
train
https://github.com/bartTC/django-wakawaka/blob/95daff9703a1de07d3393e4b2145bcb903f80e72/wakawaka/views.py#L181-L192
bartTC/django-wakawaka
wakawaka/views.py
changes
def changes( request, slug, template_name='wakawaka/changes.html', extra_context=None ): """ Displays the changes between two revisions. """ rev_a_id = request.GET.get('a', None) rev_b_id = request.GET.get('b', None) # Some stinky fingers manipulated the url if not rev_a_id or not rev_b...
python
def changes( request, slug, template_name='wakawaka/changes.html', extra_context=None ): """ Displays the changes between two revisions. """ rev_a_id = request.GET.get('a', None) rev_b_id = request.GET.get('b', None) # Some stinky fingers manipulated the url if not rev_a_id or not rev_b...
[ "def", "changes", "(", "request", ",", "slug", ",", "template_name", "=", "'wakawaka/changes.html'", ",", "extra_context", "=", "None", ")", ":", "rev_a_id", "=", "request", ".", "GET", ".", "get", "(", "'a'", ",", "None", ")", "rev_b_id", "=", "request", ...
Displays the changes between two revisions.
[ "Displays", "the", "changes", "between", "two", "revisions", "." ]
train
https://github.com/bartTC/django-wakawaka/blob/95daff9703a1de07d3393e4b2145bcb903f80e72/wakawaka/views.py#L195-L236
bartTC/django-wakawaka
wakawaka/views.py
revision_list
def revision_list( request, template_name='wakawaka/revision_list.html', extra_context=None ): """ Displays a list of all recent revisions. """ revision_list = Revision.objects.all() template_context = {'revision_list': revision_list} template_context.update(extra_context or {}) return r...
python
def revision_list( request, template_name='wakawaka/revision_list.html', extra_context=None ): """ Displays a list of all recent revisions. """ revision_list = Revision.objects.all() template_context = {'revision_list': revision_list} template_context.update(extra_context or {}) return r...
[ "def", "revision_list", "(", "request", ",", "template_name", "=", "'wakawaka/revision_list.html'", ",", "extra_context", "=", "None", ")", ":", "revision_list", "=", "Revision", ".", "objects", ".", "all", "(", ")", "template_context", "=", "{", "'revision_list'"...
Displays a list of all recent revisions.
[ "Displays", "a", "list", "of", "all", "recent", "revisions", "." ]
train
https://github.com/bartTC/django-wakawaka/blob/95daff9703a1de07d3393e4b2145bcb903f80e72/wakawaka/views.py#L240-L249
bartTC/django-wakawaka
wakawaka/views.py
page_list
def page_list( request, template_name='wakawaka/page_list.html', extra_context=None ): """ Displays all Pages """ page_list = WikiPage.objects.all() page_list = page_list.order_by('slug') template_context = { 'page_list': page_list, 'index_slug': getattr(settings, 'WAKAWAKA_...
python
def page_list( request, template_name='wakawaka/page_list.html', extra_context=None ): """ Displays all Pages """ page_list = WikiPage.objects.all() page_list = page_list.order_by('slug') template_context = { 'page_list': page_list, 'index_slug': getattr(settings, 'WAKAWAKA_...
[ "def", "page_list", "(", "request", ",", "template_name", "=", "'wakawaka/page_list.html'", ",", "extra_context", "=", "None", ")", ":", "page_list", "=", "WikiPage", ".", "objects", ".", "all", "(", ")", "page_list", "=", "page_list", ".", "order_by", "(", ...
Displays all Pages
[ "Displays", "all", "Pages" ]
train
https://github.com/bartTC/django-wakawaka/blob/95daff9703a1de07d3393e4b2145bcb903f80e72/wakawaka/views.py#L252-L266
bartTC/django-wakawaka
wakawaka/forms.py
DeleteWikiPageForm.delete_wiki
def delete_wiki(self, request, page, rev): """ Deletes the page with all revisions or the revision, based on the users choice. Returns a HttpResponseRedirect. """ # Delete the page if ( self.cleaned_data.get('delete') == 'page' and reques...
python
def delete_wiki(self, request, page, rev): """ Deletes the page with all revisions or the revision, based on the users choice. Returns a HttpResponseRedirect. """ # Delete the page if ( self.cleaned_data.get('delete') == 'page' and reques...
[ "def", "delete_wiki", "(", "self", ",", "request", ",", "page", ",", "rev", ")", ":", "# Delete the page", "if", "(", "self", ".", "cleaned_data", ".", "get", "(", "'delete'", ")", "==", "'page'", "and", "request", ".", "user", ".", "has_perm", "(", "'...
Deletes the page with all revisions or the revision, based on the users choice. Returns a HttpResponseRedirect.
[ "Deletes", "the", "page", "with", "all", "revisions", "or", "the", "revision", "based", "on", "the", "users", "choice", "." ]
train
https://github.com/bartTC/django-wakawaka/blob/95daff9703a1de07d3393e4b2145bcb903f80e72/wakawaka/forms.py#L62-L131
noirbizarre/django-eztables
eztables/views.py
get_real_field
def get_real_field(model, field_name): ''' Get the real field from a model given its name. Handle nested models recursively (aka. ``__`` lookups) ''' parts = field_name.split('__') field = model._meta.get_field(parts[0]) if len(parts) == 1: return model._meta.get_field(field_name) ...
python
def get_real_field(model, field_name): ''' Get the real field from a model given its name. Handle nested models recursively (aka. ``__`` lookups) ''' parts = field_name.split('__') field = model._meta.get_field(parts[0]) if len(parts) == 1: return model._meta.get_field(field_name) ...
[ "def", "get_real_field", "(", "model", ",", "field_name", ")", ":", "parts", "=", "field_name", ".", "split", "(", "'__'", ")", "field", "=", "model", ".", "_meta", ".", "get_field", "(", "parts", "[", "0", "]", ")", "if", "len", "(", "parts", ")", ...
Get the real field from a model given its name. Handle nested models recursively (aka. ``__`` lookups)
[ "Get", "the", "real", "field", "from", "a", "model", "given", "its", "name", "." ]
train
https://github.com/noirbizarre/django-eztables/blob/347e74dcc08121d20f4cf942181d873dbe33b995/eztables/views.py#L35-L48
noirbizarre/django-eztables
eztables/views.py
DatatablesView.can_regex
def can_regex(self, field): '''Test if a given field supports regex lookups''' from django.conf import settings if settings.DATABASES['default']['ENGINE'].endswith('sqlite3'): return not isinstance(get_real_field(self.model, field), UNSUPPORTED_REGEX_FIELDS) else: ...
python
def can_regex(self, field): '''Test if a given field supports regex lookups''' from django.conf import settings if settings.DATABASES['default']['ENGINE'].endswith('sqlite3'): return not isinstance(get_real_field(self.model, field), UNSUPPORTED_REGEX_FIELDS) else: ...
[ "def", "can_regex", "(", "self", ",", "field", ")", ":", "from", "django", ".", "conf", "import", "settings", "if", "settings", ".", "DATABASES", "[", "'default'", "]", "[", "'ENGINE'", "]", ".", "endswith", "(", "'sqlite3'", ")", ":", "return", "not", ...
Test if a given field supports regex lookups
[ "Test", "if", "a", "given", "field", "supports", "regex", "lookups" ]
train
https://github.com/noirbizarre/django-eztables/blob/347e74dcc08121d20f4cf942181d873dbe33b995/eztables/views.py#L95-L101
noirbizarre/django-eztables
eztables/views.py
DatatablesView.get_orders
def get_orders(self): '''Get ordering fields for ``QuerySet.order_by``''' orders = [] iSortingCols = self.dt_data['iSortingCols'] dt_orders = [(self.dt_data['iSortCol_%s' % i], self.dt_data['sSortDir_%s' % i]) for i in xrange(iSortingCols)] for field_idx, field_dir in dt_orders: ...
python
def get_orders(self): '''Get ordering fields for ``QuerySet.order_by``''' orders = [] iSortingCols = self.dt_data['iSortingCols'] dt_orders = [(self.dt_data['iSortCol_%s' % i], self.dt_data['sSortDir_%s' % i]) for i in xrange(iSortingCols)] for field_idx, field_dir in dt_orders: ...
[ "def", "get_orders", "(", "self", ")", ":", "orders", "=", "[", "]", "iSortingCols", "=", "self", ".", "dt_data", "[", "'iSortingCols'", "]", "dt_orders", "=", "[", "(", "self", ".", "dt_data", "[", "'iSortCol_%s'", "%", "i", "]", ",", "self", ".", "...
Get ordering fields for ``QuerySet.order_by``
[ "Get", "ordering", "fields", "for", "QuerySet", ".", "order_by" ]
train
https://github.com/noirbizarre/django-eztables/blob/347e74dcc08121d20f4cf942181d873dbe33b995/eztables/views.py#L103-L124
noirbizarre/django-eztables
eztables/views.py
DatatablesView.global_search
def global_search(self, queryset): '''Filter a queryset with global search''' search = self.dt_data['sSearch'] if search: if self.dt_data['bRegex']: criterions = [ Q(**{'%s__iregex' % field: search}) for field in self.get_db_fie...
python
def global_search(self, queryset): '''Filter a queryset with global search''' search = self.dt_data['sSearch'] if search: if self.dt_data['bRegex']: criterions = [ Q(**{'%s__iregex' % field: search}) for field in self.get_db_fie...
[ "def", "global_search", "(", "self", ",", "queryset", ")", ":", "search", "=", "self", ".", "dt_data", "[", "'sSearch'", "]", "if", "search", ":", "if", "self", ".", "dt_data", "[", "'bRegex'", "]", ":", "criterions", "=", "[", "Q", "(", "*", "*", ...
Filter a queryset with global search
[ "Filter", "a", "queryset", "with", "global", "search" ]
train
https://github.com/noirbizarre/django-eztables/blob/347e74dcc08121d20f4cf942181d873dbe33b995/eztables/views.py#L126-L144
noirbizarre/django-eztables
eztables/views.py
DatatablesView.column_search
def column_search(self, queryset): '''Filter a queryset with column search''' for idx in xrange(self.dt_data['iColumns']): search = self.dt_data['sSearch_%s' % idx] if search: if hasattr(self, 'search_col_%s' % idx): custom_search = getattr(sel...
python
def column_search(self, queryset): '''Filter a queryset with column search''' for idx in xrange(self.dt_data['iColumns']): search = self.dt_data['sSearch_%s' % idx] if search: if hasattr(self, 'search_col_%s' % idx): custom_search = getattr(sel...
[ "def", "column_search", "(", "self", ",", "queryset", ")", ":", "for", "idx", "in", "xrange", "(", "self", ".", "dt_data", "[", "'iColumns'", "]", ")", ":", "search", "=", "self", ".", "dt_data", "[", "'sSearch_%s'", "%", "idx", "]", "if", "search", ...
Filter a queryset with column search
[ "Filter", "a", "queryset", "with", "column", "search" ]
train
https://github.com/noirbizarre/django-eztables/blob/347e74dcc08121d20f4cf942181d873dbe33b995/eztables/views.py#L146-L167
noirbizarre/django-eztables
eztables/views.py
DatatablesView.get_queryset
def get_queryset(self): '''Apply Datatables sort and search criterion to QuerySet''' qs = super(DatatablesView, self).get_queryset() # Perform global search qs = self.global_search(qs) # Perform column search qs = self.column_search(qs) # Return the ordered querys...
python
def get_queryset(self): '''Apply Datatables sort and search criterion to QuerySet''' qs = super(DatatablesView, self).get_queryset() # Perform global search qs = self.global_search(qs) # Perform column search qs = self.column_search(qs) # Return the ordered querys...
[ "def", "get_queryset", "(", "self", ")", ":", "qs", "=", "super", "(", "DatatablesView", ",", "self", ")", ".", "get_queryset", "(", ")", "# Perform global search", "qs", "=", "self", ".", "global_search", "(", "qs", ")", "# Perform column search", "qs", "="...
Apply Datatables sort and search criterion to QuerySet
[ "Apply", "Datatables", "sort", "and", "search", "criterion", "to", "QuerySet" ]
train
https://github.com/noirbizarre/django-eztables/blob/347e74dcc08121d20f4cf942181d873dbe33b995/eztables/views.py#L169-L177