partition
stringclasses
3 values
func_name
stringlengths
1
134
docstring
stringlengths
1
46.9k
path
stringlengths
4
223
original_string
stringlengths
75
104k
code
stringlengths
75
104k
docstring_tokens
listlengths
1
1.97k
repo
stringlengths
7
55
language
stringclasses
1 value
url
stringlengths
87
315
code_tokens
listlengths
19
28.4k
sha
stringlengths
40
40
train
Indexable.index
Adds or updates a document to the index :arg document: Python dict of key/value pairs representing the document .. Note:: This must be serializable into JSON. :arg id_: the id of the document .. Note:: If you don't provide an ``id_`...
elasticutils/__init__.py
def index(cls, document, id_=None, overwrite_existing=True, es=None, index=None): """Adds or updates a document to the index :arg document: Python dict of key/value pairs representing the document .. Note:: This must be serializable into JSON. ...
def index(cls, document, id_=None, overwrite_existing=True, es=None, index=None): """Adds or updates a document to the index :arg document: Python dict of key/value pairs representing the document .. Note:: This must be serializable into JSON. ...
[ "Adds", "or", "updates", "a", "document", "to", "the", "index" ]
mozilla/elasticutils
python
https://github.com/mozilla/elasticutils/blob/b880cc5d51fb1079b0581255ec664c1ec934656e/elasticutils/__init__.py#L2182-L2227
[ "def", "index", "(", "cls", ",", "document", ",", "id_", "=", "None", ",", "overwrite_existing", "=", "True", ",", "es", "=", "None", ",", "index", "=", "None", ")", ":", "if", "es", "is", "None", ":", "es", "=", "cls", ".", "get_es", "(", ")", ...
b880cc5d51fb1079b0581255ec664c1ec934656e
train
Indexable.bulk_index
Adds or updates a batch of documents. :arg documents: List of Python dicts representing individual documents to be added to the index .. Note:: This must be serializable into JSON. :arg id_field: The name of the field to use as the document id. This...
elasticutils/__init__.py
def bulk_index(cls, documents, id_field='id', es=None, index=None): """Adds or updates a batch of documents. :arg documents: List of Python dicts representing individual documents to be added to the index .. Note:: This must be serializable into JSON. :...
def bulk_index(cls, documents, id_field='id', es=None, index=None): """Adds or updates a batch of documents. :arg documents: List of Python dicts representing individual documents to be added to the index .. Note:: This must be serializable into JSON. :...
[ "Adds", "or", "updates", "a", "batch", "of", "documents", "." ]
mozilla/elasticutils
python
https://github.com/mozilla/elasticutils/blob/b880cc5d51fb1079b0581255ec664c1ec934656e/elasticutils/__init__.py#L2230-L2270
[ "def", "bulk_index", "(", "cls", ",", "documents", ",", "id_field", "=", "'id'", ",", "es", "=", "None", ",", "index", "=", "None", ")", ":", "if", "es", "is", "None", ":", "es", "=", "cls", ".", "get_es", "(", ")", "if", "index", "is", "None", ...
b880cc5d51fb1079b0581255ec664c1ec934656e
train
Indexable.unindex
Removes a particular item from the search index. :arg id_: The Elasticsearch id for the document to remove from the index. :arg es: The `Elasticsearch` to use. If you don't specify an `Elasticsearch`, it'll use `cls.get_es()`. :arg index: The name of the index to use. ...
elasticutils/__init__.py
def unindex(cls, id_, es=None, index=None): """Removes a particular item from the search index. :arg id_: The Elasticsearch id for the document to remove from the index. :arg es: The `Elasticsearch` to use. If you don't specify an `Elasticsearch`, it'll use `cls.get_es(...
def unindex(cls, id_, es=None, index=None): """Removes a particular item from the search index. :arg id_: The Elasticsearch id for the document to remove from the index. :arg es: The `Elasticsearch` to use. If you don't specify an `Elasticsearch`, it'll use `cls.get_es(...
[ "Removes", "a", "particular", "item", "from", "the", "search", "index", "." ]
mozilla/elasticutils
python
https://github.com/mozilla/elasticutils/blob/b880cc5d51fb1079b0581255ec664c1ec934656e/elasticutils/__init__.py#L2273-L2292
[ "def", "unindex", "(", "cls", ",", "id_", ",", "es", "=", "None", ",", "index", "=", "None", ")", ":", "if", "es", "is", "None", ":", "es", "=", "cls", ".", "get_es", "(", ")", "if", "index", "is", "None", ":", "index", "=", "cls", ".", "get_...
b880cc5d51fb1079b0581255ec664c1ec934656e
train
Indexable.refresh_index
Refreshes the index. Elasticsearch will update the index periodically automatically. If you need to see the documents you just indexed in your search results right now, you should call `refresh_index` as soon as you're done indexing. This is particularly helpful for unit tests. ...
elasticutils/__init__.py
def refresh_index(cls, es=None, index=None): """Refreshes the index. Elasticsearch will update the index periodically automatically. If you need to see the documents you just indexed in your search results right now, you should call `refresh_index` as soon as you're done indexin...
def refresh_index(cls, es=None, index=None): """Refreshes the index. Elasticsearch will update the index periodically automatically. If you need to see the documents you just indexed in your search results right now, you should call `refresh_index` as soon as you're done indexin...
[ "Refreshes", "the", "index", "." ]
mozilla/elasticutils
python
https://github.com/mozilla/elasticutils/blob/b880cc5d51fb1079b0581255ec664c1ec934656e/elasticutils/__init__.py#L2295-L2317
[ "def", "refresh_index", "(", "cls", ",", "es", "=", "None", ",", "index", "=", "None", ")", ":", "if", "es", "is", "None", ":", "es", "=", "cls", ".", "get_es", "(", ")", "if", "index", "is", "None", ":", "index", "=", "cls", ".", "get_index", ...
b880cc5d51fb1079b0581255ec664c1ec934656e
train
monkeypatch_es
Monkey patch for elasticsearch-py 1.0+ to make it work with ES 0.90 1. tweaks elasticsearch.client.bulk to normalize return status codes .. Note:: We can nix this whe we drop support for ES 0.90.
elasticutils/monkeypatch.py
def monkeypatch_es(): """Monkey patch for elasticsearch-py 1.0+ to make it work with ES 0.90 1. tweaks elasticsearch.client.bulk to normalize return status codes .. Note:: We can nix this whe we drop support for ES 0.90. """ if _monkeypatched_es: return def normalize_bulk_ret...
def monkeypatch_es(): """Monkey patch for elasticsearch-py 1.0+ to make it work with ES 0.90 1. tweaks elasticsearch.client.bulk to normalize return status codes .. Note:: We can nix this whe we drop support for ES 0.90. """ if _monkeypatched_es: return def normalize_bulk_ret...
[ "Monkey", "patch", "for", "elasticsearch", "-", "py", "1", ".", "0", "+", "to", "make", "it", "work", "with", "ES", "0", ".", "90" ]
mozilla/elasticutils
python
https://github.com/mozilla/elasticutils/blob/b880cc5d51fb1079b0581255ec664c1ec934656e/elasticutils/monkeypatch.py#L9-L40
[ "def", "monkeypatch_es", "(", ")", ":", "if", "_monkeypatched_es", ":", "return", "def", "normalize_bulk_return", "(", "fun", ")", ":", "\"\"\"Set's \"ok\" based on \"status\" if \"status\" exists\"\"\"", "@", "wraps", "(", "fun", ")", "def", "_fixed_bulk", "(", "self...
b880cc5d51fb1079b0581255ec664c1ec934656e
train
EntriesView.get_context_data
Returns view context dictionary. :rtype: dict.
wagtailplus/wagtailrelations/views.py
def get_context_data(self, **kwargs): """ Returns view context dictionary. :rtype: dict. """ kwargs.update({ 'entries': Entry.objects.get_for_tag( self.kwargs.get('slug', 0) ) }) return super(EntriesView, self).get_context...
def get_context_data(self, **kwargs): """ Returns view context dictionary. :rtype: dict. """ kwargs.update({ 'entries': Entry.objects.get_for_tag( self.kwargs.get('slug', 0) ) }) return super(EntriesView, self).get_context...
[ "Returns", "view", "context", "dictionary", "." ]
rfosterslo/wagtailplus
python
https://github.com/rfosterslo/wagtailplus/blob/22cac857175d8a6f77e470751831c14a92ccd768/wagtailplus/wagtailrelations/views.py#L28-L40
[ "def", "get_context_data", "(", "self", ",", "*", "*", "kwargs", ")", ":", "kwargs", ".", "update", "(", "{", "'entries'", ":", "Entry", ".", "objects", ".", "get_for_tag", "(", "self", ".", "kwargs", ".", "get", "(", "'slug'", ",", "0", ")", ")", ...
22cac857175d8a6f77e470751831c14a92ccd768
train
Keyring.get_password
Read the password from the file.
keyrings/alt/file_base.py
def get_password(self, service, username): """ Read the password from the file. """ assoc = self._generate_assoc(service, username) service = escape_for_ini(service) username = escape_for_ini(username) # load the passwords from the file config = configpar...
def get_password(self, service, username): """ Read the password from the file. """ assoc = self._generate_assoc(service, username) service = escape_for_ini(service) username = escape_for_ini(username) # load the passwords from the file config = configpar...
[ "Read", "the", "password", "from", "the", "file", "." ]
jaraco/keyrings.alt
python
https://github.com/jaraco/keyrings.alt/blob/5b71223d12bf9ac6abd05b1b395f1efccb5ea660/keyrings/alt/file_base.py#L96-L123
[ "def", "get_password", "(", "self", ",", "service", ",", "username", ")", ":", "assoc", "=", "self", ".", "_generate_assoc", "(", "service", ",", "username", ")", "service", "=", "escape_for_ini", "(", "service", ")", "username", "=", "escape_for_ini", "(", ...
5b71223d12bf9ac6abd05b1b395f1efccb5ea660
train
Keyring.set_password
Write the password in the file.
keyrings/alt/file_base.py
def set_password(self, service, username, password): """Write the password in the file. """ if not username: # https://github.com/jaraco/keyrings.alt/issues/21 raise ValueError("Username cannot be blank.") if not isinstance(password, string_types): rai...
def set_password(self, service, username, password): """Write the password in the file. """ if not username: # https://github.com/jaraco/keyrings.alt/issues/21 raise ValueError("Username cannot be blank.") if not isinstance(password, string_types): rai...
[ "Write", "the", "password", "in", "the", "file", "." ]
jaraco/keyrings.alt
python
https://github.com/jaraco/keyrings.alt/blob/5b71223d12bf9ac6abd05b1b395f1efccb5ea660/keyrings/alt/file_base.py#L125-L139
[ "def", "set_password", "(", "self", ",", "service", ",", "username", ",", "password", ")", ":", "if", "not", "username", ":", "# https://github.com/jaraco/keyrings.alt/issues/21", "raise", "ValueError", "(", "\"Username cannot be blank.\"", ")", "if", "not", "isinstan...
5b71223d12bf9ac6abd05b1b395f1efccb5ea660
train
Keyring._ensure_file_path
Ensure the storage path exists. If it doesn't, create it with "go-rwx" permissions.
keyrings/alt/file_base.py
def _ensure_file_path(self): """ Ensure the storage path exists. If it doesn't, create it with "go-rwx" permissions. """ storage_root = os.path.dirname(self.file_path) needs_storage_root = storage_root and not os.path.isdir(storage_root) if needs_storage_root: # ...
def _ensure_file_path(self): """ Ensure the storage path exists. If it doesn't, create it with "go-rwx" permissions. """ storage_root = os.path.dirname(self.file_path) needs_storage_root = storage_root and not os.path.isdir(storage_root) if needs_storage_root: # ...
[ "Ensure", "the", "storage", "path", "exists", ".", "If", "it", "doesn", "t", "create", "it", "with", "go", "-", "rwx", "permissions", "." ]
jaraco/keyrings.alt
python
https://github.com/jaraco/keyrings.alt/blob/5b71223d12bf9ac6abd05b1b395f1efccb5ea660/keyrings/alt/file_base.py#L167-L181
[ "def", "_ensure_file_path", "(", "self", ")", ":", "storage_root", "=", "os", ".", "path", ".", "dirname", "(", "self", ".", "file_path", ")", "needs_storage_root", "=", "storage_root", "and", "not", "os", ".", "path", ".", "isdir", "(", "storage_root", ")...
5b71223d12bf9ac6abd05b1b395f1efccb5ea660
train
Keyring.delete_password
Delete the password for the username of the service.
keyrings/alt/file_base.py
def delete_password(self, service, username): """Delete the password for the username of the service. """ service = escape_for_ini(service) username = escape_for_ini(username) config = configparser.RawConfigParser() if os.path.exists(self.file_path): config.re...
def delete_password(self, service, username): """Delete the password for the username of the service. """ service = escape_for_ini(service) username = escape_for_ini(username) config = configparser.RawConfigParser() if os.path.exists(self.file_path): config.re...
[ "Delete", "the", "password", "for", "the", "username", "of", "the", "service", "." ]
jaraco/keyrings.alt
python
https://github.com/jaraco/keyrings.alt/blob/5b71223d12bf9ac6abd05b1b395f1efccb5ea660/keyrings/alt/file_base.py#L183-L198
[ "def", "delete_password", "(", "self", ",", "service", ",", "username", ")", ":", "service", "=", "escape_for_ini", "(", "service", ")", "username", "=", "escape_for_ini", "(", "username", ")", "config", "=", "configparser", ".", "RawConfigParser", "(", ")", ...
5b71223d12bf9ac6abd05b1b395f1efccb5ea660
train
WagtailRelationsAppConfig.applicable_models
Returns a list of model classes that subclass Page and include a "tags" field. :rtype: list.
wagtailplus/wagtailrelations/apps.py
def applicable_models(self): """ Returns a list of model classes that subclass Page and include a "tags" field. :rtype: list. """ Page = apps.get_model('wagtailcore', 'Page') applicable = [] for model in apps.get_models(): ...
def applicable_models(self): """ Returns a list of model classes that subclass Page and include a "tags" field. :rtype: list. """ Page = apps.get_model('wagtailcore', 'Page') applicable = [] for model in apps.get_models(): ...
[ "Returns", "a", "list", "of", "model", "classes", "that", "subclass", "Page", "and", "include", "a", "tags", "field", ".", ":", "rtype", ":", "list", "." ]
rfosterslo/wagtailplus
python
https://github.com/rfosterslo/wagtailplus/blob/22cac857175d8a6f77e470751831c14a92ccd768/wagtailplus/wagtailrelations/apps.py#L17-L34
[ "def", "applicable_models", "(", "self", ")", ":", "Page", "=", "apps", ".", "get_model", "(", "'wagtailcore'", ",", "'Page'", ")", "applicable", "=", "[", "]", "for", "model", "in", "apps", ".", "get_models", "(", ")", ":", "meta", "=", "getattr", "("...
22cac857175d8a6f77e470751831c14a92ccd768
train
WagtailRelationsAppConfig.add_relationship_panels
Add edit handler that includes "related" panels to applicable model classes that don't explicitly define their own edit handler.
wagtailplus/wagtailrelations/apps.py
def add_relationship_panels(self): """ Add edit handler that includes "related" panels to applicable model classes that don't explicitly define their own edit handler. """ from wagtailplus.utils.edit_handlers import add_panel_to_edit_handler from wagtailplus.wagtail...
def add_relationship_panels(self): """ Add edit handler that includes "related" panels to applicable model classes that don't explicitly define their own edit handler. """ from wagtailplus.utils.edit_handlers import add_panel_to_edit_handler from wagtailplus.wagtail...
[ "Add", "edit", "handler", "that", "includes", "related", "panels", "to", "applicable", "model", "classes", "that", "don", "t", "explicitly", "define", "their", "own", "edit", "handler", "." ]
rfosterslo/wagtailplus
python
https://github.com/rfosterslo/wagtailplus/blob/22cac857175d8a6f77e470751831c14a92ccd768/wagtailplus/wagtailrelations/apps.py#L36-L45
[ "def", "add_relationship_panels", "(", "self", ")", ":", "from", "wagtailplus", ".", "utils", ".", "edit_handlers", "import", "add_panel_to_edit_handler", "from", "wagtailplus", ".", "wagtailrelations", ".", "edit_handlers", "import", "RelatedPanel", "for", "model", "...
22cac857175d8a6f77e470751831c14a92ccd768
train
WagtailRelationsAppConfig.add_relationship_methods
Adds relationship methods to applicable model classes.
wagtailplus/wagtailrelations/apps.py
def add_relationship_methods(self): """ Adds relationship methods to applicable model classes. """ Entry = apps.get_model('wagtailrelations', 'Entry') @cached_property def related(instance): return instance.get_related() @cached_property ...
def add_relationship_methods(self): """ Adds relationship methods to applicable model classes. """ Entry = apps.get_model('wagtailrelations', 'Entry') @cached_property def related(instance): return instance.get_related() @cached_property ...
[ "Adds", "relationship", "methods", "to", "applicable", "model", "classes", "." ]
rfosterslo/wagtailplus
python
https://github.com/rfosterslo/wagtailplus/blob/22cac857175d8a6f77e470751831c14a92ccd768/wagtailplus/wagtailrelations/apps.py#L47-L104
[ "def", "add_relationship_methods", "(", "self", ")", ":", "Entry", "=", "apps", ".", "get_model", "(", "'wagtailrelations'", ",", "'Entry'", ")", "@", "cached_property", "def", "related", "(", "instance", ")", ":", "return", "instance", ".", "get_related", "("...
22cac857175d8a6f77e470751831c14a92ccd768
train
WagtailRelationsAppConfig.ready
Finalizes application configuration.
wagtailplus/wagtailrelations/apps.py
def ready(self): """ Finalizes application configuration. """ import wagtailplus.wagtailrelations.signals.handlers self.add_relationship_panels() self.add_relationship_methods() super(WagtailRelationsAppConfig, self).ready()
def ready(self): """ Finalizes application configuration. """ import wagtailplus.wagtailrelations.signals.handlers self.add_relationship_panels() self.add_relationship_methods() super(WagtailRelationsAppConfig, self).ready()
[ "Finalizes", "application", "configuration", "." ]
rfosterslo/wagtailplus
python
https://github.com/rfosterslo/wagtailplus/blob/22cac857175d8a6f77e470751831c14a92ccd768/wagtailplus/wagtailrelations/apps.py#L106-L114
[ "def", "ready", "(", "self", ")", ":", "import", "wagtailplus", ".", "wagtailrelations", ".", "signals", ".", "handlers", "self", ".", "add_relationship_panels", "(", ")", "self", ".", "add_relationship_methods", "(", ")", "super", "(", "WagtailRelationsAppConfig"...
22cac857175d8a6f77e470751831c14a92ccd768
train
WagtailRollbacksAppConfig.applicable_models
Returns a list of model classes that subclass Page. :rtype: list.
wagtailplus/wagtailrollbacks/apps.py
def applicable_models(self): """ Returns a list of model classes that subclass Page. :rtype: list. """ Page = apps.get_model('wagtailcore', 'Page') applicable = [] for model in apps.get_models(): if issubclass(model, Page): ...
def applicable_models(self): """ Returns a list of model classes that subclass Page. :rtype: list. """ Page = apps.get_model('wagtailcore', 'Page') applicable = [] for model in apps.get_models(): if issubclass(model, Page): ...
[ "Returns", "a", "list", "of", "model", "classes", "that", "subclass", "Page", ".", ":", "rtype", ":", "list", "." ]
rfosterslo/wagtailplus
python
https://github.com/rfosterslo/wagtailplus/blob/22cac857175d8a6f77e470751831c14a92ccd768/wagtailplus/wagtailrollbacks/apps.py#L20-L33
[ "def", "applicable_models", "(", "self", ")", ":", "Page", "=", "apps", ".", "get_model", "(", "'wagtailcore'", ",", "'Page'", ")", "applicable", "=", "[", "]", "for", "model", "in", "apps", ".", "get_models", "(", ")", ":", "if", "issubclass", "(", "m...
22cac857175d8a6f77e470751831c14a92ccd768
train
WagtailRollbacksAppConfig.add_rollback_panels
Adds rollback panel to applicable model class's edit handlers.
wagtailplus/wagtailrollbacks/apps.py
def add_rollback_panels(self): """ Adds rollback panel to applicable model class's edit handlers. """ from wagtailplus.utils.edit_handlers import add_panel_to_edit_handler from wagtailplus.wagtailrollbacks.edit_handlers import HistoryPanel for model in self.applic...
def add_rollback_panels(self): """ Adds rollback panel to applicable model class's edit handlers. """ from wagtailplus.utils.edit_handlers import add_panel_to_edit_handler from wagtailplus.wagtailrollbacks.edit_handlers import HistoryPanel for model in self.applic...
[ "Adds", "rollback", "panel", "to", "applicable", "model", "class", "s", "edit", "handlers", "." ]
rfosterslo/wagtailplus
python
https://github.com/rfosterslo/wagtailplus/blob/22cac857175d8a6f77e470751831c14a92ccd768/wagtailplus/wagtailrollbacks/apps.py#L35-L43
[ "def", "add_rollback_panels", "(", "self", ")", ":", "from", "wagtailplus", ".", "utils", ".", "edit_handlers", "import", "add_panel_to_edit_handler", "from", "wagtailplus", ".", "wagtailrollbacks", ".", "edit_handlers", "import", "HistoryPanel", "for", "model", "in",...
22cac857175d8a6f77e470751831c14a92ccd768
train
WagtailRollbacksAppConfig.add_rollback_methods
Adds rollback methods to applicable model classes.
wagtailplus/wagtailrollbacks/apps.py
def add_rollback_methods(): """ Adds rollback methods to applicable model classes. """ # Modified Page.save_revision method. def page_rollback(instance, revision_id, user=None, submitted_for_moderation=False, approved_go_live_at=None, changed=True): old_revision...
def add_rollback_methods(): """ Adds rollback methods to applicable model classes. """ # Modified Page.save_revision method. def page_rollback(instance, revision_id, user=None, submitted_for_moderation=False, approved_go_live_at=None, changed=True): old_revision...
[ "Adds", "rollback", "methods", "to", "applicable", "model", "classes", "." ]
rfosterslo/wagtailplus
python
https://github.com/rfosterslo/wagtailplus/blob/22cac857175d8a6f77e470751831c14a92ccd768/wagtailplus/wagtailrollbacks/apps.py#L46-L90
[ "def", "add_rollback_methods", "(", ")", ":", "# Modified Page.save_revision method.\r", "def", "page_rollback", "(", "instance", ",", "revision_id", ",", "user", "=", "None", ",", "submitted_for_moderation", "=", "False", ",", "approved_go_live_at", "=", "None", ",",...
22cac857175d8a6f77e470751831c14a92ccd768
train
WagtailRollbacksAppConfig.ready
Finalizes application configuration.
wagtailplus/wagtailrollbacks/apps.py
def ready(self): """ Finalizes application configuration. """ self.add_rollback_panels() self.add_rollback_methods() super(WagtailRollbacksAppConfig, self).ready()
def ready(self): """ Finalizes application configuration. """ self.add_rollback_panels() self.add_rollback_methods() super(WagtailRollbacksAppConfig, self).ready()
[ "Finalizes", "application", "configuration", "." ]
rfosterslo/wagtailplus
python
https://github.com/rfosterslo/wagtailplus/blob/22cac857175d8a6f77e470751831c14a92ccd768/wagtailplus/wagtailrollbacks/apps.py#L92-L98
[ "def", "ready", "(", "self", ")", ":", "self", ".", "add_rollback_panels", "(", ")", "self", ".", "add_rollback_methods", "(", ")", "super", "(", "WagtailRollbacksAppConfig", ",", "self", ")", ".", "ready", "(", ")" ]
22cac857175d8a6f77e470751831c14a92ccd768
train
get_related
Returns list of related Entry instances for specified page. :param page: the page instance. :rtype: list.
wagtailplus/wagtailrelations/templatetags/wagtailrelations_tags.py
def get_related(page): """ Returns list of related Entry instances for specified page. :param page: the page instance. :rtype: list. """ related = [] entry = Entry.get_for_model(page) if entry: related = entry.related return related
def get_related(page): """ Returns list of related Entry instances for specified page. :param page: the page instance. :rtype: list. """ related = [] entry = Entry.get_for_model(page) if entry: related = entry.related return related
[ "Returns", "list", "of", "related", "Entry", "instances", "for", "specified", "page", "." ]
rfosterslo/wagtailplus
python
https://github.com/rfosterslo/wagtailplus/blob/22cac857175d8a6f77e470751831c14a92ccd768/wagtailplus/wagtailrelations/templatetags/wagtailrelations_tags.py#L17-L30
[ "def", "get_related", "(", "page", ")", ":", "related", "=", "[", "]", "entry", "=", "Entry", ".", "get_for_model", "(", "page", ")", "if", "entry", ":", "related", "=", "entry", ".", "related", "return", "related" ]
22cac857175d8a6f77e470751831c14a92ccd768
train
get_related_entry_admin_url
Returns admin URL for specified entry instance. :param entry: the entry instance. :return: str.
wagtailplus/wagtailrelations/templatetags/wagtailrelations_tags.py
def get_related_entry_admin_url(entry): """ Returns admin URL for specified entry instance. :param entry: the entry instance. :return: str. """ namespaces = { Document: 'wagtaildocs:edit', Link: 'wagtaillinks:edit', Page: 'wagtailadmin_pages:edit', } ...
def get_related_entry_admin_url(entry): """ Returns admin URL for specified entry instance. :param entry: the entry instance. :return: str. """ namespaces = { Document: 'wagtaildocs:edit', Link: 'wagtaillinks:edit', Page: 'wagtailadmin_pages:edit', } ...
[ "Returns", "admin", "URL", "for", "specified", "entry", "instance", "." ]
rfosterslo/wagtailplus
python
https://github.com/rfosterslo/wagtailplus/blob/22cac857175d8a6f77e470751831c14a92ccd768/wagtailplus/wagtailrelations/templatetags/wagtailrelations_tags.py#L33-L50
[ "def", "get_related_entry_admin_url", "(", "entry", ")", ":", "namespaces", "=", "{", "Document", ":", "'wagtaildocs:edit'", ",", "Link", ":", "'wagtaillinks:edit'", ",", "Page", ":", "'wagtailadmin_pages:edit'", ",", "}", "for", "cls", ",", "url", "in", "namesp...
22cac857175d8a6f77e470751831c14a92ccd768
train
get_related_with_scores
Returns list of related tuples (Entry instance, score) for specified page. :param page: the page instance. :rtype: list.
wagtailplus/wagtailrelations/templatetags/wagtailrelations_tags.py
def get_related_with_scores(page): """ Returns list of related tuples (Entry instance, score) for specified page. :param page: the page instance. :rtype: list. """ related = [] entry = Entry.get_for_model(page) if entry: related = entry.related_with_scores return rel...
def get_related_with_scores(page): """ Returns list of related tuples (Entry instance, score) for specified page. :param page: the page instance. :rtype: list. """ related = [] entry = Entry.get_for_model(page) if entry: related = entry.related_with_scores return rel...
[ "Returns", "list", "of", "related", "tuples", "(", "Entry", "instance", "score", ")", "for", "specified", "page", "." ]
rfosterslo/wagtailplus
python
https://github.com/rfosterslo/wagtailplus/blob/22cac857175d8a6f77e470751831c14a92ccd768/wagtailplus/wagtailrelations/templatetags/wagtailrelations_tags.py#L53-L67
[ "def", "get_related_with_scores", "(", "page", ")", ":", "related", "=", "[", "]", "entry", "=", "Entry", ".", "get_for_model", "(", "page", ")", "if", "entry", ":", "related", "=", "entry", ".", "related_with_scores", "return", "related" ]
22cac857175d8a6f77e470751831c14a92ccd768
train
MultipartKeyringWrapper.get_password
Get password of the username for the service
keyrings/alt/multi.py
def get_password(self, service, username): """Get password of the username for the service """ init_part = self._keyring.get_password(service, username) if init_part: parts = [init_part] i = 1 while True: next_part = self._keyring.get_p...
def get_password(self, service, username): """Get password of the username for the service """ init_part = self._keyring.get_password(service, username) if init_part: parts = [init_part] i = 1 while True: next_part = self._keyring.get_p...
[ "Get", "password", "of", "the", "username", "for", "the", "service" ]
jaraco/keyrings.alt
python
https://github.com/jaraco/keyrings.alt/blob/5b71223d12bf9ac6abd05b1b395f1efccb5ea660/keyrings/alt/multi.py#L24-L41
[ "def", "get_password", "(", "self", ",", "service", ",", "username", ")", ":", "init_part", "=", "self", ".", "_keyring", ".", "get_password", "(", "service", ",", "username", ")", "if", "init_part", ":", "parts", "=", "[", "init_part", "]", "i", "=", ...
5b71223d12bf9ac6abd05b1b395f1efccb5ea660
train
MultipartKeyringWrapper.set_password
Set password for the username of the service
keyrings/alt/multi.py
def set_password(self, service, username, password): """Set password for the username of the service """ segments = range(0, len(password), self._max_password_size) password_parts = [ password[i:i + self._max_password_size] for i in segments] for i, password_part in e...
def set_password(self, service, username, password): """Set password for the username of the service """ segments = range(0, len(password), self._max_password_size) password_parts = [ password[i:i + self._max_password_size] for i in segments] for i, password_part in e...
[ "Set", "password", "for", "the", "username", "of", "the", "service" ]
jaraco/keyrings.alt
python
https://github.com/jaraco/keyrings.alt/blob/5b71223d12bf9ac6abd05b1b395f1efccb5ea660/keyrings/alt/multi.py#L43-L53
[ "def", "set_password", "(", "self", ",", "service", ",", "username", ",", "password", ")", ":", "segments", "=", "range", "(", "0", ",", "len", "(", "password", ")", ",", "self", ".", "_max_password_size", ")", "password_parts", "=", "[", "password", "["...
5b71223d12bf9ac6abd05b1b395f1efccb5ea660
train
LinkHandler.expand_db_attributes
Given a dictionary of attributes, find the corresponding link instance and return its HTML representation. :param attrs: dictionary of link attributes. :param for_editor: whether or not HTML is for editor. :rtype: str.
wagtailplus/wagtaillinks/rich_text.py
def expand_db_attributes(attrs, for_editor): """ Given a dictionary of attributes, find the corresponding link instance and return its HTML representation. :param attrs: dictionary of link attributes. :param for_editor: whether or not HTML is for editor. :rtype: str. ...
def expand_db_attributes(attrs, for_editor): """ Given a dictionary of attributes, find the corresponding link instance and return its HTML representation. :param attrs: dictionary of link attributes. :param for_editor: whether or not HTML is for editor. :rtype: str. ...
[ "Given", "a", "dictionary", "of", "attributes", "find", "the", "corresponding", "link", "instance", "and", "return", "its", "HTML", "representation", "." ]
rfosterslo/wagtailplus
python
https://github.com/rfosterslo/wagtailplus/blob/22cac857175d8a6f77e470751831c14a92ccd768/wagtailplus/wagtaillinks/rich_text.py#L28-L52
[ "def", "expand_db_attributes", "(", "attrs", ",", "for_editor", ")", ":", "try", ":", "editor_attrs", "=", "''", "link", "=", "Link", ".", "objects", ".", "get", "(", "id", "=", "attrs", "[", "'id'", "]", ")", "if", "for_editor", ":", "editor_attrs", "...
22cac857175d8a6f77e470751831c14a92ccd768
train
BaseCrypter.crypter
The actual keyczar crypter
keyrings/alt/keyczar.py
def crypter(self): """The actual keyczar crypter""" if not hasattr(self, '_crypter'): # initialise the Keyczar keysets if not self.keyset_location: raise ValueError('No encrypted keyset location!') reader = keyczar.readers.CreateReader(self.keyset_loca...
def crypter(self): """The actual keyczar crypter""" if not hasattr(self, '_crypter'): # initialise the Keyczar keysets if not self.keyset_location: raise ValueError('No encrypted keyset location!') reader = keyczar.readers.CreateReader(self.keyset_loca...
[ "The", "actual", "keyczar", "crypter" ]
jaraco/keyrings.alt
python
https://github.com/jaraco/keyrings.alt/blob/5b71223d12bf9ac6abd05b1b395f1efccb5ea660/keyrings/alt/keyczar.py#L39-L52
[ "def", "crypter", "(", "self", ")", ":", "if", "not", "hasattr", "(", "self", ",", "'_crypter'", ")", ":", "# initialise the Keyczar keysets", "if", "not", "self", ".", "keyset_location", ":", "raise", "ValueError", "(", "'No encrypted keyset location!'", ")", "...
5b71223d12bf9ac6abd05b1b395f1efccb5ea660
train
index_objects
Index documents of a specified mapping type. This allows for asynchronous indexing. If a mapping_type extends Indexable, you can add a ``post_save`` hook for the model that it's based on like this:: @receiver(dbsignals.post_save, sender=MyModel) def update_in_index(sender, instance, **kw)...
elasticutils/contrib/django/tasks.py
def index_objects(mapping_type, ids, chunk_size=100, es=None, index=None): """Index documents of a specified mapping type. This allows for asynchronous indexing. If a mapping_type extends Indexable, you can add a ``post_save`` hook for the model that it's based on like this:: @receiver(dbsign...
def index_objects(mapping_type, ids, chunk_size=100, es=None, index=None): """Index documents of a specified mapping type. This allows for asynchronous indexing. If a mapping_type extends Indexable, you can add a ``post_save`` hook for the model that it's based on like this:: @receiver(dbsign...
[ "Index", "documents", "of", "a", "specified", "mapping", "type", "." ]
mozilla/elasticutils
python
https://github.com/mozilla/elasticutils/blob/b880cc5d51fb1079b0581255ec664c1ec934656e/elasticutils/contrib/django/tasks.py#L13-L65
[ "def", "index_objects", "(", "mapping_type", ",", "ids", ",", "chunk_size", "=", "100", ",", "es", "=", "None", ",", "index", "=", "None", ")", ":", "if", "settings", ".", "ES_DISABLED", ":", "return", "log", ".", "debug", "(", "'Indexing objects {0}-{1}. ...
b880cc5d51fb1079b0581255ec664c1ec934656e
train
unindex_objects
Remove documents of a specified mapping_type from the index. This allows for asynchronous deleting. If a mapping_type extends Indexable, you can add a ``pre_delete`` hook for the model that it's based on like this:: @receiver(dbsignals.pre_delete, sender=MyModel) def remove_from_index(sen...
elasticutils/contrib/django/tasks.py
def unindex_objects(mapping_type, ids, es=None, index=None): """Remove documents of a specified mapping_type from the index. This allows for asynchronous deleting. If a mapping_type extends Indexable, you can add a ``pre_delete`` hook for the model that it's based on like this:: @receiver(dbs...
def unindex_objects(mapping_type, ids, es=None, index=None): """Remove documents of a specified mapping_type from the index. This allows for asynchronous deleting. If a mapping_type extends Indexable, you can add a ``pre_delete`` hook for the model that it's based on like this:: @receiver(dbs...
[ "Remove", "documents", "of", "a", "specified", "mapping_type", "from", "the", "index", "." ]
mozilla/elasticutils
python
https://github.com/mozilla/elasticutils/blob/b880cc5d51fb1079b0581255ec664c1ec934656e/elasticutils/contrib/django/tasks.py#L69-L93
[ "def", "unindex_objects", "(", "mapping_type", ",", "ids", ",", "es", "=", "None", ",", "index", "=", "None", ")", ":", "if", "settings", ".", "ES_DISABLED", ":", "return", "for", "id_", "in", "ids", ":", "mapping_type", ".", "unindex", "(", "id_", ","...
b880cc5d51fb1079b0581255ec664c1ec934656e
train
LinkChooser.get_json
Returns specified link instance as JSON. :param link: the link instance. :rtype: JSON.
wagtailplus/wagtaillinks/views/chooser.py
def get_json(self, link): """ Returns specified link instance as JSON. :param link: the link instance. :rtype: JSON. """ return json.dumps({ 'id': link.id, 'title': link.title, 'url': link.get_absolute_url(), ...
def get_json(self, link): """ Returns specified link instance as JSON. :param link: the link instance. :rtype: JSON. """ return json.dumps({ 'id': link.id, 'title': link.title, 'url': link.get_absolute_url(), ...
[ "Returns", "specified", "link", "instance", "as", "JSON", "." ]
rfosterslo/wagtailplus
python
https://github.com/rfosterslo/wagtailplus/blob/22cac857175d8a6f77e470751831c14a92ccd768/wagtailplus/wagtaillinks/views/chooser.py#L14-L29
[ "def", "get_json", "(", "self", ",", "link", ")", ":", "return", "json", ".", "dumps", "(", "{", "'id'", ":", "link", ".", "id", ",", "'title'", ":", "link", ".", "title", ",", "'url'", ":", "link", ".", "get_absolute_url", "(", ")", ",", "'edit_li...
22cac857175d8a6f77e470751831c14a92ccd768
train
Encrypted._create_cipher
Create the cipher object to encrypt or decrypt a payload.
keyrings/alt/file.py
def _create_cipher(self, password, salt, IV): """ Create the cipher object to encrypt or decrypt a payload. """ from Crypto.Protocol.KDF import PBKDF2 from Crypto.Cipher import AES pw = PBKDF2(password, salt, dkLen=self.block_size) return AES.new(pw[:self.block_si...
def _create_cipher(self, password, salt, IV): """ Create the cipher object to encrypt or decrypt a payload. """ from Crypto.Protocol.KDF import PBKDF2 from Crypto.Cipher import AES pw = PBKDF2(password, salt, dkLen=self.block_size) return AES.new(pw[:self.block_si...
[ "Create", "the", "cipher", "object", "to", "encrypt", "or", "decrypt", "a", "payload", "." ]
jaraco/keyrings.alt
python
https://github.com/jaraco/keyrings.alt/blob/5b71223d12bf9ac6abd05b1b395f1efccb5ea660/keyrings/alt/file.py#L47-L54
[ "def", "_create_cipher", "(", "self", ",", "password", ",", "salt", ",", "IV", ")", ":", "from", "Crypto", ".", "Protocol", ".", "KDF", "import", "PBKDF2", "from", "Crypto", ".", "Cipher", "import", "AES", "pw", "=", "PBKDF2", "(", "password", ",", "sa...
5b71223d12bf9ac6abd05b1b395f1efccb5ea660
train
EncryptedKeyring._init_file
Initialize a new password file and set the reference password.
keyrings/alt/file.py
def _init_file(self): """ Initialize a new password file and set the reference password. """ self.keyring_key = self._get_new_password() # set a reference password, used to check that the password provided # matches for subsequent checks. self.set_password('keyri...
def _init_file(self): """ Initialize a new password file and set the reference password. """ self.keyring_key = self._get_new_password() # set a reference password, used to check that the password provided # matches for subsequent checks. self.set_password('keyri...
[ "Initialize", "a", "new", "password", "file", "and", "set", "the", "reference", "password", "." ]
jaraco/keyrings.alt
python
https://github.com/jaraco/keyrings.alt/blob/5b71223d12bf9ac6abd05b1b395f1efccb5ea660/keyrings/alt/file.py#L101-L116
[ "def", "_init_file", "(", "self", ")", ":", "self", ".", "keyring_key", "=", "self", ".", "_get_new_password", "(", ")", "# set a reference password, used to check that the password provided", "# matches for subsequent checks.", "self", ".", "set_password", "(", "'keyring-...
5b71223d12bf9ac6abd05b1b395f1efccb5ea660
train
EncryptedKeyring._check_file
Check if the file exists and has the expected password reference.
keyrings/alt/file.py
def _check_file(self): """ Check if the file exists and has the expected password reference. """ if not os.path.exists(self.file_path): return False self._migrate() config = configparser.RawConfigParser() config.read(self.file_path) try: ...
def _check_file(self): """ Check if the file exists and has the expected password reference. """ if not os.path.exists(self.file_path): return False self._migrate() config = configparser.RawConfigParser() config.read(self.file_path) try: ...
[ "Check", "if", "the", "file", "exists", "and", "has", "the", "expected", "password", "reference", "." ]
jaraco/keyrings.alt
python
https://github.com/jaraco/keyrings.alt/blob/5b71223d12bf9ac6abd05b1b395f1efccb5ea660/keyrings/alt/file.py#L118-L139
[ "def", "_check_file", "(", "self", ")", ":", "if", "not", "os", ".", "path", ".", "exists", "(", "self", ".", "file_path", ")", ":", "return", "False", "self", ".", "_migrate", "(", ")", "config", "=", "configparser", ".", "RawConfigParser", "(", ")", ...
5b71223d12bf9ac6abd05b1b395f1efccb5ea660
train
EncryptedKeyring._check_version
check for a valid version an existing scheme implies an existing version as well return True, if version is valid, and False otherwise
keyrings/alt/file.py
def _check_version(self, config): """ check for a valid version an existing scheme implies an existing version as well return True, if version is valid, and False otherwise """ try: self.file_version = config.get( escape_for_ini('keyring-setti...
def _check_version(self, config): """ check for a valid version an existing scheme implies an existing version as well return True, if version is valid, and False otherwise """ try: self.file_version = config.get( escape_for_ini('keyring-setti...
[ "check", "for", "a", "valid", "version", "an", "existing", "scheme", "implies", "an", "existing", "version", "as", "well" ]
jaraco/keyrings.alt
python
https://github.com/jaraco/keyrings.alt/blob/5b71223d12bf9ac6abd05b1b395f1efccb5ea660/keyrings/alt/file.py#L164-L178
[ "def", "_check_version", "(", "self", ",", "config", ")", ":", "try", ":", "self", ".", "file_version", "=", "config", ".", "get", "(", "escape_for_ini", "(", "'keyring-setting'", ")", ",", "escape_for_ini", "(", "'version'", ")", ",", ")", "except", "(", ...
5b71223d12bf9ac6abd05b1b395f1efccb5ea660
train
EncryptedKeyring._unlock
Unlock this keyring by getting the password for the keyring from the user.
keyrings/alt/file.py
def _unlock(self): """ Unlock this keyring by getting the password for the keyring from the user. """ self.keyring_key = getpass.getpass( 'Please enter password for encrypted keyring: ') try: ref_pw = self.get_password('keyring-setting', 'password ...
def _unlock(self): """ Unlock this keyring by getting the password for the keyring from the user. """ self.keyring_key = getpass.getpass( 'Please enter password for encrypted keyring: ') try: ref_pw = self.get_password('keyring-setting', 'password ...
[ "Unlock", "this", "keyring", "by", "getting", "the", "password", "for", "the", "keyring", "from", "the", "user", "." ]
jaraco/keyrings.alt
python
https://github.com/jaraco/keyrings.alt/blob/5b71223d12bf9ac6abd05b1b395f1efccb5ea660/keyrings/alt/file.py#L180-L192
[ "def", "_unlock", "(", "self", ")", ":", "self", ".", "keyring_key", "=", "getpass", ".", "getpass", "(", "'Please enter password for encrypted keyring: '", ")", "try", ":", "ref_pw", "=", "self", ".", "get_password", "(", "'keyring-setting'", ",", "'password refe...
5b71223d12bf9ac6abd05b1b395f1efccb5ea660
train
_escape_char
Single char escape. Return the char, escaped if not already legal
keyrings/alt/escape.py
def _escape_char(c): "Single char escape. Return the char, escaped if not already legal" if isinstance(c, int): c = _unichr(c) return c if c in LEGAL_CHARS else ESCAPE_FMT % ord(c)
def _escape_char(c): "Single char escape. Return the char, escaped if not already legal" if isinstance(c, int): c = _unichr(c) return c if c in LEGAL_CHARS else ESCAPE_FMT % ord(c)
[ "Single", "char", "escape", ".", "Return", "the", "char", "escaped", "if", "not", "already", "legal" ]
jaraco/keyrings.alt
python
https://github.com/jaraco/keyrings.alt/blob/5b71223d12bf9ac6abd05b1b395f1efccb5ea660/keyrings/alt/escape.py#L25-L29
[ "def", "_escape_char", "(", "c", ")", ":", "if", "isinstance", "(", "c", ",", "int", ")", ":", "c", "=", "_unichr", "(", "c", ")", "return", "c", "if", "c", "in", "LEGAL_CHARS", "else", "ESCAPE_FMT", "%", "ord", "(", "c", ")" ]
5b71223d12bf9ac6abd05b1b395f1efccb5ea660
train
unescape
Inverse of escape.
keyrings/alt/escape.py
def unescape(value): """ Inverse of escape. """ pattern = ESCAPE_FMT.replace('%02X', '(?P<code>[0-9A-Fa-f]{2})') # the pattern must be bytes to operate on bytes pattern_bytes = pattern.encode('ascii') re_esc = re.compile(pattern_bytes) return re_esc.sub(_unescape_code, value.encode('asci...
def unescape(value): """ Inverse of escape. """ pattern = ESCAPE_FMT.replace('%02X', '(?P<code>[0-9A-Fa-f]{2})') # the pattern must be bytes to operate on bytes pattern_bytes = pattern.encode('ascii') re_esc = re.compile(pattern_bytes) return re_esc.sub(_unescape_code, value.encode('asci...
[ "Inverse", "of", "escape", "." ]
jaraco/keyrings.alt
python
https://github.com/jaraco/keyrings.alt/blob/5b71223d12bf9ac6abd05b1b395f1efccb5ea660/keyrings/alt/escape.py#L45-L53
[ "def", "unescape", "(", "value", ")", ":", "pattern", "=", "ESCAPE_FMT", ".", "replace", "(", "'%02X'", ",", "'(?P<code>[0-9A-Fa-f]{2})'", ")", "# the pattern must be bytes to operate on bytes", "pattern_bytes", "=", "pattern", ".", "encode", "(", "'ascii'", ")", "r...
5b71223d12bf9ac6abd05b1b395f1efccb5ea660
train
Keyring._find_passwords
Get password of the username for the service
keyrings/alt/Gnome.py
def _find_passwords(self, service, username, deleting=False): """Get password of the username for the service """ passwords = [] service = self._safe_string(service) username = self._safe_string(username) for attrs_tuple in (('username', 'service'), ('user', 'domain')): ...
def _find_passwords(self, service, username, deleting=False): """Get password of the username for the service """ passwords = [] service = self._safe_string(service) username = self._safe_string(username) for attrs_tuple in (('username', 'service'), ('user', 'domain')): ...
[ "Get", "password", "of", "the", "username", "for", "the", "service" ]
jaraco/keyrings.alt
python
https://github.com/jaraco/keyrings.alt/blob/5b71223d12bf9ac6abd05b1b395f1efccb5ea660/keyrings/alt/Gnome.py#L39-L61
[ "def", "_find_passwords", "(", "self", ",", "service", ",", "username", ",", "deleting", "=", "False", ")", ":", "passwords", "=", "[", "]", "service", "=", "self", ".", "_safe_string", "(", "service", ")", "username", "=", "self", ".", "_safe_string", "...
5b71223d12bf9ac6abd05b1b395f1efccb5ea660
train
Keyring.get_password
Get password of the username for the service
keyrings/alt/Gnome.py
def get_password(self, service, username): """Get password of the username for the service """ items = self._find_passwords(service, username) if not items: return None secret = items[0].secret return ( secret if isinstance(secret, six...
def get_password(self, service, username): """Get password of the username for the service """ items = self._find_passwords(service, username) if not items: return None secret = items[0].secret return ( secret if isinstance(secret, six...
[ "Get", "password", "of", "the", "username", "for", "the", "service" ]
jaraco/keyrings.alt
python
https://github.com/jaraco/keyrings.alt/blob/5b71223d12bf9ac6abd05b1b395f1efccb5ea660/keyrings/alt/Gnome.py#L63-L75
[ "def", "get_password", "(", "self", ",", "service", ",", "username", ")", ":", "items", "=", "self", ".", "_find_passwords", "(", "service", ",", "username", ")", "if", "not", "items", ":", "return", "None", "secret", "=", "items", "[", "0", "]", ".", ...
5b71223d12bf9ac6abd05b1b395f1efccb5ea660
train
Keyring.set_password
Set password for the username of the service
keyrings/alt/Gnome.py
def set_password(self, service, username, password): """Set password for the username of the service """ service = self._safe_string(service) username = self._safe_string(username) password = self._safe_string(password) attrs = GnomeKeyring.Attribute.list_new() Gn...
def set_password(self, service, username, password): """Set password for the username of the service """ service = self._safe_string(service) username = self._safe_string(username) password = self._safe_string(password) attrs = GnomeKeyring.Attribute.list_new() Gn...
[ "Set", "password", "for", "the", "username", "of", "the", "service" ]
jaraco/keyrings.alt
python
https://github.com/jaraco/keyrings.alt/blob/5b71223d12bf9ac6abd05b1b395f1efccb5ea660/keyrings/alt/Gnome.py#L77-L96
[ "def", "set_password", "(", "self", ",", "service", ",", "username", ",", "password", ")", ":", "service", "=", "self", ".", "_safe_string", "(", "service", ")", "username", "=", "self", ".", "_safe_string", "(", "username", ")", "password", "=", "self", ...
5b71223d12bf9ac6abd05b1b395f1efccb5ea660
train
Keyring.delete_password
Delete the password for the username of the service.
keyrings/alt/Gnome.py
def delete_password(self, service, username): """Delete the password for the username of the service. """ items = self._find_passwords(service, username, deleting=True) if not items: raise PasswordDeleteError("Password not found") for current in items: res...
def delete_password(self, service, username): """Delete the password for the username of the service. """ items = self._find_passwords(service, username, deleting=True) if not items: raise PasswordDeleteError("Password not found") for current in items: res...
[ "Delete", "the", "password", "for", "the", "username", "of", "the", "service", "." ]
jaraco/keyrings.alt
python
https://github.com/jaraco/keyrings.alt/blob/5b71223d12bf9ac6abd05b1b395f1efccb5ea660/keyrings/alt/Gnome.py#L98-L110
[ "def", "delete_password", "(", "self", ",", "service", ",", "username", ")", ":", "items", "=", "self", ".", "_find_passwords", "(", "service", ",", "username", ",", "deleting", "=", "True", ")", "if", "not", "items", ":", "raise", "PasswordDeleteError", "...
5b71223d12bf9ac6abd05b1b395f1efccb5ea660
train
Keyring._safe_string
Convert unicode to string as gnomekeyring barfs on unicode
keyrings/alt/Gnome.py
def _safe_string(self, source, encoding='utf-8'): """Convert unicode to string as gnomekeyring barfs on unicode""" if not isinstance(source, str): return source.encode(encoding) return str(source)
def _safe_string(self, source, encoding='utf-8'): """Convert unicode to string as gnomekeyring barfs on unicode""" if not isinstance(source, str): return source.encode(encoding) return str(source)
[ "Convert", "unicode", "to", "string", "as", "gnomekeyring", "barfs", "on", "unicode" ]
jaraco/keyrings.alt
python
https://github.com/jaraco/keyrings.alt/blob/5b71223d12bf9ac6abd05b1b395f1efccb5ea660/keyrings/alt/Gnome.py#L112-L116
[ "def", "_safe_string", "(", "self", ",", "source", ",", "encoding", "=", "'utf-8'", ")", ":", "if", "not", "isinstance", "(", "source", ",", "str", ")", ":", "return", "source", ".", "encode", "(", "encoding", ")", "return", "str", "(", "source", ")" ]
5b71223d12bf9ac6abd05b1b395f1efccb5ea660
train
CreateView.get_context_data
Returns context dictionary for view. :rtype: dict.
wagtailplus/wagtaillinks/views/links.py
def get_context_data(self, **kwargs): """ Returns context dictionary for view. :rtype: dict. """ kwargs.update({ 'view': self, 'email_form': EmailLinkForm(), 'external_form': ExternalLinkForm(), 'type_email': ...
def get_context_data(self, **kwargs): """ Returns context dictionary for view. :rtype: dict. """ kwargs.update({ 'view': self, 'email_form': EmailLinkForm(), 'external_form': ExternalLinkForm(), 'type_email': ...
[ "Returns", "context", "dictionary", "for", "view", "." ]
rfosterslo/wagtailplus
python
https://github.com/rfosterslo/wagtailplus/blob/22cac857175d8a6f77e470751831c14a92ccd768/wagtailplus/wagtaillinks/views/links.py#L26-L49
[ "def", "get_context_data", "(", "self", ",", "*", "*", "kwargs", ")", ":", "kwargs", ".", "update", "(", "{", "'view'", ":", "self", ",", "'email_form'", ":", "EmailLinkForm", "(", ")", ",", "'external_form'", ":", "ExternalLinkForm", "(", ")", ",", "'ty...
22cac857175d8a6f77e470751831c14a92ccd768
train
CreateView.post
Returns POST response. :param request: the request instance. :rtype: django.http.HttpResponse.
wagtailplus/wagtaillinks/views/links.py
def post(self, request, *args, **kwargs): """ Returns POST response. :param request: the request instance. :rtype: django.http.HttpResponse. """ form = None link_type = int(request.POST.get('link_type', 0)) if link_type == Link.LINK_TYPE_EMAIL: ...
def post(self, request, *args, **kwargs): """ Returns POST response. :param request: the request instance. :rtype: django.http.HttpResponse. """ form = None link_type = int(request.POST.get('link_type', 0)) if link_type == Link.LINK_TYPE_EMAIL: ...
[ "Returns", "POST", "response", "." ]
rfosterslo/wagtailplus
python
https://github.com/rfosterslo/wagtailplus/blob/22cac857175d8a6f77e470751831c14a92ccd768/wagtailplus/wagtaillinks/views/links.py#L57-L78
[ "def", "post", "(", "self", ",", "request", ",", "*", "args", ",", "*", "*", "kwargs", ")", ":", "form", "=", "None", "link_type", "=", "int", "(", "request", ".", "POST", ".", "get", "(", "'link_type'", ",", "0", ")", ")", "if", "link_type", "==...
22cac857175d8a6f77e470751831c14a92ccd768
train
UpdateView.get_form_class
Returns form class to use in the view. :rtype: django.forms.ModelForm.
wagtailplus/wagtaillinks/views/links.py
def get_form_class(self): """ Returns form class to use in the view. :rtype: django.forms.ModelForm. """ if self.object.link_type == Link.LINK_TYPE_EMAIL: return EmailLinkForm elif self.object.link_type == Link.LINK_TYPE_EXTERNAL: return ExternalL...
def get_form_class(self): """ Returns form class to use in the view. :rtype: django.forms.ModelForm. """ if self.object.link_type == Link.LINK_TYPE_EMAIL: return EmailLinkForm elif self.object.link_type == Link.LINK_TYPE_EXTERNAL: return ExternalL...
[ "Returns", "form", "class", "to", "use", "in", "the", "view", "." ]
rfosterslo/wagtailplus
python
https://github.com/rfosterslo/wagtailplus/blob/22cac857175d8a6f77e470751831c14a92ccd768/wagtailplus/wagtaillinks/views/links.py#L84-L95
[ "def", "get_form_class", "(", "self", ")", ":", "if", "self", ".", "object", ".", "link_type", "==", "Link", ".", "LINK_TYPE_EMAIL", ":", "return", "EmailLinkForm", "elif", "self", ".", "object", ".", "link_type", "==", "Link", ".", "LINK_TYPE_EXTERNAL", ":"...
22cac857175d8a6f77e470751831c14a92ccd768
train
RegistryKeyring.get_password
Get password of the username for the service
keyrings/alt/Windows.py
def get_password(self, service, username): """Get password of the username for the service """ try: # fetch the password key = self._key_for_service(service) hkey = winreg.OpenKey(winreg.HKEY_CURRENT_USER, key) password_saved = winreg.QueryValueEx(...
def get_password(self, service, username): """Get password of the username for the service """ try: # fetch the password key = self._key_for_service(service) hkey = winreg.OpenKey(winreg.HKEY_CURRENT_USER, key) password_saved = winreg.QueryValueEx(...
[ "Get", "password", "of", "the", "username", "for", "the", "service" ]
jaraco/keyrings.alt
python
https://github.com/jaraco/keyrings.alt/blob/5b71223d12bf9ac6abd05b1b395f1efccb5ea660/keyrings/alt/Windows.py#L86-L101
[ "def", "get_password", "(", "self", ",", "service", ",", "username", ")", ":", "try", ":", "# fetch the password", "key", "=", "self", ".", "_key_for_service", "(", "service", ")", "hkey", "=", "winreg", ".", "OpenKey", "(", "winreg", ".", "HKEY_CURRENT_USER...
5b71223d12bf9ac6abd05b1b395f1efccb5ea660
train
RegistryKeyring.set_password
Write the password to the registry
keyrings/alt/Windows.py
def set_password(self, service, username, password): """Write the password to the registry """ # encrypt the password password_encrypted = _win_crypto.encrypt(password.encode('utf-8')) # encode with base64 password_base64 = base64.encodestring(password_encrypted) ...
def set_password(self, service, username, password): """Write the password to the registry """ # encrypt the password password_encrypted = _win_crypto.encrypt(password.encode('utf-8')) # encode with base64 password_base64 = base64.encodestring(password_encrypted) ...
[ "Write", "the", "password", "to", "the", "registry" ]
jaraco/keyrings.alt
python
https://github.com/jaraco/keyrings.alt/blob/5b71223d12bf9ac6abd05b1b395f1efccb5ea660/keyrings/alt/Windows.py#L103-L116
[ "def", "set_password", "(", "self", ",", "service", ",", "username", ",", "password", ")", ":", "# encrypt the password", "password_encrypted", "=", "_win_crypto", ".", "encrypt", "(", "password", ".", "encode", "(", "'utf-8'", ")", ")", "# encode with base64", ...
5b71223d12bf9ac6abd05b1b395f1efccb5ea660
train
RegistryKeyring.delete_password
Delete the password for the username of the service.
keyrings/alt/Windows.py
def delete_password(self, service, username): """Delete the password for the username of the service. """ try: key_name = self._key_for_service(service) hkey = winreg.OpenKey( winreg.HKEY_CURRENT_USER, key_name, 0, winreg.KEY_ALL_ACCESS) ...
def delete_password(self, service, username): """Delete the password for the username of the service. """ try: key_name = self._key_for_service(service) hkey = winreg.OpenKey( winreg.HKEY_CURRENT_USER, key_name, 0, winreg.KEY_ALL_ACCESS) ...
[ "Delete", "the", "password", "for", "the", "username", "of", "the", "service", "." ]
jaraco/keyrings.alt
python
https://github.com/jaraco/keyrings.alt/blob/5b71223d12bf9ac6abd05b1b395f1efccb5ea660/keyrings/alt/Windows.py#L118-L131
[ "def", "delete_password", "(", "self", ",", "service", ",", "username", ")", ":", "try", ":", "key_name", "=", "self", ".", "_key_for_service", "(", "service", ")", "hkey", "=", "winreg", ".", "OpenKey", "(", "winreg", ".", "HKEY_CURRENT_USER", ",", "key_n...
5b71223d12bf9ac6abd05b1b395f1efccb5ea660
train
BasicKeyring.encrypt
Encrypt the password.
keyrings/alt/pyfs.py
def encrypt(self, password): """Encrypt the password. """ if not password or not self._crypter: return password or b'' return self._crypter.encrypt(password)
def encrypt(self, password): """Encrypt the password. """ if not password or not self._crypter: return password or b'' return self._crypter.encrypt(password)
[ "Encrypt", "the", "password", "." ]
jaraco/keyrings.alt
python
https://github.com/jaraco/keyrings.alt/blob/5b71223d12bf9ac6abd05b1b395f1efccb5ea660/keyrings/alt/pyfs.py#L71-L76
[ "def", "encrypt", "(", "self", ",", "password", ")", ":", "if", "not", "password", "or", "not", "self", ".", "_crypter", ":", "return", "password", "or", "b''", "return", "self", ".", "_crypter", ".", "encrypt", "(", "password", ")" ]
5b71223d12bf9ac6abd05b1b395f1efccb5ea660
train
BasicKeyring.decrypt
Decrypt the password.
keyrings/alt/pyfs.py
def decrypt(self, password_encrypted): """Decrypt the password. """ if not password_encrypted or not self._crypter: return password_encrypted or b'' return self._crypter.decrypt(password_encrypted)
def decrypt(self, password_encrypted): """Decrypt the password. """ if not password_encrypted or not self._crypter: return password_encrypted or b'' return self._crypter.decrypt(password_encrypted)
[ "Decrypt", "the", "password", "." ]
jaraco/keyrings.alt
python
https://github.com/jaraco/keyrings.alt/blob/5b71223d12bf9ac6abd05b1b395f1efccb5ea660/keyrings/alt/pyfs.py#L78-L83
[ "def", "decrypt", "(", "self", ",", "password_encrypted", ")", ":", "if", "not", "password_encrypted", "or", "not", "self", ".", "_crypter", ":", "return", "password_encrypted", "or", "b''", "return", "self", ".", "_crypter", ".", "decrypt", "(", "password_enc...
5b71223d12bf9ac6abd05b1b395f1efccb5ea660
train
BasicKeyring._open
Open the password file in the specified mode
keyrings/alt/pyfs.py
def _open(self, mode='r'): """Open the password file in the specified mode """ open_file = None writeable = 'w' in mode or 'a' in mode or '+' in mode try: # NOTE: currently the MemOpener does not split off any filename # which causes errors on close(...
def _open(self, mode='r'): """Open the password file in the specified mode """ open_file = None writeable = 'w' in mode or 'a' in mode or '+' in mode try: # NOTE: currently the MemOpener does not split off any filename # which causes errors on close(...
[ "Open", "the", "password", "file", "in", "the", "specified", "mode" ]
jaraco/keyrings.alt
python
https://github.com/jaraco/keyrings.alt/blob/5b71223d12bf9ac6abd05b1b395f1efccb5ea660/keyrings/alt/pyfs.py#L85-L158
[ "def", "_open", "(", "self", ",", "mode", "=", "'r'", ")", ":", "open_file", "=", "None", "writeable", "=", "'w'", "in", "mode", "or", "'a'", "in", "mode", "or", "'+'", "in", "mode", "try", ":", "# NOTE: currently the MemOpener does not split off any filename"...
5b71223d12bf9ac6abd05b1b395f1efccb5ea660
train
BasicKeyring.config
load the passwords from the config file
keyrings/alt/pyfs.py
def config(self): """load the passwords from the config file """ if not hasattr(self, '_config'): raw_config = configparser.RawConfigParser() f = self._open() if f: raw_config.readfp(f) f.close() self._config = raw_c...
def config(self): """load the passwords from the config file """ if not hasattr(self, '_config'): raw_config = configparser.RawConfigParser() f = self._open() if f: raw_config.readfp(f) f.close() self._config = raw_c...
[ "load", "the", "passwords", "from", "the", "config", "file" ]
jaraco/keyrings.alt
python
https://github.com/jaraco/keyrings.alt/blob/5b71223d12bf9ac6abd05b1b395f1efccb5ea660/keyrings/alt/pyfs.py#L161-L171
[ "def", "config", "(", "self", ")", ":", "if", "not", "hasattr", "(", "self", ",", "'_config'", ")", ":", "raw_config", "=", "configparser", ".", "RawConfigParser", "(", ")", "f", "=", "self", ".", "_open", "(", ")", "if", "f", ":", "raw_config", ".",...
5b71223d12bf9ac6abd05b1b395f1efccb5ea660
train
BasicKeyring.get_password
Read the password from the file.
keyrings/alt/pyfs.py
def get_password(self, service, username): """Read the password from the file. """ service = escape_for_ini(service) username = escape_for_ini(username) # fetch the password try: password_base64 = self.config.get(service, username).encode() # deco...
def get_password(self, service, username): """Read the password from the file. """ service = escape_for_ini(service) username = escape_for_ini(username) # fetch the password try: password_base64 = self.config.get(service, username).encode() # deco...
[ "Read", "the", "password", "from", "the", "file", "." ]
jaraco/keyrings.alt
python
https://github.com/jaraco/keyrings.alt/blob/5b71223d12bf9ac6abd05b1b395f1efccb5ea660/keyrings/alt/pyfs.py#L173-L188
[ "def", "get_password", "(", "self", ",", "service", ",", "username", ")", ":", "service", "=", "escape_for_ini", "(", "service", ")", "username", "=", "escape_for_ini", "(", "username", ")", "# fetch the password", "try", ":", "password_base64", "=", "self", "...
5b71223d12bf9ac6abd05b1b395f1efccb5ea660
train
BasicKeyring.set_password
Write the password in the file.
keyrings/alt/pyfs.py
def set_password(self, service, username, password): """Write the password in the file. """ service = escape_for_ini(service) username = escape_for_ini(username) # encrypt the password password = password or '' password_encrypted = self.encrypt(password.encode('u...
def set_password(self, service, username, password): """Write the password in the file. """ service = escape_for_ini(service) username = escape_for_ini(username) # encrypt the password password = password or '' password_encrypted = self.encrypt(password.encode('u...
[ "Write", "the", "password", "in", "the", "file", "." ]
jaraco/keyrings.alt
python
https://github.com/jaraco/keyrings.alt/blob/5b71223d12bf9ac6abd05b1b395f1efccb5ea660/keyrings/alt/pyfs.py#L190-L208
[ "def", "set_password", "(", "self", ",", "service", ",", "username", ",", "password", ")", ":", "service", "=", "escape_for_ini", "(", "service", ")", "username", "=", "escape_for_ini", "(", "username", ")", "# encrypt the password", "password", "=", "password",...
5b71223d12bf9ac6abd05b1b395f1efccb5ea660
train
LiveEntryCategoryManager.get_queryset
Returns queryset limited to categories with live Entry instances. :rtype: django.db.models.query.QuerySet.
wagtailplus/wagtailrelations/models.py
def get_queryset(self): """ Returns queryset limited to categories with live Entry instances. :rtype: django.db.models.query.QuerySet. """ queryset = super(LiveEntryCategoryManager, self).get_queryset() return queryset.filter(tag__in=[ entry_tag.tag ...
def get_queryset(self): """ Returns queryset limited to categories with live Entry instances. :rtype: django.db.models.query.QuerySet. """ queryset = super(LiveEntryCategoryManager, self).get_queryset() return queryset.filter(tag__in=[ entry_tag.tag ...
[ "Returns", "queryset", "limited", "to", "categories", "with", "live", "Entry", "instances", "." ]
rfosterslo/wagtailplus
python
https://github.com/rfosterslo/wagtailplus/blob/22cac857175d8a6f77e470751831c14a92ccd768/wagtailplus/wagtailrelations/models.py#L33-L44
[ "def", "get_queryset", "(", "self", ")", ":", "queryset", "=", "super", "(", "LiveEntryCategoryManager", ",", "self", ")", ".", "get_queryset", "(", ")", "return", "queryset", ".", "filter", "(", "tag__in", "=", "[", "entry_tag", ".", "tag", "for", "entry_...
22cac857175d8a6f77e470751831c14a92ccd768
train
EntryManager.get_for_model
Returns tuple (Entry instance, created) for specified model instance. :rtype: wagtailplus.wagtailrelations.models.Entry.
wagtailplus/wagtailrelations/models.py
def get_for_model(self, model): """ Returns tuple (Entry instance, created) for specified model instance. :rtype: wagtailplus.wagtailrelations.models.Entry. """ return self.get_or_create( content_type = ContentType.objects.get_for_model(model), ...
def get_for_model(self, model): """ Returns tuple (Entry instance, created) for specified model instance. :rtype: wagtailplus.wagtailrelations.models.Entry. """ return self.get_or_create( content_type = ContentType.objects.get_for_model(model), ...
[ "Returns", "tuple", "(", "Entry", "instance", "created", ")", "for", "specified", "model", "instance", "." ]
rfosterslo/wagtailplus
python
https://github.com/rfosterslo/wagtailplus/blob/22cac857175d8a6f77e470751831c14a92ccd768/wagtailplus/wagtailrelations/models.py#L120-L130
[ "def", "get_for_model", "(", "self", ",", "model", ")", ":", "return", "self", ".", "get_or_create", "(", "content_type", "=", "ContentType", ".", "objects", ".", "get_for_model", "(", "model", ")", ",", "object_id", "=", "model", ".", "pk", ")" ]
22cac857175d8a6f77e470751831c14a92ccd768
train
EntryManager.get_for_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.
wagtailplus/wagtailrelations/models.py
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): """ 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} ...
[ "Returns", "queryset", "of", "Entry", "instances", "assigned", "to", "specified", "tag", "which", "can", "be", "a", "PK", "value", "a", "slug", "value", "or", "a", "Tag", "instance", "." ]
rfosterslo/wagtailplus
python
https://github.com/rfosterslo/wagtailplus/blob/22cac857175d8a6f77e470751831c14a92ccd768/wagtailplus/wagtailrelations/models.py#L132-L151
[ "def", "get_for_tag", "(", "self", ",", "tag", ")", ":", "tag_filter", "=", "{", "'tag'", ":", "tag", "}", "if", "isinstance", "(", "tag", ",", "six", ".", "integer_types", ")", ":", "tag_filter", "=", "{", "'tag_id'", ":", "tag", "}", "elif", "isins...
22cac857175d8a6f77e470751831c14a92ccd768
train
EntryTagManager.for_category
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.
wagtailplus/wagtailrelations/models.py
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): """ 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...
[ "Returns", "queryset", "of", "EntryTag", "instances", "for", "specified", "category", "." ]
rfosterslo/wagtailplus
python
https://github.com/rfosterslo/wagtailplus/blob/22cac857175d8a6f77e470751831c14a92ccd768/wagtailplus/wagtailrelations/models.py#L343-L356
[ "def", "for_category", "(", "self", ",", "category", ",", "live_only", "=", "False", ")", ":", "filters", "=", "{", "'tag'", ":", "category", ".", "tag", "}", "if", "live_only", ":", "filters", ".", "update", "(", "{", "'entry__live'", ":", "True", "}"...
22cac857175d8a6f77e470751831c14a92ccd768
train
EntryTagManager.related_to
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.
wagtailplus/wagtailrelations/models.py
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): """ 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", "." ]
rfosterslo/wagtailplus
python
https://github.com/rfosterslo/wagtailplus/blob/22cac857175d8a6f77e470751831c14a92ccd768/wagtailplus/wagtailrelations/models.py#L365-L379
[ "def", "related_to", "(", "self", ",", "entry", ",", "live_only", "=", "False", ")", ":", "filters", "=", "{", "'tag__in'", ":", "entry", ".", "tags", "}", "if", "live_only", ":", "filters", ".", "update", "(", "{", "'entry__live'", ":", "True", "}", ...
22cac857175d8a6f77e470751831c14a92ccd768
train
chosen_view_factory
Returns a ChosenView class that extends specified chooser class. :param chooser_cls: the class to extend. :rtype: class.
wagtailplus/utils/views/chooser.py
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): """ 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): ...
[ "Returns", "a", "ChosenView", "class", "that", "extends", "specified", "chooser", "class", "." ]
rfosterslo/wagtailplus
python
https://github.com/rfosterslo/wagtailplus/blob/22cac857175d8a6f77e470751831c14a92ccd768/wagtailplus/utils/views/chooser.py#L163-L215
[ "def", "chosen_view_factory", "(", "chooser_cls", ")", ":", "class", "ChosenView", "(", "chooser_cls", ")", ":", "#noinspection PyUnusedLocal", "def", "get", "(", "self", ",", "request", ",", "*", "args", ",", "*", "*", "kwargs", ")", ":", "\"\"\"\n ...
22cac857175d8a6f77e470751831c14a92ccd768
train
ChooserView.form_invalid
Processes an invalid form submittal. :param form: the form instance. :rtype: django.http.HttpResponse.
wagtailplus/utils/views/chooser.py
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): """ 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( ...
[ "Processes", "an", "invalid", "form", "submittal", "." ]
rfosterslo/wagtailplus
python
https://github.com/rfosterslo/wagtailplus/blob/22cac857175d8a6f77e470751831c14a92ccd768/wagtailplus/utils/views/chooser.py#L20-L35
[ "def", "form_invalid", "(", "self", ",", "form", ")", ":", "context", "=", "self", ".", "get_context_data", "(", "form", "=", "form", ")", "#noinspection PyUnresolvedReferences", "return", "render_modal_workflow", "(", "self", ".", "request", ",", "'{0}/chooser.ht...
22cac857175d8a6f77e470751831c14a92ccd768
train
ChooserView.form_valid
Processes a valid form submittal. :param form: the form instance. :rtype: django.http.HttpResponse.
wagtailplus/utils/views/chooser.py
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): """ 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...
[ "Processes", "a", "valid", "form", "submittal", "." ]
rfosterslo/wagtailplus
python
https://github.com/rfosterslo/wagtailplus/blob/22cac857175d8a6f77e470751831c14a92ccd768/wagtailplus/utils/views/chooser.py#L37-L57
[ "def", "form_valid", "(", "self", ",", "form", ")", ":", "#noinspection PyAttributeOutsideInit", "self", ".", "object", "=", "form", ".", "save", "(", ")", "# Index the link.", "for", "backend", "in", "get_search_backends", "(", ")", ":", "backend", ".", "add"...
22cac857175d8a6f77e470751831c14a92ccd768
train
ChooserView.get
Returns GET response. :param request: the request instance. :rtype: django.http.HttpResponse.
wagtailplus/utils/views/chooser.py
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): """ Returns GET response. :param request: the request instance. :rtype: django.http.HttpResponse. """ #noinspection PyAttributeOutsideInit self.object_list = self.get_queryset() context = self.get_co...
[ "Returns", "GET", "response", "." ]
rfosterslo/wagtailplus
python
https://github.com/rfosterslo/wagtailplus/blob/22cac857175d8a6f77e470751831c14a92ccd768/wagtailplus/utils/views/chooser.py#L59-L85
[ "def", "get", "(", "self", ",", "request", ",", "*", "args", ",", "*", "*", "kwargs", ")", ":", "#noinspection PyAttributeOutsideInit", "self", ".", "object_list", "=", "self", ".", "get_queryset", "(", ")", "context", "=", "self", ".", "get_context_data", ...
22cac857175d8a6f77e470751831c14a92ccd768
train
ChooserView.get_form_kwargs
Returns the keyword arguments for instantiating the form. :rtype: dict.
wagtailplus/utils/views/chooser.py
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): """ Returns the keyword arguments for instantiating the form. :rtype: dict. """ kwargs = { 'initial': self.get_initial(), 'prefix': self.get_prefix(), } #noinspection PyUnresolvedReferences if self.re...
[ "Returns", "the", "keyword", "arguments", "for", "instantiating", "the", "form", "." ]
rfosterslo/wagtailplus
python
https://github.com/rfosterslo/wagtailplus/blob/22cac857175d8a6f77e470751831c14a92ccd768/wagtailplus/utils/views/chooser.py#L106-L128
[ "def", "get_form_kwargs", "(", "self", ")", ":", "kwargs", "=", "{", "'initial'", ":", "self", ".", "get_initial", "(", ")", ",", "'prefix'", ":", "self", ".", "get_prefix", "(", ")", ",", "}", "#noinspection PyUnresolvedReferences", "if", "self", ".", "re...
22cac857175d8a6f77e470751831c14a92ccd768
train
create_entry_tag
Creates EntryTag for Entry corresponding to specified ItemBase instance. :param sender: the sending ItemBase class. :param instance: the ItemBase instance.
wagtailplus/wagtailrelations/signals/handlers.py
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): """ 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...
[ "Creates", "EntryTag", "for", "Entry", "corresponding", "to", "specified", "ItemBase", "instance", "." ]
rfosterslo/wagtailplus
python
https://github.com/rfosterslo/wagtailplus/blob/22cac857175d8a6f77e470751831c14a92ccd768/wagtailplus/wagtailrelations/signals/handlers.py#L11-L28
[ "def", "create_entry_tag", "(", "sender", ",", "instance", ",", "created", ",", "*", "*", "kwargs", ")", ":", "from", ".", ".", "models", "import", "(", "Entry", ",", "EntryTag", ")", "entry", "=", "Entry", ".", "objects", ".", "get_for_model", "(", "i...
22cac857175d8a6f77e470751831c14a92ccd768
train
delete_entry_tag
Deletes EntryTag for Entry corresponding to specified TaggedItemBase instance. :param sender: the sending TaggedItemBase class. :param instance: the TaggedItemBase instance.
wagtailplus/wagtailrelations/signals/handlers.py
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): """ 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 ...
[ "Deletes", "EntryTag", "for", "Entry", "corresponding", "to", "specified", "TaggedItemBase", "instance", "." ]
rfosterslo/wagtailplus
python
https://github.com/rfosterslo/wagtailplus/blob/22cac857175d8a6f77e470751831c14a92ccd768/wagtailplus/wagtailrelations/signals/handlers.py#L31-L47
[ "def", "delete_entry_tag", "(", "sender", ",", "instance", ",", "*", "*", "kwargs", ")", ":", "from", ".", ".", "models", "import", "(", "Entry", ",", "EntryTag", ")", "entry", "=", "Entry", ".", "objects", ".", "get_for_model", "(", "instance", ".", "...
22cac857175d8a6f77e470751831c14a92ccd768
train
delete_entry
Deletes Entry instance corresponding to specified instance. :param sender: the sending class. :param instance: the instance being deleted.
wagtailplus/wagtailrelations/signals/handlers.py
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): """ 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()
[ "Deletes", "Entry", "instance", "corresponding", "to", "specified", "instance", "." ]
rfosterslo/wagtailplus
python
https://github.com/rfosterslo/wagtailplus/blob/22cac857175d8a6f77e470751831c14a92ccd768/wagtailplus/wagtailrelations/signals/handlers.py#L50-L59
[ "def", "delete_entry", "(", "sender", ",", "instance", ",", "*", "*", "kwargs", ")", ":", "from", ".", ".", "models", "import", "Entry", "Entry", ".", "objects", ".", "get_for_model", "(", "instance", ")", "[", "0", "]", ".", "delete", "(", ")" ]
22cac857175d8a6f77e470751831c14a92ccd768
train
update_entry_attributes
Updates attributes for Entry instance corresponding to specified instance. :param sender: the sending class. :param instance: the instance being saved.
wagtailplus/wagtailrelations/signals/handlers.py
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): """ 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...
[ "Updates", "attributes", "for", "Entry", "instance", "corresponding", "to", "specified", "instance", "." ]
rfosterslo/wagtailplus
python
https://github.com/rfosterslo/wagtailplus/blob/22cac857175d8a6f77e470751831c14a92ccd768/wagtailplus/wagtailrelations/signals/handlers.py#L62-L79
[ "def", "update_entry_attributes", "(", "sender", ",", "instance", ",", "*", "*", "kwargs", ")", ":", "from", ".", ".", "models", "import", "Entry", "entry", "=", "Entry", ".", "objects", ".", "get_for_model", "(", "instance", ")", "[", "0", "]", "default...
22cac857175d8a6f77e470751831c14a92ccd768
train
get_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.
wagtailplus/wagtailrollbacks/views.py
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): """ 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...
[ "Returns", "paginated", "queryset", "of", "PageRevision", "instances", "for", "specified", "Page", "instance", "." ]
rfosterslo/wagtailplus
python
https://github.com/rfosterslo/wagtailplus/blob/22cac857175d8a6f77e470751831c14a92ccd768/wagtailplus/wagtailrollbacks/views.py#L27-L51
[ "def", "get_revisions", "(", "page", ",", "page_num", "=", "1", ")", ":", "revisions", "=", "page", ".", "revisions", ".", "order_by", "(", "'-created_at'", ")", "current", "=", "page", ".", "get_latest_revision", "(", ")", "if", "current", ":", "revisions...
22cac857175d8a6f77e470751831c14a92ccd768
train
page_revisions
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.
wagtailplus/wagtailrollbacks/views.py
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'): """ 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...
[ "Returns", "GET", "response", "for", "specified", "page", "revisions", "." ]
rfosterslo/wagtailplus
python
https://github.com/rfosterslo/wagtailplus/blob/22cac857175d8a6f77e470751831c14a92ccd768/wagtailplus/wagtailrollbacks/views.py#L53-L79
[ "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...
22cac857175d8a6f77e470751831c14a92ccd768
train
preview_page_version
Returns GET response for specified page preview. :param request: the request instance. :param reversion_pk: the page revision ID. :rtype: django.http.HttpResponse.
wagtailplus/wagtailrollbacks/views.py
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): """ 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 ...
[ "Returns", "GET", "response", "for", "specified", "page", "preview", "." ]
rfosterslo/wagtailplus
python
https://github.com/rfosterslo/wagtailplus/blob/22cac857175d8a6f77e470751831c14a92ccd768/wagtailplus/wagtailrollbacks/views.py#L81-L97
[ "def", "preview_page_version", "(", "request", ",", "revision_id", ")", ":", "revision", "=", "get_object_or_404", "(", "PageRevision", ",", "pk", "=", "revision_id", ")", "if", "not", "revision", ".", "page", ".", "permissions_for_user", "(", "request", ".", ...
22cac857175d8a6f77e470751831c14a92ccd768
train
confirm_page_reversion
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.
wagtailplus/wagtailrollbacks/views.py
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'): """ 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...
[ "Handles", "page", "reversion", "process", "(", "GET", "and", "POST", ")", "." ]
rfosterslo/wagtailplus
python
https://github.com/rfosterslo/wagtailplus/blob/22cac857175d8a6f77e470751831c14a92ccd768/wagtailplus/wagtailrollbacks/views.py#L99-L176
[ "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...
22cac857175d8a6f77e470751831c14a92ccd768
train
DocsKeyring.get_password
Get password of the username for the service
keyrings/alt/Google.py
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): """Get password of the username for the service """ result = self._get_entry(self._keyring, service, username) if result: result = self._decrypt(result) return result
[ "Get", "password", "of", "the", "username", "for", "the", "service" ]
jaraco/keyrings.alt
python
https://github.com/jaraco/keyrings.alt/blob/5b71223d12bf9ac6abd05b1b395f1efccb5ea660/keyrings/alt/Google.py#L85-L91
[ "def", "get_password", "(", "self", ",", "service", ",", "username", ")", ":", "result", "=", "self", ".", "_get_entry", "(", "self", ".", "_keyring", ",", "service", ",", "username", ")", "if", "result", ":", "result", "=", "self", ".", "_decrypt", "(...
5b71223d12bf9ac6abd05b1b395f1efccb5ea660
train
DocsKeyring.set_password
Set password for the username of the service
keyrings/alt/Google.py
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): """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...
[ "Set", "password", "for", "the", "username", "of", "the", "service" ]
jaraco/keyrings.alt
python
https://github.com/jaraco/keyrings.alt/blob/5b71223d12bf9ac6abd05b1b395f1efccb5ea660/keyrings/alt/Google.py#L93-L137
[ "def", "set_password", "(", "self", ",", "service", ",", "username", ",", "password", ")", ":", "password", "=", "self", ".", "_encrypt", "(", "password", "or", "''", ")", "keyring_working_copy", "=", "copy", ".", "deepcopy", "(", "self", ".", "_keyring", ...
5b71223d12bf9ac6abd05b1b395f1efccb5ea660
train
DocsKeyring._save_keyring
Helper to actually write the keyring to Google
keyrings/alt/Google.py
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): """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...
[ "Helper", "to", "actually", "write", "the", "keyring", "to", "Google" ]
jaraco/keyrings.alt
python
https://github.com/jaraco/keyrings.alt/blob/5b71223d12bf9ac6abd05b1b395f1efccb5ea660/keyrings/alt/Google.py#L247-L306
[ "def", "_save_keyring", "(", "self", ",", "keyring_dict", ")", ":", "import", "gdata", "result", "=", "self", ".", "OK", "file_contents", "=", "base64", ".", "urlsafe_b64encode", "(", "pickle", ".", "dumps", "(", "keyring_dict", ")", ")", "try", ":", "if",...
5b71223d12bf9ac6abd05b1b395f1efccb5ea660
train
Token.calculate_token
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
gtts_token/gtts_token.py
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): """ 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...
[ "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", ...
Boudewijn26/gTTS-token
python
https://github.com/Boudewijn26/gTTS-token/blob/9a1bb569bcce1ec091bfd9586dd54f9c879e7d3c/gtts_token/gtts_token.py#L21-L49
[ "def", "calculate_token", "(", "self", ",", "text", ",", "seed", "=", "None", ")", ":", "if", "seed", "is", "None", ":", "seed", "=", "self", ".", "_get_token_key", "(", ")", "[", "first_seed", ",", "second_seed", "]", "=", "seed", ".", "split", "(",...
9a1bb569bcce1ec091bfd9586dd54f9c879e7d3c
train
_request
Make HTTP request, raising an exception if it fails.
dweepy/api.py
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): """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...
[ "Make", "HTTP", "request", "raising", "an", "exception", "if", "it", "fails", "." ]
paddycarey/dweepy
python
https://github.com/paddycarey/dweepy/blob/1eb69de4a20c929c57be2a21e2aa39ae9a0ae298/dweepy/api.py#L29-L45
[ "def", "_request", "(", "method", ",", "url", ",", "session", "=", "None", ",", "*", "*", "kwargs", ")", ":", "url", "=", "BASE_URL", "+", "url", "if", "session", ":", "request_func", "=", "getattr", "(", "session", ",", "method", ")", "else", ":", ...
1eb69de4a20c929c57be2a21e2aa39ae9a0ae298
train
_send_dweet
Send a dweet to dweet.io
dweepy/api.py
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): """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)
[ "Send", "a", "dweet", "to", "dweet", ".", "io" ]
paddycarey/dweepy
python
https://github.com/paddycarey/dweepy/blob/1eb69de4a20c929c57be2a21e2aa39ae9a0ae298/dweepy/api.py#L48-L53
[ "def", "_send_dweet", "(", "payload", ",", "url", ",", "params", "=", "None", ",", "session", "=", "None", ")", ":", "data", "=", "json", ".", "dumps", "(", "payload", ")", "headers", "=", "{", "'Content-type'", ":", "'application/json'", "}", "return", ...
1eb69de4a20c929c57be2a21e2aa39ae9a0ae298
train
dweet_for
Send a dweet to dweet.io for a thing with a known name
dweepy/api.py
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): """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)
[ "Send", "a", "dweet", "to", "dweet", ".", "io", "for", "a", "thing", "with", "a", "known", "name" ]
paddycarey/dweepy
python
https://github.com/paddycarey/dweepy/blob/1eb69de4a20c929c57be2a21e2aa39ae9a0ae298/dweepy/api.py#L62-L69
[ "def", "dweet_for", "(", "thing_name", ",", "payload", ",", "key", "=", "None", ",", "session", "=", "None", ")", ":", "if", "key", "is", "not", "None", ":", "params", "=", "{", "'key'", ":", "key", "}", "else", ":", "params", "=", "None", "return"...
1eb69de4a20c929c57be2a21e2aa39ae9a0ae298
train
get_dweets_for
Read all the dweets for a dweeter
dweepy/api.py
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): """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)
[ "Read", "all", "the", "dweets", "for", "a", "dweeter" ]
paddycarey/dweepy
python
https://github.com/paddycarey/dweepy/blob/1eb69de4a20c929c57be2a21e2aa39ae9a0ae298/dweepy/api.py#L82-L89
[ "def", "get_dweets_for", "(", "thing_name", ",", "key", "=", "None", ",", "session", "=", "None", ")", ":", "if", "key", "is", "not", "None", ":", "params", "=", "{", "'key'", ":", "key", "}", "else", ":", "params", "=", "None", "return", "_request",...
1eb69de4a20c929c57be2a21e2aa39ae9a0ae298
train
remove_lock
Remove a lock (no matter what it's connected to).
dweepy/api.py
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): """Remove a lock (no matter what it's connected to). """ return _request('get', '/remove/lock/{0}'.format(lock), params={'key': key}, session=session)
[ "Remove", "a", "lock", "(", "no", "matter", "what", "it", "s", "connected", "to", ")", "." ]
paddycarey/dweepy
python
https://github.com/paddycarey/dweepy/blob/1eb69de4a20c929c57be2a21e2aa39ae9a0ae298/dweepy/api.py#L92-L95
[ "def", "remove_lock", "(", "lock", ",", "key", ",", "session", "=", "None", ")", ":", "return", "_request", "(", "'get'", ",", "'/remove/lock/{0}'", ".", "format", "(", "lock", ")", ",", "params", "=", "{", "'key'", ":", "key", "}", ",", "session", "...
1eb69de4a20c929c57be2a21e2aa39ae9a0ae298
train
lock
Lock a thing (prevents unauthed dweets for the locked thing)
dweepy/api.py
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): """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)
[ "Lock", "a", "thing", "(", "prevents", "unauthed", "dweets", "for", "the", "locked", "thing", ")" ]
paddycarey/dweepy
python
https://github.com/paddycarey/dweepy/blob/1eb69de4a20c929c57be2a21e2aa39ae9a0ae298/dweepy/api.py#L98-L101
[ "def", "lock", "(", "thing_name", ",", "lock", ",", "key", ",", "session", "=", "None", ")", ":", "return", "_request", "(", "'get'", ",", "'/lock/{0}'", ".", "format", "(", "thing_name", ")", ",", "params", "=", "{", "'key'", ":", "key", ",", "'lock...
1eb69de4a20c929c57be2a21e2aa39ae9a0ae298
train
unlock
Unlock a thing
dweepy/api.py
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): """Unlock a thing """ return _request('get', '/unlock/{0}'.format(thing_name), params={'key': key}, session=session)
[ "Unlock", "a", "thing" ]
paddycarey/dweepy
python
https://github.com/paddycarey/dweepy/blob/1eb69de4a20c929c57be2a21e2aa39ae9a0ae298/dweepy/api.py#L104-L107
[ "def", "unlock", "(", "thing_name", ",", "key", ",", "session", "=", "None", ")", ":", "return", "_request", "(", "'get'", ",", "'/unlock/{0}'", ".", "format", "(", "thing_name", ")", ",", "params", "=", "{", "'key'", ":", "key", "}", ",", "session", ...
1eb69de4a20c929c57be2a21e2aa39ae9a0ae298
train
set_alert
Set an alert on a thing with the given condition
dweepy/api.py
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): """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)
[ "Set", "an", "alert", "on", "a", "thing", "with", "the", "given", "condition" ]
paddycarey/dweepy
python
https://github.com/paddycarey/dweepy/blob/1eb69de4a20c929c57be2a21e2aa39ae9a0ae298/dweepy/api.py#L110-L117
[ "def", "set_alert", "(", "thing_name", ",", "who", ",", "condition", ",", "key", ",", "session", "=", "None", ")", ":", "return", "_request", "(", "'get'", ",", "'/alert/{0}/when/{1}/{2}'", ".", "format", "(", "','", ".", "join", "(", "who", ")", ",", ...
1eb69de4a20c929c57be2a21e2aa39ae9a0ae298
train
get_alert
Set an alert on a thing with the given condition
dweepy/api.py
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): """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)
[ "Set", "an", "alert", "on", "a", "thing", "with", "the", "given", "condition" ]
paddycarey/dweepy
python
https://github.com/paddycarey/dweepy/blob/1eb69de4a20c929c57be2a21e2aa39ae9a0ae298/dweepy/api.py#L120-L123
[ "def", "get_alert", "(", "thing_name", ",", "key", ",", "session", "=", "None", ")", ":", "return", "_request", "(", "'get'", ",", "'/get/alert/for/{0}'", ".", "format", "(", "thing_name", ")", ",", "params", "=", "{", "'key'", ":", "key", "}", ",", "s...
1eb69de4a20c929c57be2a21e2aa39ae9a0ae298
train
remove_alert
Remove an alert for the given thing
dweepy/api.py
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): """Remove an alert for the given thing """ return _request('get', '/remove/alert/for/{0}'.format(thing_name), params={'key': key}, session=session)
[ "Remove", "an", "alert", "for", "the", "given", "thing" ]
paddycarey/dweepy
python
https://github.com/paddycarey/dweepy/blob/1eb69de4a20c929c57be2a21e2aa39ae9a0ae298/dweepy/api.py#L126-L129
[ "def", "remove_alert", "(", "thing_name", ",", "key", ",", "session", "=", "None", ")", ":", "return", "_request", "(", "'get'", ",", "'/remove/alert/for/{0}'", ".", "format", "(", "thing_name", ")", ",", "params", "=", "{", "'key'", ":", "key", "}", ","...
1eb69de4a20c929c57be2a21e2aa39ae9a0ae298
train
ProductSetAPI.get_product_sets
list all product sets for current user
productai/__init__.py
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): """ 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)
[ "list", "all", "product", "sets", "for", "current", "user" ]
MalongTech/productai-python-sdk
python
https://github.com/MalongTech/productai-python-sdk/blob/2227783dbef4ce8e94613c08e67d65d6eecee21c/productai/__init__.py#L488-L494
[ "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", ")" ]
2227783dbef4ce8e94613c08e67d65d6eecee21c
train
ProductSetAPI.delete_all_product_sets
BE NOTICED: this will delete all product sets for current user
productai/__init__.py
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): """ 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)
[ "BE", "NOTICED", ":", "this", "will", "delete", "all", "product", "sets", "for", "current", "user" ]
MalongTech/productai-python-sdk
python
https://github.com/MalongTech/productai-python-sdk/blob/2227783dbef4ce8e94613c08e67d65d6eecee21c/productai/__init__.py#L496-L502
[ "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"...
2227783dbef4ce8e94613c08e67d65d6eecee21c
train
ProductSetAPI.get_products
This function (and backend API) is being obsoleted. Don't use it anymore.
productai/__init__.py
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): """ 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....
[ "This", "function", "(", "and", "backend", "API", ")", "is", "being", "obsoleted", ".", "Don", "t", "use", "it", "anymore", "." ]
MalongTech/productai-python-sdk
python
https://github.com/MalongTech/productai-python-sdk/blob/2227783dbef4ce8e94613c08e67d65d6eecee21c/productai/__init__.py#L544-L551
[ "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...
2227783dbef4ce8e94613c08e67d65d6eecee21c
train
_check_stream_timeout
Check if the timeout has been reached and raise a `StopIteration` if so.
dweepy/streaming.py
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): """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
[ "Check", "if", "the", "timeout", "has", "been", "reached", "and", "raise", "a", "StopIteration", "if", "so", "." ]
paddycarey/dweepy
python
https://github.com/paddycarey/dweepy/blob/1eb69de4a20c929c57be2a21e2aa39ae9a0ae298/dweepy/streaming.py#L32-L38
[ "def", "_check_stream_timeout", "(", "started", ",", "timeout", ")", ":", "if", "timeout", ":", "elapsed", "=", "datetime", ".", "datetime", ".", "utcnow", "(", ")", "-", "started", "if", "elapsed", ".", "seconds", ">", "timeout", ":", "raise", "StopIterat...
1eb69de4a20c929c57be2a21e2aa39ae9a0ae298
train
_listen_for_dweets_from_response
Yields dweets as received from dweet.io's streaming API
dweepy/streaming.py
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): """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...
[ "Yields", "dweets", "as", "received", "from", "dweet", ".", "io", "s", "streaming", "API" ]
paddycarey/dweepy
python
https://github.com/paddycarey/dweepy/blob/1eb69de4a20c929c57be2a21e2aa39ae9a0ae298/dweepy/streaming.py#L41-L54
[ "def", "_listen_for_dweets_from_response", "(", "response", ")", ":", "streambuffer", "=", "''", "for", "byte", "in", "response", ".", "iter_content", "(", ")", ":", "if", "byte", ":", "streambuffer", "+=", "byte", ".", "decode", "(", "'ascii'", ")", "try", ...
1eb69de4a20c929c57be2a21e2aa39ae9a0ae298
train
listen_for_dweets_from
Create a real-time subscription to dweets
dweepy/streaming.py
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): """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: ...
[ "Create", "a", "real", "-", "time", "subscription", "to", "dweets" ]
paddycarey/dweepy
python
https://github.com/paddycarey/dweepy/blob/1eb69de4a20c929c57be2a21e2aa39ae9a0ae298/dweepy/streaming.py#L57-L77
[ "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", "=...
1eb69de4a20c929c57be2a21e2aa39ae9a0ae298
train
BadCaseApi.add
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
productai/bad_case.py
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: raise ValueError('request_id is required') """ curl -X POST \ -H 'x-ca-version: 1.0' \ ...
[ "curl", "-", "X", "POST", "\\", "-", "H", "x", "-", "ca", "-", "version", ":", "1", ".", "0", "\\", "-", "H", "x", "-", "ca", "-", "accesskeyid", ":", "YourAccessId", "\\", "-", "d", "service_id", "=", "p4dkh2sg&request_id", "=", "c13ed5aa", "-", ...
MalongTech/productai-python-sdk
python
https://github.com/MalongTech/productai-python-sdk/blob/2227783dbef4ce8e94613c08e67d65d6eecee21c/productai/bad_case.py#L9-L47
[ "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", ...
2227783dbef4ce8e94613c08e67d65d6eecee21c
train
Packer.build
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
packer.py
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): """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...
[ "Executes", "a", "packer", "build" ]
nir0s/python-packer
python
https://github.com/nir0s/python-packer/blob/aebb9936e1f7fbfc75131cf2b0284239298faced/packer.py#L44-L62
[ "def", "build", "(", "self", ",", "parallel", "=", "True", ",", "debug", "=", "False", ",", "force", "=", "False", ",", "machine_readable", "=", "False", ")", ":", "self", ".", "packer_cmd", "=", "self", ".", "packer", ".", "build", "self", ".", "_ad...
aebb9936e1f7fbfc75131cf2b0284239298faced
train
Packer.fix
Implements the `packer fix` function :param string to_file: File to output fixed template to
packer.py
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): """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...
[ "Implements", "the", "packer", "fix", "function" ]
nir0s/python-packer
python
https://github.com/nir0s/python-packer/blob/aebb9936e1f7fbfc75131cf2b0284239298faced/packer.py#L64-L78
[ "def", "fix", "(", "self", ",", "to_file", "=", "None", ")", ":", "self", ".", "packer_cmd", "=", "self", ".", "packer", ".", "fix", "self", ".", "_add_opt", "(", "self", ".", "packerfile", ")", "result", "=", "self", ".", "packer_cmd", "(", ")", "...
aebb9936e1f7fbfc75131cf2b0284239298faced
train
Packer.inspect
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": [ { ...
packer.py
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): """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: ...
[ "Inspects", "a", "Packer", "Templates", "file", "(", "packer", "inspect", "-", "machine", "-", "readable", ")" ]
nir0s/python-packer
python
https://github.com/nir0s/python-packer/blob/aebb9936e1f7fbfc75131cf2b0284239298faced/packer.py#L80-L121
[ "def", "inspect", "(", "self", ",", "mrf", "=", "True", ")", ":", "self", ".", "packer_cmd", "=", "self", ".", "packer", ".", "inspect", "self", ".", "_add_opt", "(", "'-machine-readable'", "if", "mrf", "else", "None", ")", "self", ".", "_add_opt", "("...
aebb9936e1f7fbfc75131cf2b0284239298faced
train
Packer.push
Implmenets the `packer push` function UNTESTED! Must be used alongside an Atlas account
packer.py
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): """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...
[ "Implmenets", "the", "packer", "push", "function" ]
nir0s/python-packer
python
https://github.com/nir0s/python-packer/blob/aebb9936e1f7fbfc75131cf2b0284239298faced/packer.py#L123-L134
[ "def", "push", "(", "self", ",", "create", "=", "True", ",", "token", "=", "False", ")", ":", "self", ".", "packer_cmd", "=", "self", ".", "packer", ".", "push", "self", ".", "_add_opt", "(", "'-create=true'", "if", "create", "else", "None", ")", "se...
aebb9936e1f7fbfc75131cf2b0284239298faced
train
Packer.validate
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.
packer.py
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): """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...
[ "Validates", "a", "Packer", "Template", "file", "(", "packer", "validate", ")" ]
nir0s/python-packer
python
https://github.com/nir0s/python-packer/blob/aebb9936e1f7fbfc75131cf2b0284239298faced/packer.py#L136-L161
[ "def", "validate", "(", "self", ",", "syntax_only", "=", "False", ")", ":", "self", ".", "packer_cmd", "=", "self", ".", "packer", ".", "validate", "self", ".", "_add_opt", "(", "'-syntax-only'", "if", "syntax_only", "else", "None", ")", "self", ".", "_a...
aebb9936e1f7fbfc75131cf2b0284239298faced
train
Packer._append_base_arguments
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.
packer.py
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): """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: ...
[ "Appends", "base", "arguments", "to", "packer", "commands", "." ]
nir0s/python-packer
python
https://github.com/nir0s/python-packer/blob/aebb9936e1f7fbfc75131cf2b0284239298faced/packer.py#L183-L200
[ "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", ...
aebb9936e1f7fbfc75131cf2b0284239298faced
train
Packer._parse_inspection_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
packer.py
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): """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....
[ "Parses", "the", "machine", "-", "readable", "output", "packer", "inspect", "provides", "." ]
nir0s/python-packer
python
https://github.com/nir0s/python-packer/blob/aebb9936e1f7fbfc75131cf2b0284239298faced/packer.py#L206-L227
[ "def", "_parse_inspection_output", "(", "self", ",", "output", ")", ":", "parts", "=", "{", "'variables'", ":", "[", "]", ",", "'builders'", ":", "[", "]", ",", "'provisioners'", ":", "[", "]", "}", "for", "line", "in", "output", ".", "splitlines", "("...
aebb9936e1f7fbfc75131cf2b0284239298faced
train
Request.post
Perform an HTTP POST request for a given url. Returns the response object.
neo4jrestclient/request.py
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): """ Perform an HTTP POST request for a given url. Returns the response object. """ return self._request('POST', url, data, headers=headers)
[ "Perform", "an", "HTTP", "POST", "request", "for", "a", "given", "url", ".", "Returns", "the", "response", "object", "." ]
versae/neo4j-rest-client
python
https://github.com/versae/neo4j-rest-client/blob/b03c09c8f598fa4dbad8ea8998ffb1c885805074/neo4jrestclient/request.py#L65-L70
[ "def", "post", "(", "self", ",", "url", ",", "data", ",", "headers", "=", "None", ")", ":", "return", "self", ".", "_request", "(", "'POST'", ",", "url", ",", "data", ",", "headers", "=", "headers", ")" ]
b03c09c8f598fa4dbad8ea8998ffb1c885805074
train
Request.put
Perform an HTTP PUT request for a given url. Returns the response object.
neo4jrestclient/request.py
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): """ Perform an HTTP PUT request for a given url. Returns the response object. """ return self._request('PUT', url, data, headers=headers)
[ "Perform", "an", "HTTP", "PUT", "request", "for", "a", "given", "url", ".", "Returns", "the", "response", "object", "." ]
versae/neo4j-rest-client
python
https://github.com/versae/neo4j-rest-client/blob/b03c09c8f598fa4dbad8ea8998ffb1c885805074/neo4jrestclient/request.py#L72-L77
[ "def", "put", "(", "self", ",", "url", ",", "data", ",", "headers", "=", "None", ")", ":", "return", "self", ".", "_request", "(", "'PUT'", ",", "url", ",", "data", ",", "headers", "=", "headers", ")" ]
b03c09c8f598fa4dbad8ea8998ffb1c885805074