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 | _update_search_index | Process index / update search index update actions. | elasticsearch_django/apps.py | def _update_search_index(*, instance, index, update_fields):
"""Process index / update search index update actions."""
if not _in_search_queryset(instance=instance, index=index):
logger.debug(
"Object (%r) is not in search queryset, ignoring update.", instance
)
return
t... | def _update_search_index(*, instance, index, update_fields):
"""Process index / update search index update actions."""
if not _in_search_queryset(instance=instance, index=index):
logger.debug(
"Object (%r) is not in search queryset, ignoring update.", instance
)
return
t... | [
"Process",
"index",
"/",
"update",
"search",
"index",
"update",
"actions",
"."
] | yunojuno/elasticsearch-django | python | https://github.com/yunojuno/elasticsearch-django/blob/e8d98d32bcd77f1bedb8f1a22b6523ca44ffd489/elasticsearch_django/apps.py#L112-L137 | [
"def",
"_update_search_index",
"(",
"*",
",",
"instance",
",",
"index",
",",
"update_fields",
")",
":",
"if",
"not",
"_in_search_queryset",
"(",
"instance",
"=",
"instance",
",",
"index",
"=",
"index",
")",
":",
"logger",
".",
"debug",
"(",
"\"Object (%r) is... | e8d98d32bcd77f1bedb8f1a22b6523ca44ffd489 |
train | _delete_from_search_index | Remove a document from a search index. | elasticsearch_django/apps.py | def _delete_from_search_index(*, instance, index):
"""Remove a document from a search index."""
pre_delete.send(sender=instance.__class__, instance=instance, index=index)
if settings.auto_sync(instance):
instance.delete_search_document(index=index) | def _delete_from_search_index(*, instance, index):
"""Remove a document from a search index."""
pre_delete.send(sender=instance.__class__, instance=instance, index=index)
if settings.auto_sync(instance):
instance.delete_search_document(index=index) | [
"Remove",
"a",
"document",
"from",
"a",
"search",
"index",
"."
] | yunojuno/elasticsearch-django | python | https://github.com/yunojuno/elasticsearch-django/blob/e8d98d32bcd77f1bedb8f1a22b6523ca44ffd489/elasticsearch_django/apps.py#L140-L144 | [
"def",
"_delete_from_search_index",
"(",
"*",
",",
"instance",
",",
"index",
")",
":",
"pre_delete",
".",
"send",
"(",
"sender",
"=",
"instance",
".",
"__class__",
",",
"instance",
"=",
"instance",
",",
"index",
"=",
"index",
")",
"if",
"settings",
".",
... | e8d98d32bcd77f1bedb8f1a22b6523ca44ffd489 |
train | ElasticAppConfig.ready | Validate config and connect signals. | elasticsearch_django/apps.py | def ready(self):
"""Validate config and connect signals."""
super(ElasticAppConfig, self).ready()
_validate_config(settings.get_setting("strict_validation"))
_connect_signals() | def ready(self):
"""Validate config and connect signals."""
super(ElasticAppConfig, self).ready()
_validate_config(settings.get_setting("strict_validation"))
_connect_signals() | [
"Validate",
"config",
"and",
"connect",
"signals",
"."
] | yunojuno/elasticsearch-django | python | https://github.com/yunojuno/elasticsearch-django/blob/e8d98d32bcd77f1bedb8f1a22b6523ca44ffd489/elasticsearch_django/apps.py#L21-L25 | [
"def",
"ready",
"(",
"self",
")",
":",
"super",
"(",
"ElasticAppConfig",
",",
"self",
")",
".",
"ready",
"(",
")",
"_validate_config",
"(",
"settings",
".",
"get_setting",
"(",
"\"strict_validation\"",
")",
")",
"_connect_signals",
"(",
")"
] | e8d98d32bcd77f1bedb8f1a22b6523ca44ffd489 |
train | get_setting | Return specific search setting from Django conf. | elasticsearch_django/settings.py | def get_setting(key, *default):
"""Return specific search setting from Django conf."""
if default:
return get_settings().get(key, default[0])
else:
return get_settings()[key] | def get_setting(key, *default):
"""Return specific search setting from Django conf."""
if default:
return get_settings().get(key, default[0])
else:
return get_settings()[key] | [
"Return",
"specific",
"search",
"setting",
"from",
"Django",
"conf",
"."
] | yunojuno/elasticsearch-django | python | https://github.com/yunojuno/elasticsearch-django/blob/e8d98d32bcd77f1bedb8f1a22b6523ca44ffd489/elasticsearch_django/settings.py#L29-L34 | [
"def",
"get_setting",
"(",
"key",
",",
"*",
"default",
")",
":",
"if",
"default",
":",
"return",
"get_settings",
"(",
")",
".",
"get",
"(",
"key",
",",
"default",
"[",
"0",
"]",
")",
"else",
":",
"return",
"get_settings",
"(",
")",
"[",
"key",
"]"
... | e8d98d32bcd77f1bedb8f1a22b6523ca44ffd489 |
train | get_index_mapping | Return the JSON mapping file for an index.
Mappings are stored as JSON files in the mappings subdirectory of this
app. They must be saved as {{index}}.json.
Args:
index: string, the name of the index to look for. | elasticsearch_django/settings.py | def get_index_mapping(index):
"""Return the JSON mapping file for an index.
Mappings are stored as JSON files in the mappings subdirectory of this
app. They must be saved as {{index}}.json.
Args:
index: string, the name of the index to look for.
"""
# app_path = apps.get_app_config('e... | def get_index_mapping(index):
"""Return the JSON mapping file for an index.
Mappings are stored as JSON files in the mappings subdirectory of this
app. They must be saved as {{index}}.json.
Args:
index: string, the name of the index to look for.
"""
# app_path = apps.get_app_config('e... | [
"Return",
"the",
"JSON",
"mapping",
"file",
"for",
"an",
"index",
"."
] | yunojuno/elasticsearch-django | python | https://github.com/yunojuno/elasticsearch-django/blob/e8d98d32bcd77f1bedb8f1a22b6523ca44ffd489/elasticsearch_django/settings.py#L57-L72 | [
"def",
"get_index_mapping",
"(",
"index",
")",
":",
"# app_path = apps.get_app_config('elasticsearch_django').path",
"mappings_dir",
"=",
"get_setting",
"(",
"\"mappings_dir\"",
")",
"filename",
"=",
"\"%s.json\"",
"%",
"index",
"path",
"=",
"os",
".",
"path",
".",
"j... | e8d98d32bcd77f1bedb8f1a22b6523ca44ffd489 |
train | get_model_index_properties | Return the list of properties specified for a model in an index. | elasticsearch_django/settings.py | def get_model_index_properties(instance, index):
"""Return the list of properties specified for a model in an index."""
mapping = get_index_mapping(index)
doc_type = instance._meta.model_name.lower()
return list(mapping["mappings"][doc_type]["properties"].keys()) | def get_model_index_properties(instance, index):
"""Return the list of properties specified for a model in an index."""
mapping = get_index_mapping(index)
doc_type = instance._meta.model_name.lower()
return list(mapping["mappings"][doc_type]["properties"].keys()) | [
"Return",
"the",
"list",
"of",
"properties",
"specified",
"for",
"a",
"model",
"in",
"an",
"index",
"."
] | yunojuno/elasticsearch-django | python | https://github.com/yunojuno/elasticsearch-django/blob/e8d98d32bcd77f1bedb8f1a22b6523ca44ffd489/elasticsearch_django/settings.py#L75-L79 | [
"def",
"get_model_index_properties",
"(",
"instance",
",",
"index",
")",
":",
"mapping",
"=",
"get_index_mapping",
"(",
"index",
")",
"doc_type",
"=",
"instance",
".",
"_meta",
".",
"model_name",
".",
"lower",
"(",
")",
"return",
"list",
"(",
"mapping",
"[",... | e8d98d32bcd77f1bedb8f1a22b6523ca44ffd489 |
train | get_index_models | Return list of models configured for a named index.
Args:
index: string, the name of the index to look up. | elasticsearch_django/settings.py | def get_index_models(index):
"""Return list of models configured for a named index.
Args:
index: string, the name of the index to look up.
"""
models = []
for app_model in get_index_config(index).get("models"):
app, model = app_model.split(".")
models.append(apps.get_model(... | def get_index_models(index):
"""Return list of models configured for a named index.
Args:
index: string, the name of the index to look up.
"""
models = []
for app_model in get_index_config(index).get("models"):
app, model = app_model.split(".")
models.append(apps.get_model(... | [
"Return",
"list",
"of",
"models",
"configured",
"for",
"a",
"named",
"index",
"."
] | yunojuno/elasticsearch-django | python | https://github.com/yunojuno/elasticsearch-django/blob/e8d98d32bcd77f1bedb8f1a22b6523ca44ffd489/elasticsearch_django/settings.py#L82-L93 | [
"def",
"get_index_models",
"(",
"index",
")",
":",
"models",
"=",
"[",
"]",
"for",
"app_model",
"in",
"get_index_config",
"(",
"index",
")",
".",
"get",
"(",
"\"models\"",
")",
":",
"app",
",",
"model",
"=",
"app_model",
".",
"split",
"(",
"\".\"",
")"... | e8d98d32bcd77f1bedb8f1a22b6523ca44ffd489 |
train | get_model_indexes | Return list of all indexes in which a model is configured.
A model may be configured to appear in multiple indexes. This function
will return the names of the indexes as a list of strings. This is
useful if you want to know which indexes need updating when a model
is saved.
Args:
model: a ... | elasticsearch_django/settings.py | def get_model_indexes(model):
"""Return list of all indexes in which a model is configured.
A model may be configured to appear in multiple indexes. This function
will return the names of the indexes as a list of strings. This is
useful if you want to know which indexes need updating when a model
i... | def get_model_indexes(model):
"""Return list of all indexes in which a model is configured.
A model may be configured to appear in multiple indexes. This function
will return the names of the indexes as a list of strings. This is
useful if you want to know which indexes need updating when a model
i... | [
"Return",
"list",
"of",
"all",
"indexes",
"in",
"which",
"a",
"model",
"is",
"configured",
"."
] | yunojuno/elasticsearch-django | python | https://github.com/yunojuno/elasticsearch-django/blob/e8d98d32bcd77f1bedb8f1a22b6523ca44ffd489/elasticsearch_django/settings.py#L96-L113 | [
"def",
"get_model_indexes",
"(",
"model",
")",
":",
"indexes",
"=",
"[",
"]",
"for",
"index",
"in",
"get_index_names",
"(",
")",
":",
"for",
"app_model",
"in",
"get_index_models",
"(",
"index",
")",
":",
"if",
"app_model",
"==",
"model",
":",
"indexes",
... | e8d98d32bcd77f1bedb8f1a22b6523ca44ffd489 |
train | get_document_models | Return dict of index.doc_type: model. | elasticsearch_django/settings.py | def get_document_models():
"""Return dict of index.doc_type: model."""
mappings = {}
for i in get_index_names():
for m in get_index_models(i):
key = "%s.%s" % (i, m._meta.model_name)
mappings[key] = m
return mappings | def get_document_models():
"""Return dict of index.doc_type: model."""
mappings = {}
for i in get_index_names():
for m in get_index_models(i):
key = "%s.%s" % (i, m._meta.model_name)
mappings[key] = m
return mappings | [
"Return",
"dict",
"of",
"index",
".",
"doc_type",
":",
"model",
"."
] | yunojuno/elasticsearch-django | python | https://github.com/yunojuno/elasticsearch-django/blob/e8d98d32bcd77f1bedb8f1a22b6523ca44ffd489/elasticsearch_django/settings.py#L116-L123 | [
"def",
"get_document_models",
"(",
")",
":",
"mappings",
"=",
"{",
"}",
"for",
"i",
"in",
"get_index_names",
"(",
")",
":",
"for",
"m",
"in",
"get_index_models",
"(",
"i",
")",
":",
"key",
"=",
"\"%s.%s\"",
"%",
"(",
"i",
",",
"m",
".",
"_meta",
".... | e8d98d32bcd77f1bedb8f1a22b6523ca44ffd489 |
train | auto_sync | Returns bool if auto_sync is on for the model (instance) | elasticsearch_django/settings.py | def auto_sync(instance):
"""Returns bool if auto_sync is on for the model (instance)"""
# this allows us to turn off sync temporarily - e.g. when doing bulk updates
if not get_setting("auto_sync"):
return False
model_name = "{}.{}".format(instance._meta.app_label, instance._meta.model_name)
... | def auto_sync(instance):
"""Returns bool if auto_sync is on for the model (instance)"""
# this allows us to turn off sync temporarily - e.g. when doing bulk updates
if not get_setting("auto_sync"):
return False
model_name = "{}.{}".format(instance._meta.app_label, instance._meta.model_name)
... | [
"Returns",
"bool",
"if",
"auto_sync",
"is",
"on",
"for",
"the",
"model",
"(",
"instance",
")"
] | yunojuno/elasticsearch-django | python | https://github.com/yunojuno/elasticsearch-django/blob/e8d98d32bcd77f1bedb8f1a22b6523ca44ffd489/elasticsearch_django/settings.py#L131-L139 | [
"def",
"auto_sync",
"(",
"instance",
")",
":",
"# this allows us to turn off sync temporarily - e.g. when doing bulk updates",
"if",
"not",
"get_setting",
"(",
"\"auto_sync\"",
")",
":",
"return",
"False",
"model_name",
"=",
"\"{}.{}\"",
".",
"format",
"(",
"instance",
... | e8d98d32bcd77f1bedb8f1a22b6523ca44ffd489 |
train | pprint | Returns an indented HTML pretty-print version of JSON.
Take the event_payload JSON, indent it, order the keys and then
present it as a <code> block. That's about as good as we can get
until someone builds a custom syntax function. | elasticsearch_django/admin.py | def pprint(data):
"""
Returns an indented HTML pretty-print version of JSON.
Take the event_payload JSON, indent it, order the keys and then
present it as a <code> block. That's about as good as we can get
until someone builds a custom syntax function.
"""
pretty = json.dumps(data, sort_ke... | def pprint(data):
"""
Returns an indented HTML pretty-print version of JSON.
Take the event_payload JSON, indent it, order the keys and then
present it as a <code> block. That's about as good as we can get
until someone builds a custom syntax function.
"""
pretty = json.dumps(data, sort_ke... | [
"Returns",
"an",
"indented",
"HTML",
"pretty",
"-",
"print",
"version",
"of",
"JSON",
"."
] | yunojuno/elasticsearch-django | python | https://github.com/yunojuno/elasticsearch-django/blob/e8d98d32bcd77f1bedb8f1a22b6523ca44ffd489/elasticsearch_django/admin.py#L13-L24 | [
"def",
"pprint",
"(",
"data",
")",
":",
"pretty",
"=",
"json",
".",
"dumps",
"(",
"data",
",",
"sort_keys",
"=",
"True",
",",
"indent",
"=",
"4",
",",
"separators",
"=",
"(",
"\",\"",
",",
"\": \"",
")",
")",
"html",
"=",
"pretty",
".",
"replace",
... | e8d98d32bcd77f1bedb8f1a22b6523ca44ffd489 |
train | addHelpMenu | Adds a help menu to the plugin menu.
This method should be called from the initGui() method of the plugin
:param menuName: The name of the plugin menu in which the about menu is to be added. | qgiscommons2/gui/__init__.py | def addHelpMenu(menuName, parentMenuFunction=None):
'''
Adds a help menu to the plugin menu.
This method should be called from the initGui() method of the plugin
:param menuName: The name of the plugin menu in which the about menu is to be added.
'''
parentMenuFunction = parentMenuFunction or ... | def addHelpMenu(menuName, parentMenuFunction=None):
'''
Adds a help menu to the plugin menu.
This method should be called from the initGui() method of the plugin
:param menuName: The name of the plugin menu in which the about menu is to be added.
'''
parentMenuFunction = parentMenuFunction or ... | [
"Adds",
"a",
"help",
"menu",
"to",
"the",
"plugin",
"menu",
".",
"This",
"method",
"should",
"be",
"called",
"from",
"the",
"initGui",
"()",
"method",
"of",
"the",
"plugin"
] | boundlessgeo/lib-qgis-commons | python | https://github.com/boundlessgeo/lib-qgis-commons/blob/d25d13803db08c18632b55d12036e332f006d9ac/qgiscommons2/gui/__init__.py#L12-L29 | [
"def",
"addHelpMenu",
"(",
"menuName",
",",
"parentMenuFunction",
"=",
"None",
")",
":",
"parentMenuFunction",
"=",
"parentMenuFunction",
"or",
"iface",
".",
"addPluginToMenu",
"namespace",
"=",
"_callerName",
"(",
")",
".",
"split",
"(",
"\".\"",
")",
"[",
"0... | d25d13803db08c18632b55d12036e332f006d9ac |
train | addAboutMenu | Adds an 'about...' menu to the plugin menu.
This method should be called from the initGui() method of the plugin
:param menuName: The name of the plugin menu in which the about menu is to be added | qgiscommons2/gui/__init__.py | def addAboutMenu(menuName, parentMenuFunction=None):
'''
Adds an 'about...' menu to the plugin menu.
This method should be called from the initGui() method of the plugin
:param menuName: The name of the plugin menu in which the about menu is to be added
'''
parentMenuFunction = parentMenuFunct... | def addAboutMenu(menuName, parentMenuFunction=None):
'''
Adds an 'about...' menu to the plugin menu.
This method should be called from the initGui() method of the plugin
:param menuName: The name of the plugin menu in which the about menu is to be added
'''
parentMenuFunction = parentMenuFunct... | [
"Adds",
"an",
"about",
"...",
"menu",
"to",
"the",
"plugin",
"menu",
".",
"This",
"method",
"should",
"be",
"called",
"from",
"the",
"initGui",
"()",
"method",
"of",
"the",
"plugin"
] | boundlessgeo/lib-qgis-commons | python | https://github.com/boundlessgeo/lib-qgis-commons/blob/d25d13803db08c18632b55d12036e332f006d9ac/qgiscommons2/gui/__init__.py#L47-L63 | [
"def",
"addAboutMenu",
"(",
"menuName",
",",
"parentMenuFunction",
"=",
"None",
")",
":",
"parentMenuFunction",
"=",
"parentMenuFunction",
"or",
"iface",
".",
"addPluginToMenu",
"namespace",
"=",
"_callerName",
"(",
")",
".",
"split",
"(",
"\".\"",
")",
"[",
"... | d25d13803db08c18632b55d12036e332f006d9ac |
train | showMessageDialog | Show a dialog containing a given text, with a given title.
The text accepts HTML syntax | qgiscommons2/gui/__init__.py | def showMessageDialog(title, text):
'''
Show a dialog containing a given text, with a given title.
The text accepts HTML syntax
'''
dlg = QgsMessageOutput.createMessageOutput()
dlg.setTitle(title)
dlg.setMessage(text, QgsMessageOutput.MessageHtml)
dlg.showMessage() | def showMessageDialog(title, text):
'''
Show a dialog containing a given text, with a given title.
The text accepts HTML syntax
'''
dlg = QgsMessageOutput.createMessageOutput()
dlg.setTitle(title)
dlg.setMessage(text, QgsMessageOutput.MessageHtml)
dlg.showMessage() | [
"Show",
"a",
"dialog",
"containing",
"a",
"given",
"text",
"with",
"a",
"given",
"title",
"."
] | boundlessgeo/lib-qgis-commons | python | https://github.com/boundlessgeo/lib-qgis-commons/blob/d25d13803db08c18632b55d12036e332f006d9ac/qgiscommons2/gui/__init__.py#L76-L85 | [
"def",
"showMessageDialog",
"(",
"title",
",",
"text",
")",
":",
"dlg",
"=",
"QgsMessageOutput",
".",
"createMessageOutput",
"(",
")",
"dlg",
".",
"setTitle",
"(",
"title",
")",
"dlg",
".",
"setMessage",
"(",
"text",
",",
"QgsMessageOutput",
".",
"MessageHtm... | d25d13803db08c18632b55d12036e332f006d9ac |
train | askForFiles | Asks for a file or files, opening the corresponding dialog with the last path that was selected
when this same function was invoked from the calling method.
:param parent: The parent window
:param msg: The message to use for the dialog title
:param isSave: true if we are asking for file to save
:pa... | qgiscommons2/gui/__init__.py | def askForFiles(parent, msg = None, isSave = False, allowMultiple = False, exts = "*"):
'''
Asks for a file or files, opening the corresponding dialog with the last path that was selected
when this same function was invoked from the calling method.
:param parent: The parent window
:param msg: The m... | def askForFiles(parent, msg = None, isSave = False, allowMultiple = False, exts = "*"):
'''
Asks for a file or files, opening the corresponding dialog with the last path that was selected
when this same function was invoked from the calling method.
:param parent: The parent window
:param msg: The m... | [
"Asks",
"for",
"a",
"file",
"or",
"files",
"opening",
"the",
"corresponding",
"dialog",
"with",
"the",
"last",
"path",
"that",
"was",
"selected",
"when",
"this",
"same",
"function",
"was",
"invoked",
"from",
"the",
"calling",
"method",
"."
] | boundlessgeo/lib-qgis-commons | python | https://github.com/boundlessgeo/lib-qgis-commons/blob/d25d13803db08c18632b55d12036e332f006d9ac/qgiscommons2/gui/__init__.py#L103-L144 | [
"def",
"askForFiles",
"(",
"parent",
",",
"msg",
"=",
"None",
",",
"isSave",
"=",
"False",
",",
"allowMultiple",
"=",
"False",
",",
"exts",
"=",
"\"*\"",
")",
":",
"msg",
"=",
"msg",
"or",
"'Select file'",
"caller",
"=",
"_callerName",
"(",
")",
".",
... | d25d13803db08c18632b55d12036e332f006d9ac |
train | askForFolder | Asks for a folder, opening the corresponding dialog with the last path that was selected
when this same function was invoked from the calling method
:param parent: The parent window
:param msg: The message to use for the dialog title | qgiscommons2/gui/__init__.py | def askForFolder(parent, msg = None):
'''
Asks for a folder, opening the corresponding dialog with the last path that was selected
when this same function was invoked from the calling method
:param parent: The parent window
:param msg: The message to use for the dialog title
'''
msg = msg o... | def askForFolder(parent, msg = None):
'''
Asks for a folder, opening the corresponding dialog with the last path that was selected
when this same function was invoked from the calling method
:param parent: The parent window
:param msg: The message to use for the dialog title
'''
msg = msg o... | [
"Asks",
"for",
"a",
"folder",
"opening",
"the",
"corresponding",
"dialog",
"with",
"the",
"last",
"path",
"that",
"was",
"selected",
"when",
"this",
"same",
"function",
"was",
"invoked",
"from",
"the",
"calling",
"method"
] | boundlessgeo/lib-qgis-commons | python | https://github.com/boundlessgeo/lib-qgis-commons/blob/d25d13803db08c18632b55d12036e332f006d9ac/qgiscommons2/gui/__init__.py#L146-L162 | [
"def",
"askForFolder",
"(",
"parent",
",",
"msg",
"=",
"None",
")",
":",
"msg",
"=",
"msg",
"or",
"'Select folder'",
"caller",
"=",
"_callerName",
"(",
")",
".",
"split",
"(",
"\".\"",
")",
"name",
"=",
"\"/\"",
".",
"join",
"(",
"[",
"LAST_PATH",
",... | d25d13803db08c18632b55d12036e332f006d9ac |
train | execute | Executes a lengthy tasks in a separate thread and displays a waiting dialog if needed.
Sets the cursor to wait cursor while the task is running.
This function does not provide any support for progress indication
:param func: The function to execute.
:param message: The message to display in the wait ... | qgiscommons2/gui/__init__.py | def execute(func, message = None):
'''
Executes a lengthy tasks in a separate thread and displays a waiting dialog if needed.
Sets the cursor to wait cursor while the task is running.
This function does not provide any support for progress indication
:param func: The function to execute.
:par... | def execute(func, message = None):
'''
Executes a lengthy tasks in a separate thread and displays a waiting dialog if needed.
Sets the cursor to wait cursor while the task is running.
This function does not provide any support for progress indication
:param func: The function to execute.
:par... | [
"Executes",
"a",
"lengthy",
"tasks",
"in",
"a",
"separate",
"thread",
"and",
"displays",
"a",
"waiting",
"dialog",
"if",
"needed",
".",
"Sets",
"the",
"cursor",
"to",
"wait",
"cursor",
"while",
"the",
"task",
"is",
"running",
"."
] | boundlessgeo/lib-qgis-commons | python | https://github.com/boundlessgeo/lib-qgis-commons/blob/d25d13803db08c18632b55d12036e332f006d9ac/qgiscommons2/gui/__init__.py#L186-L239 | [
"def",
"execute",
"(",
"func",
",",
"message",
"=",
"None",
")",
":",
"global",
"_dialog",
"cursor",
"=",
"QtWidgets",
".",
"QApplication",
".",
"overrideCursor",
"(",
")",
"waitCursor",
"=",
"(",
"cursor",
"is",
"not",
"None",
"and",
"cursor",
".",
"sha... | d25d13803db08c18632b55d12036e332f006d9ac |
train | disable_search_updates | Context manager used to temporarily disable auto_sync.
This is useful when performing bulk updates on objects - when
you may not want to flood the indexing process.
>>> with disable_search_updates():
... for obj in model.objects.all():
... obj.save()
The function works by temporarily ... | elasticsearch_django/decorators.py | def disable_search_updates():
"""
Context manager used to temporarily disable auto_sync.
This is useful when performing bulk updates on objects - when
you may not want to flood the indexing process.
>>> with disable_search_updates():
... for obj in model.objects.all():
... obj.save... | def disable_search_updates():
"""
Context manager used to temporarily disable auto_sync.
This is useful when performing bulk updates on objects - when
you may not want to flood the indexing process.
>>> with disable_search_updates():
... for obj in model.objects.all():
... obj.save... | [
"Context",
"manager",
"used",
"to",
"temporarily",
"disable",
"auto_sync",
"."
] | yunojuno/elasticsearch-django | python | https://github.com/yunojuno/elasticsearch-django/blob/e8d98d32bcd77f1bedb8f1a22b6523ca44ffd489/elasticsearch_django/decorators.py#L15-L34 | [
"def",
"disable_search_updates",
"(",
")",
":",
"_receivers",
"=",
"signals",
".",
"post_save",
".",
"receivers",
".",
"copy",
"(",
")",
"signals",
".",
"post_save",
".",
"receivers",
"=",
"_strip_on_model_save",
"(",
")",
"yield",
"signals",
".",
"post_save",... | e8d98d32bcd77f1bedb8f1a22b6523ca44ffd489 |
train | NetworkAccessManager.request | Make a network request by calling QgsNetworkAccessManager.
redirections argument is ignored and is here only for httplib2 compatibility. | qgiscommons2/network/networkaccessmanager.py | def request(self, url, method="GET", body=None, headers=None, redirections=DEFAULT_MAX_REDIRECTS, connection_type=None, blocking=True):
"""
Make a network request by calling QgsNetworkAccessManager.
redirections argument is ignored and is here only for httplib2 compatibility.
"""
... | def request(self, url, method="GET", body=None, headers=None, redirections=DEFAULT_MAX_REDIRECTS, connection_type=None, blocking=True):
"""
Make a network request by calling QgsNetworkAccessManager.
redirections argument is ignored and is here only for httplib2 compatibility.
"""
... | [
"Make",
"a",
"network",
"request",
"by",
"calling",
"QgsNetworkAccessManager",
".",
"redirections",
"argument",
"is",
"ignored",
"and",
"is",
"here",
"only",
"for",
"httplib2",
"compatibility",
"."
] | boundlessgeo/lib-qgis-commons | python | https://github.com/boundlessgeo/lib-qgis-commons/blob/d25d13803db08c18632b55d12036e332f006d9ac/qgiscommons2/network/networkaccessmanager.py#L174-L261 | [
"def",
"request",
"(",
"self",
",",
"url",
",",
"method",
"=",
"\"GET\"",
",",
"body",
"=",
"None",
",",
"headers",
"=",
"None",
",",
"redirections",
"=",
"DEFAULT_MAX_REDIRECTS",
",",
"connection_type",
"=",
"None",
",",
"blocking",
"=",
"True",
")",
":... | d25d13803db08c18632b55d12036e332f006d9ac |
train | NetworkAccessManager.requestTimedOut | Trap the timeout. In Async mode requestTimedOut is called after replyFinished | qgiscommons2/network/networkaccessmanager.py | def requestTimedOut(self, reply):
"""Trap the timeout. In Async mode requestTimedOut is called after replyFinished"""
# adapt http_call_result basing on receiving qgs timer timout signal
self.exception_class = RequestsExceptionTimeout
self.http_call_result.exception = RequestsExceptionTi... | def requestTimedOut(self, reply):
"""Trap the timeout. In Async mode requestTimedOut is called after replyFinished"""
# adapt http_call_result basing on receiving qgs timer timout signal
self.exception_class = RequestsExceptionTimeout
self.http_call_result.exception = RequestsExceptionTi... | [
"Trap",
"the",
"timeout",
".",
"In",
"Async",
"mode",
"requestTimedOut",
"is",
"called",
"after",
"replyFinished"
] | boundlessgeo/lib-qgis-commons | python | https://github.com/boundlessgeo/lib-qgis-commons/blob/d25d13803db08c18632b55d12036e332f006d9ac/qgiscommons2/network/networkaccessmanager.py#L268-L272 | [
"def",
"requestTimedOut",
"(",
"self",
",",
"reply",
")",
":",
"# adapt http_call_result basing on receiving qgs timer timout signal",
"self",
".",
"exception_class",
"=",
"RequestsExceptionTimeout",
"self",
".",
"http_call_result",
".",
"exception",
"=",
"RequestsExceptionTi... | d25d13803db08c18632b55d12036e332f006d9ac |
train | NetworkAccessManager.sslErrors | Handle SSL errors, logging them if debug is on and ignoring them
if disable_ssl_certificate_validation is set. | qgiscommons2/network/networkaccessmanager.py | def sslErrors(self, ssl_errors):
"""
Handle SSL errors, logging them if debug is on and ignoring them
if disable_ssl_certificate_validation is set.
"""
if ssl_errors:
for v in ssl_errors:
self.msg_log("SSL Error: %s" % v.errorString())
if self.... | def sslErrors(self, ssl_errors):
"""
Handle SSL errors, logging them if debug is on and ignoring them
if disable_ssl_certificate_validation is set.
"""
if ssl_errors:
for v in ssl_errors:
self.msg_log("SSL Error: %s" % v.errorString())
if self.... | [
"Handle",
"SSL",
"errors",
"logging",
"them",
"if",
"debug",
"is",
"on",
"and",
"ignoring",
"them",
"if",
"disable_ssl_certificate_validation",
"is",
"set",
"."
] | boundlessgeo/lib-qgis-commons | python | https://github.com/boundlessgeo/lib-qgis-commons/blob/d25d13803db08c18632b55d12036e332f006d9ac/qgiscommons2/network/networkaccessmanager.py#L377-L386 | [
"def",
"sslErrors",
"(",
"self",
",",
"ssl_errors",
")",
":",
"if",
"ssl_errors",
":",
"for",
"v",
"in",
"ssl_errors",
":",
"self",
".",
"msg_log",
"(",
"\"SSL Error: %s\"",
"%",
"v",
".",
"errorString",
"(",
")",
")",
"if",
"self",
".",
"disable_ssl_cer... | d25d13803db08c18632b55d12036e332f006d9ac |
train | NetworkAccessManager.abort | Handle request to cancel HTTP call | qgiscommons2/network/networkaccessmanager.py | def abort(self):
"""
Handle request to cancel HTTP call
"""
if (self.reply and self.reply.isRunning()):
self.on_abort = True
self.reply.abort() | def abort(self):
"""
Handle request to cancel HTTP call
"""
if (self.reply and self.reply.isRunning()):
self.on_abort = True
self.reply.abort() | [
"Handle",
"request",
"to",
"cancel",
"HTTP",
"call"
] | boundlessgeo/lib-qgis-commons | python | https://github.com/boundlessgeo/lib-qgis-commons/blob/d25d13803db08c18632b55d12036e332f006d9ac/qgiscommons2/network/networkaccessmanager.py#L388-L394 | [
"def",
"abort",
"(",
"self",
")",
":",
"if",
"(",
"self",
".",
"reply",
"and",
"self",
".",
"reply",
".",
"isRunning",
"(",
")",
")",
":",
"self",
".",
"on_abort",
"=",
"True",
"self",
".",
"reply",
".",
"abort",
"(",
")"
] | d25d13803db08c18632b55d12036e332f006d9ac |
train | mapLayers | Return all the loaded layers. Filters by name (optional) first and then type (optional)
:param name: (optional) name of layer to return..
:param type: (optional) The QgsMapLayer type of layer to return. Accepts a single value or a list of them
:return: List of loaded layers. If name given will return all l... | qgiscommons2/layers.py | def mapLayers(name=None, types=None):
"""
Return all the loaded layers. Filters by name (optional) first and then type (optional)
:param name: (optional) name of layer to return..
:param type: (optional) The QgsMapLayer type of layer to return. Accepts a single value or a list of them
:return: List... | def mapLayers(name=None, types=None):
"""
Return all the loaded layers. Filters by name (optional) first and then type (optional)
:param name: (optional) name of layer to return..
:param type: (optional) The QgsMapLayer type of layer to return. Accepts a single value or a list of them
:return: List... | [
"Return",
"all",
"the",
"loaded",
"layers",
".",
"Filters",
"by",
"name",
"(",
"optional",
")",
"first",
"and",
"then",
"type",
"(",
"optional",
")",
":",
"param",
"name",
":",
"(",
"optional",
")",
"name",
"of",
"layer",
"to",
"return",
"..",
":",
"... | boundlessgeo/lib-qgis-commons | python | https://github.com/boundlessgeo/lib-qgis-commons/blob/d25d13803db08c18632b55d12036e332f006d9ac/qgiscommons2/layers.py#L28-L46 | [
"def",
"mapLayers",
"(",
"name",
"=",
"None",
",",
"types",
"=",
"None",
")",
":",
"if",
"types",
"is",
"not",
"None",
"and",
"not",
"isinstance",
"(",
"types",
",",
"list",
")",
":",
"types",
"=",
"[",
"types",
"]",
"layers",
"=",
"_layerreg",
"."... | d25d13803db08c18632b55d12036e332f006d9ac |
train | addLayer | Add one or several layers to the QGIS session and layer registry.
:param layer: The layer object or list with layers to add the QGIS layer registry and session.
:param loadInLegend: True if this layer should be added to the legend.
:return: The added layer | qgiscommons2/layers.py | def addLayer(layer, loadInLegend=True):
"""
Add one or several layers to the QGIS session and layer registry.
:param layer: The layer object or list with layers to add the QGIS layer registry and session.
:param loadInLegend: True if this layer should be added to the legend.
:return: The added laye... | def addLayer(layer, loadInLegend=True):
"""
Add one or several layers to the QGIS session and layer registry.
:param layer: The layer object or list with layers to add the QGIS layer registry and session.
:param loadInLegend: True if this layer should be added to the legend.
:return: The added laye... | [
"Add",
"one",
"or",
"several",
"layers",
"to",
"the",
"QGIS",
"session",
"and",
"layer",
"registry",
".",
":",
"param",
"layer",
":",
"The",
"layer",
"object",
"or",
"list",
"with",
"layers",
"to",
"add",
"the",
"QGIS",
"layer",
"registry",
"and",
"sessi... | boundlessgeo/lib-qgis-commons | python | https://github.com/boundlessgeo/lib-qgis-commons/blob/d25d13803db08c18632b55d12036e332f006d9ac/qgiscommons2/layers.py#L51-L61 | [
"def",
"addLayer",
"(",
"layer",
",",
"loadInLegend",
"=",
"True",
")",
":",
"if",
"not",
"hasattr",
"(",
"layer",
",",
"\"__iter__\"",
")",
":",
"layer",
"=",
"[",
"layer",
"]",
"_layerreg",
".",
"addMapLayers",
"(",
"layer",
",",
"loadInLegend",
")",
... | d25d13803db08c18632b55d12036e332f006d9ac |
train | addLayerNoCrsDialog | Tries to add a layer from layer object
Same as the addLayer method, but it does not ask for CRS, regardless of current
configuration in QGIS settings | qgiscommons2/layers.py | def addLayerNoCrsDialog(layer, loadInLegend=True):
'''
Tries to add a layer from layer object
Same as the addLayer method, but it does not ask for CRS, regardless of current
configuration in QGIS settings
'''
settings = QSettings()
prjSetting = settings.value('/Projections/defaultBehaviour')... | def addLayerNoCrsDialog(layer, loadInLegend=True):
'''
Tries to add a layer from layer object
Same as the addLayer method, but it does not ask for CRS, regardless of current
configuration in QGIS settings
'''
settings = QSettings()
prjSetting = settings.value('/Projections/defaultBehaviour')... | [
"Tries",
"to",
"add",
"a",
"layer",
"from",
"layer",
"object",
"Same",
"as",
"the",
"addLayer",
"method",
"but",
"it",
"does",
"not",
"ask",
"for",
"CRS",
"regardless",
"of",
"current",
"configuration",
"in",
"QGIS",
"settings"
] | boundlessgeo/lib-qgis-commons | python | https://github.com/boundlessgeo/lib-qgis-commons/blob/d25d13803db08c18632b55d12036e332f006d9ac/qgiscommons2/layers.py#L63-L78 | [
"def",
"addLayerNoCrsDialog",
"(",
"layer",
",",
"loadInLegend",
"=",
"True",
")",
":",
"settings",
"=",
"QSettings",
"(",
")",
"prjSetting",
"=",
"settings",
".",
"value",
"(",
"'/Projections/defaultBehaviour'",
")",
"settings",
".",
"setValue",
"(",
"'/Project... | d25d13803db08c18632b55d12036e332f006d9ac |
train | newVectorLayer | Creates a new vector layer
:param filename: The filename to store the file. The extensions determines the type of file.
If extension is not among the supported ones, a shapefile will be created and the file will
get an added '.shp' to its path.
If the filename is None, a memory layer will be created
... | qgiscommons2/layers.py | def newVectorLayer(filename, fields, geometryType, crs, encoding="utf-8"):
'''
Creates a new vector layer
:param filename: The filename to store the file. The extensions determines the type of file.
If extension is not among the supported ones, a shapefile will be created and the file will
get an a... | def newVectorLayer(filename, fields, geometryType, crs, encoding="utf-8"):
'''
Creates a new vector layer
:param filename: The filename to store the file. The extensions determines the type of file.
If extension is not among the supported ones, a shapefile will be created and the file will
get an a... | [
"Creates",
"a",
"new",
"vector",
"layer"
] | boundlessgeo/lib-qgis-commons | python | https://github.com/boundlessgeo/lib-qgis-commons/blob/d25d13803db08c18632b55d12036e332f006d9ac/qgiscommons2/layers.py#L131-L186 | [
"def",
"newVectorLayer",
"(",
"filename",
",",
"fields",
",",
"geometryType",
",",
"crs",
",",
"encoding",
"=",
"\"utf-8\"",
")",
":",
"if",
"isinstance",
"(",
"crs",
",",
"basestring",
")",
":",
"crs",
"=",
"QgsCoordinateReferenceSystem",
"(",
"crs",
")",
... | d25d13803db08c18632b55d12036e332f006d9ac |
train | layerFromName | Returns the layer from the current project with the passed name
Raises WrongLayerNameException if no layer with that name is found
If several layers with that name exist, only the first one is returned | qgiscommons2/layers.py | def layerFromName(name):
'''
Returns the layer from the current project with the passed name
Raises WrongLayerNameException if no layer with that name is found
If several layers with that name exist, only the first one is returned
'''
layers =_layerreg.mapLayers().values()
for layer in layer... | def layerFromName(name):
'''
Returns the layer from the current project with the passed name
Raises WrongLayerNameException if no layer with that name is found
If several layers with that name exist, only the first one is returned
'''
layers =_layerreg.mapLayers().values()
for layer in layer... | [
"Returns",
"the",
"layer",
"from",
"the",
"current",
"project",
"with",
"the",
"passed",
"name",
"Raises",
"WrongLayerNameException",
"if",
"no",
"layer",
"with",
"that",
"name",
"is",
"found",
"If",
"several",
"layers",
"with",
"that",
"name",
"exist",
"only"... | boundlessgeo/lib-qgis-commons | python | https://github.com/boundlessgeo/lib-qgis-commons/blob/d25d13803db08c18632b55d12036e332f006d9ac/qgiscommons2/layers.py#L202-L212 | [
"def",
"layerFromName",
"(",
"name",
")",
":",
"layers",
"=",
"_layerreg",
".",
"mapLayers",
"(",
")",
".",
"values",
"(",
")",
"for",
"layer",
"in",
"layers",
":",
"if",
"layer",
".",
"name",
"(",
")",
"==",
"name",
":",
"return",
"layer",
"raise",
... | d25d13803db08c18632b55d12036e332f006d9ac |
train | layerFromSource | Returns the layer from the current project with the passed source
Raises WrongLayerSourceException if no layer with that source is found | qgiscommons2/layers.py | def layerFromSource(source):
'''
Returns the layer from the current project with the passed source
Raises WrongLayerSourceException if no layer with that source is found
'''
layers =_layerreg.mapLayers().values()
for layer in layers:
if layer.source() == source:
return layer
... | def layerFromSource(source):
'''
Returns the layer from the current project with the passed source
Raises WrongLayerSourceException if no layer with that source is found
'''
layers =_layerreg.mapLayers().values()
for layer in layers:
if layer.source() == source:
return layer
... | [
"Returns",
"the",
"layer",
"from",
"the",
"current",
"project",
"with",
"the",
"passed",
"source",
"Raises",
"WrongLayerSourceException",
"if",
"no",
"layer",
"with",
"that",
"source",
"is",
"found"
] | boundlessgeo/lib-qgis-commons | python | https://github.com/boundlessgeo/lib-qgis-commons/blob/d25d13803db08c18632b55d12036e332f006d9ac/qgiscommons2/layers.py#L214-L223 | [
"def",
"layerFromSource",
"(",
"source",
")",
":",
"layers",
"=",
"_layerreg",
".",
"mapLayers",
"(",
")",
".",
"values",
"(",
")",
"for",
"layer",
"in",
"layers",
":",
"if",
"layer",
".",
"source",
"(",
")",
"==",
"source",
":",
"return",
"layer",
"... | d25d13803db08c18632b55d12036e332f006d9ac |
train | loadLayer | Tries to load a layer from the given file
:param filename: the path to the file to load.
:param name: the name to use for adding the layer to the current project.
If not passed or None, it will use the filename basename | qgiscommons2/layers.py | def loadLayer(filename, name = None, provider=None):
'''
Tries to load a layer from the given file
:param filename: the path to the file to load.
:param name: the name to use for adding the layer to the current project.
If not passed or None, it will use the filename basename
'''
name = na... | def loadLayer(filename, name = None, provider=None):
'''
Tries to load a layer from the given file
:param filename: the path to the file to load.
:param name: the name to use for adding the layer to the current project.
If not passed or None, it will use the filename basename
'''
name = na... | [
"Tries",
"to",
"load",
"a",
"layer",
"from",
"the",
"given",
"file"
] | boundlessgeo/lib-qgis-commons | python | https://github.com/boundlessgeo/lib-qgis-commons/blob/d25d13803db08c18632b55d12036e332f006d9ac/qgiscommons2/layers.py#L226-L243 | [
"def",
"loadLayer",
"(",
"filename",
",",
"name",
"=",
"None",
",",
"provider",
"=",
"None",
")",
":",
"name",
"=",
"name",
"or",
"os",
".",
"path",
".",
"splitext",
"(",
"os",
".",
"path",
".",
"basename",
"(",
"filename",
")",
")",
"[",
"0",
"]... | d25d13803db08c18632b55d12036e332f006d9ac |
train | loadLayerNoCrsDialog | Tries to load a layer from the given file
Same as the loadLayer method, but it does not ask for CRS, regardless of current
configuration in QGIS settings | qgiscommons2/layers.py | def loadLayerNoCrsDialog(filename, name=None, provider=None):
'''
Tries to load a layer from the given file
Same as the loadLayer method, but it does not ask for CRS, regardless of current
configuration in QGIS settings
'''
settings = QSettings()
prjSetting = settings.value('/Projections/def... | def loadLayerNoCrsDialog(filename, name=None, provider=None):
'''
Tries to load a layer from the given file
Same as the loadLayer method, but it does not ask for CRS, regardless of current
configuration in QGIS settings
'''
settings = QSettings()
prjSetting = settings.value('/Projections/def... | [
"Tries",
"to",
"load",
"a",
"layer",
"from",
"the",
"given",
"file",
"Same",
"as",
"the",
"loadLayer",
"method",
"but",
"it",
"does",
"not",
"ask",
"for",
"CRS",
"regardless",
"of",
"current",
"configuration",
"in",
"QGIS",
"settings"
] | boundlessgeo/lib-qgis-commons | python | https://github.com/boundlessgeo/lib-qgis-commons/blob/d25d13803db08c18632b55d12036e332f006d9ac/qgiscommons2/layers.py#L246-L261 | [
"def",
"loadLayerNoCrsDialog",
"(",
"filename",
",",
"name",
"=",
"None",
",",
"provider",
"=",
"None",
")",
":",
"settings",
"=",
"QSettings",
"(",
")",
"prjSetting",
"=",
"settings",
".",
"value",
"(",
"'/Projections/defaultBehaviour'",
")",
"settings",
".",... | d25d13803db08c18632b55d12036e332f006d9ac |
train | addSettingsMenu | Adds a 'open settings...' menu to the plugin menu.
This method should be called from the initGui() method of the plugin
:param menuName: The name of the plugin menu in which the settings menu is to be added
:param parentMenuFunction: a function from QgisInterface to indicate where to put the container plug... | qgiscommons2/gui/settings.py | def addSettingsMenu(menuName, parentMenuFunction=None):
'''
Adds a 'open settings...' menu to the plugin menu.
This method should be called from the initGui() method of the plugin
:param menuName: The name of the plugin menu in which the settings menu is to be added
:param parentMenuFunction: a fun... | def addSettingsMenu(menuName, parentMenuFunction=None):
'''
Adds a 'open settings...' menu to the plugin menu.
This method should be called from the initGui() method of the plugin
:param menuName: The name of the plugin menu in which the settings menu is to be added
:param parentMenuFunction: a fun... | [
"Adds",
"a",
"open",
"settings",
"...",
"menu",
"to",
"the",
"plugin",
"menu",
".",
"This",
"method",
"should",
"be",
"called",
"from",
"the",
"initGui",
"()",
"method",
"of",
"the",
"plugin"
] | boundlessgeo/lib-qgis-commons | python | https://github.com/boundlessgeo/lib-qgis-commons/blob/d25d13803db08c18632b55d12036e332f006d9ac/qgiscommons2/gui/settings.py#L38-L58 | [
"def",
"addSettingsMenu",
"(",
"menuName",
",",
"parentMenuFunction",
"=",
"None",
")",
":",
"parentMenuFunction",
"=",
"parentMenuFunction",
"or",
"iface",
".",
"addPluginToMenu",
"namespace",
"=",
"_callerName",
"(",
")",
".",
"split",
"(",
"\".\"",
")",
"[",
... | d25d13803db08c18632b55d12036e332f006d9ac |
train | openParametersDialog | Opens a dialog to enter parameters.
Parameters are passed as a list of Parameter objects
Returns a dict with param names as keys and param values as values
Returns None if the dialog was cancelled | qgiscommons2/gui/paramdialog.py | def openParametersDialog(params, title=None):
'''
Opens a dialog to enter parameters.
Parameters are passed as a list of Parameter objects
Returns a dict with param names as keys and param values as values
Returns None if the dialog was cancelled
'''
QApplication.setOverrideCursor(QCursor(Qt... | def openParametersDialog(params, title=None):
'''
Opens a dialog to enter parameters.
Parameters are passed as a list of Parameter objects
Returns a dict with param names as keys and param values as values
Returns None if the dialog was cancelled
'''
QApplication.setOverrideCursor(QCursor(Qt... | [
"Opens",
"a",
"dialog",
"to",
"enter",
"parameters",
".",
"Parameters",
"are",
"passed",
"as",
"a",
"list",
"of",
"Parameter",
"objects",
"Returns",
"a",
"dict",
"with",
"param",
"names",
"as",
"keys",
"and",
"param",
"values",
"as",
"values",
"Returns",
"... | boundlessgeo/lib-qgis-commons | python | https://github.com/boundlessgeo/lib-qgis-commons/blob/d25d13803db08c18632b55d12036e332f006d9ac/qgiscommons2/gui/paramdialog.py#L45-L56 | [
"def",
"openParametersDialog",
"(",
"params",
",",
"title",
"=",
"None",
")",
":",
"QApplication",
".",
"setOverrideCursor",
"(",
"QCursor",
"(",
"Qt",
".",
"ArrowCursor",
")",
")",
"dlg",
"=",
"ParametersDialog",
"(",
"params",
",",
"title",
")",
"dlg",
"... | d25d13803db08c18632b55d12036e332f006d9ac |
train | Command.do_index_command | Rebuild search index. | elasticsearch_django/management/commands/rebuild_search_index.py | def do_index_command(self, index, **options):
"""Rebuild search index."""
if options["interactive"]:
logger.warning("This will permanently delete the index '%s'.", index)
if not self._confirm_action():
logger.warning(
"Aborting rebuild of index... | def do_index_command(self, index, **options):
"""Rebuild search index."""
if options["interactive"]:
logger.warning("This will permanently delete the index '%s'.", index)
if not self._confirm_action():
logger.warning(
"Aborting rebuild of index... | [
"Rebuild",
"search",
"index",
"."
] | yunojuno/elasticsearch-django | python | https://github.com/yunojuno/elasticsearch-django/blob/e8d98d32bcd77f1bedb8f1a22b6523ca44ffd489/elasticsearch_django/management/commands/rebuild_search_index.py#L21-L39 | [
"def",
"do_index_command",
"(",
"self",
",",
"index",
",",
"*",
"*",
"options",
")",
":",
"if",
"options",
"[",
"\"interactive\"",
"]",
":",
"logger",
".",
"warning",
"(",
"\"This will permanently delete the index '%s'.\"",
",",
"index",
")",
"if",
"not",
"sel... | e8d98d32bcd77f1bedb8f1a22b6523ca44ffd489 |
train | BaseSearchCommand.handle | Run do_index_command on each specified index and log the output. | elasticsearch_django/management/commands/__init__.py | def handle(self, *args, **options):
"""Run do_index_command on each specified index and log the output."""
for index in options.pop("indexes"):
data = {}
try:
data = self.do_index_command(index, **options)
except TransportError as ex:
l... | def handle(self, *args, **options):
"""Run do_index_command on each specified index and log the output."""
for index in options.pop("indexes"):
data = {}
try:
data = self.do_index_command(index, **options)
except TransportError as ex:
l... | [
"Run",
"do_index_command",
"on",
"each",
"specified",
"index",
"and",
"log",
"the",
"output",
"."
] | yunojuno/elasticsearch-django | python | https://github.com/yunojuno/elasticsearch-django/blob/e8d98d32bcd77f1bedb8f1a22b6523ca44ffd489/elasticsearch_django/management/commands/__init__.py#L39-L49 | [
"def",
"handle",
"(",
"self",
",",
"*",
"args",
",",
"*",
"*",
"options",
")",
":",
"for",
"index",
"in",
"options",
".",
"pop",
"(",
"\"indexes\"",
")",
":",
"data",
"=",
"{",
"}",
"try",
":",
"data",
"=",
"self",
".",
"do_index_command",
"(",
"... | e8d98d32bcd77f1bedb8f1a22b6523ca44ffd489 |
train | TemplateManager.create | Creates a template.
:param Name: Name of template
:param Subject: The content to use for the Subject when this template is used to send email.
:param HtmlBody: The content to use for the HtmlBody when this template is used to send email.
:param TextBody: The content to use for the HtmlB... | postmarker/models/templates.py | def create(self, Name, Subject, HtmlBody=None, TextBody=None, Alias=None):
"""
Creates a template.
:param Name: Name of template
:param Subject: The content to use for the Subject when this template is used to send email.
:param HtmlBody: The content to use for the HtmlBody when... | def create(self, Name, Subject, HtmlBody=None, TextBody=None, Alias=None):
"""
Creates a template.
:param Name: Name of template
:param Subject: The content to use for the Subject when this template is used to send email.
:param HtmlBody: The content to use for the HtmlBody when... | [
"Creates",
"a",
"template",
"."
] | Stranger6667/postmarker | python | https://github.com/Stranger6667/postmarker/blob/013224ab1761e95c488c7d2701e6fa83f3108d94/postmarker/models/templates.py#L31-L43 | [
"def",
"create",
"(",
"self",
",",
"Name",
",",
"Subject",
",",
"HtmlBody",
"=",
"None",
",",
"TextBody",
"=",
"None",
",",
"Alias",
"=",
"None",
")",
":",
"assert",
"TextBody",
"or",
"HtmlBody",
",",
"\"Provide either email TextBody or HtmlBody or both\"",
"d... | 013224ab1761e95c488c7d2701e6fa83f3108d94 |
train | get_logger | Returns simple console logger. | postmarker/logging.py | def get_logger(name, verbosity, stream):
"""
Returns simple console logger.
"""
logger = logging.getLogger(name)
logger.setLevel(
{0: DEFAULT_LOGGING_LEVEL, 1: logging.INFO, 2: logging.DEBUG}.get(min(2, verbosity), DEFAULT_LOGGING_LEVEL)
)
logger.handlers = []
handler = logging.S... | def get_logger(name, verbosity, stream):
"""
Returns simple console logger.
"""
logger = logging.getLogger(name)
logger.setLevel(
{0: DEFAULT_LOGGING_LEVEL, 1: logging.INFO, 2: logging.DEBUG}.get(min(2, verbosity), DEFAULT_LOGGING_LEVEL)
)
logger.handlers = []
handler = logging.S... | [
"Returns",
"simple",
"console",
"logger",
"."
] | Stranger6667/postmarker | python | https://github.com/Stranger6667/postmarker/blob/013224ab1761e95c488c7d2701e6fa83f3108d94/postmarker/logging.py#L11-L24 | [
"def",
"get_logger",
"(",
"name",
",",
"verbosity",
",",
"stream",
")",
":",
"logger",
"=",
"logging",
".",
"getLogger",
"(",
"name",
")",
"logger",
".",
"setLevel",
"(",
"{",
"0",
":",
"DEFAULT_LOGGING_LEVEL",
",",
"1",
":",
"logging",
".",
"INFO",
",... | 013224ab1761e95c488c7d2701e6fa83f3108d94 |
train | PostmarkClient.from_config | Helper method for instantiating PostmarkClient from dict-like objects. | postmarker/core.py | def from_config(cls, config, prefix="postmark_", is_uppercase=False):
"""
Helper method for instantiating PostmarkClient from dict-like objects.
"""
kwargs = {}
for arg in get_args(cls):
key = prefix + arg
if is_uppercase:
key = key.upper()... | def from_config(cls, config, prefix="postmark_", is_uppercase=False):
"""
Helper method for instantiating PostmarkClient from dict-like objects.
"""
kwargs = {}
for arg in get_args(cls):
key = prefix + arg
if is_uppercase:
key = key.upper()... | [
"Helper",
"method",
"for",
"instantiating",
"PostmarkClient",
"from",
"dict",
"-",
"like",
"objects",
"."
] | Stranger6667/postmarker | python | https://github.com/Stranger6667/postmarker/blob/013224ab1761e95c488c7d2701e6fa83f3108d94/postmarker/core.py#L59-L72 | [
"def",
"from_config",
"(",
"cls",
",",
"config",
",",
"prefix",
"=",
"\"postmark_\"",
",",
"is_uppercase",
"=",
"False",
")",
":",
"kwargs",
"=",
"{",
"}",
"for",
"arg",
"in",
"get_args",
"(",
"cls",
")",
":",
"key",
"=",
"prefix",
"+",
"arg",
"if",
... | 013224ab1761e95c488c7d2701e6fa83f3108d94 |
train | chunks | Split a container into n-sized chunks. | postmarker/utils.py | def chunks(container, n):
"""
Split a container into n-sized chunks.
"""
for i in range(0, len(container), n):
yield container[i : i + n] | def chunks(container, n):
"""
Split a container into n-sized chunks.
"""
for i in range(0, len(container), n):
yield container[i : i + n] | [
"Split",
"a",
"container",
"into",
"n",
"-",
"sized",
"chunks",
"."
] | Stranger6667/postmarker | python | https://github.com/Stranger6667/postmarker/blob/013224ab1761e95c488c7d2701e6fa83f3108d94/postmarker/utils.py#L4-L9 | [
"def",
"chunks",
"(",
"container",
",",
"n",
")",
":",
"for",
"i",
"in",
"range",
"(",
"0",
",",
"len",
"(",
"container",
")",
",",
"n",
")",
":",
"yield",
"container",
"[",
"i",
":",
"i",
"+",
"n",
"]"
] | 013224ab1761e95c488c7d2701e6fa83f3108d94 |
train | sizes | Helper to iterate over remote data via count & offset pagination. | postmarker/utils.py | def sizes(count, offset=0, max_chunk=500):
"""
Helper to iterate over remote data via count & offset pagination.
"""
if count is None:
chunk = max_chunk
while True:
yield chunk, offset
offset += chunk
else:
while count:
chunk = min(count, m... | def sizes(count, offset=0, max_chunk=500):
"""
Helper to iterate over remote data via count & offset pagination.
"""
if count is None:
chunk = max_chunk
while True:
yield chunk, offset
offset += chunk
else:
while count:
chunk = min(count, m... | [
"Helper",
"to",
"iterate",
"over",
"remote",
"data",
"via",
"count",
"&",
"offset",
"pagination",
"."
] | Stranger6667/postmarker | python | https://github.com/Stranger6667/postmarker/blob/013224ab1761e95c488c7d2701e6fa83f3108d94/postmarker/utils.py#L12-L26 | [
"def",
"sizes",
"(",
"count",
",",
"offset",
"=",
"0",
",",
"max_chunk",
"=",
"500",
")",
":",
"if",
"count",
"is",
"None",
":",
"chunk",
"=",
"max_chunk",
"while",
"True",
":",
"yield",
"chunk",
",",
"offset",
"offset",
"+=",
"chunk",
"else",
":",
... | 013224ab1761e95c488c7d2701e6fa83f3108d94 |
train | EmailBackend.raise_for_response | Constructs appropriate exception from list of responses and raises it. | postmarker/django/backend.py | def raise_for_response(self, responses):
"""
Constructs appropriate exception from list of responses and raises it.
"""
exception_messages = [self.client.format_exception_message(response) for response in responses]
if len(exception_messages) == 1:
message = exception... | def raise_for_response(self, responses):
"""
Constructs appropriate exception from list of responses and raises it.
"""
exception_messages = [self.client.format_exception_message(response) for response in responses]
if len(exception_messages) == 1:
message = exception... | [
"Constructs",
"appropriate",
"exception",
"from",
"list",
"of",
"responses",
"and",
"raises",
"it",
"."
] | Stranger6667/postmarker | python | https://github.com/Stranger6667/postmarker/blob/013224ab1761e95c488c7d2701e6fa83f3108d94/postmarker/django/backend.py#L76-L85 | [
"def",
"raise_for_response",
"(",
"self",
",",
"responses",
")",
":",
"exception_messages",
"=",
"[",
"self",
".",
"client",
".",
"format_exception_message",
"(",
"response",
")",
"for",
"response",
"in",
"responses",
"]",
"if",
"len",
"(",
"exception_messages",... | 013224ab1761e95c488c7d2701e6fa83f3108d94 |
train | list_to_csv | Converts list to string with comma separated values. For string is no-op. | postmarker/models/emails.py | def list_to_csv(value):
"""
Converts list to string with comma separated values. For string is no-op.
"""
if isinstance(value, (list, tuple, set)):
value = ",".join(value)
return value | def list_to_csv(value):
"""
Converts list to string with comma separated values. For string is no-op.
"""
if isinstance(value, (list, tuple, set)):
value = ",".join(value)
return value | [
"Converts",
"list",
"to",
"string",
"with",
"comma",
"separated",
"values",
".",
"For",
"string",
"is",
"no",
"-",
"op",
"."
] | Stranger6667/postmarker | python | https://github.com/Stranger6667/postmarker/blob/013224ab1761e95c488c7d2701e6fa83f3108d94/postmarker/models/emails.py#L24-L30 | [
"def",
"list_to_csv",
"(",
"value",
")",
":",
"if",
"isinstance",
"(",
"value",
",",
"(",
"list",
",",
"tuple",
",",
"set",
")",
")",
":",
"value",
"=",
"\",\"",
".",
"join",
"(",
"value",
")",
"return",
"value"
] | 013224ab1761e95c488c7d2701e6fa83f3108d94 |
train | prepare_attachments | Converts incoming attachment into dictionary. | postmarker/models/emails.py | def prepare_attachments(attachment):
"""
Converts incoming attachment into dictionary.
"""
if isinstance(attachment, tuple):
result = {"Name": attachment[0], "Content": attachment[1], "ContentType": attachment[2]}
if len(attachment) == 4:
result["ContentID"] = attachment[3]
... | def prepare_attachments(attachment):
"""
Converts incoming attachment into dictionary.
"""
if isinstance(attachment, tuple):
result = {"Name": attachment[0], "Content": attachment[1], "ContentType": attachment[2]}
if len(attachment) == 4:
result["ContentID"] = attachment[3]
... | [
"Converts",
"incoming",
"attachment",
"into",
"dictionary",
"."
] | Stranger6667/postmarker | python | https://github.com/Stranger6667/postmarker/blob/013224ab1761e95c488c7d2701e6fa83f3108d94/postmarker/models/emails.py#L40-L76 | [
"def",
"prepare_attachments",
"(",
"attachment",
")",
":",
"if",
"isinstance",
"(",
"attachment",
",",
"tuple",
")",
":",
"result",
"=",
"{",
"\"Name\"",
":",
"attachment",
"[",
"0",
"]",
",",
"\"Content\"",
":",
"attachment",
"[",
"1",
"]",
",",
"\"Cont... | 013224ab1761e95c488c7d2701e6fa83f3108d94 |
train | BaseEmail.as_dict | Additionally encodes headers.
:return: | postmarker/models/emails.py | def as_dict(self):
"""
Additionally encodes headers.
:return:
"""
data = super(BaseEmail, self).as_dict()
data["Headers"] = [{"Name": name, "Value": value} for name, value in data["Headers"].items()]
for field in ("To", "Cc", "Bcc"):
if field in data:... | def as_dict(self):
"""
Additionally encodes headers.
:return:
"""
data = super(BaseEmail, self).as_dict()
data["Headers"] = [{"Name": name, "Value": value} for name, value in data["Headers"].items()]
for field in ("To", "Cc", "Bcc"):
if field in data:... | [
"Additionally",
"encodes",
"headers",
"."
] | Stranger6667/postmarker | python | https://github.com/Stranger6667/postmarker/blob/013224ab1761e95c488c7d2701e6fa83f3108d94/postmarker/models/emails.py#L124-L136 | [
"def",
"as_dict",
"(",
"self",
")",
":",
"data",
"=",
"super",
"(",
"BaseEmail",
",",
"self",
")",
".",
"as_dict",
"(",
")",
"data",
"[",
"\"Headers\"",
"]",
"=",
"[",
"{",
"\"Name\"",
":",
"name",
",",
"\"Value\"",
":",
"value",
"}",
"for",
"name"... | 013224ab1761e95c488c7d2701e6fa83f3108d94 |
train | BaseEmail.attach_binary | Attaches given binary data.
:param bytes content: Binary data to be attached.
:param str filename:
:return: None. | postmarker/models/emails.py | def attach_binary(self, content, filename):
"""
Attaches given binary data.
:param bytes content: Binary data to be attached.
:param str filename:
:return: None.
"""
content_type = guess_content_type(filename)
payload = {"Name": filename, "Content": b64en... | def attach_binary(self, content, filename):
"""
Attaches given binary data.
:param bytes content: Binary data to be attached.
:param str filename:
:return: None.
"""
content_type = guess_content_type(filename)
payload = {"Name": filename, "Content": b64en... | [
"Attaches",
"given",
"binary",
"data",
"."
] | Stranger6667/postmarker | python | https://github.com/Stranger6667/postmarker/blob/013224ab1761e95c488c7d2701e6fa83f3108d94/postmarker/models/emails.py#L148-L158 | [
"def",
"attach_binary",
"(",
"self",
",",
"content",
",",
"filename",
")",
":",
"content_type",
"=",
"guess_content_type",
"(",
"filename",
")",
"payload",
"=",
"{",
"\"Name\"",
":",
"filename",
",",
"\"Content\"",
":",
"b64encode",
"(",
"content",
")",
".",... | 013224ab1761e95c488c7d2701e6fa83f3108d94 |
train | Email.from_mime | Instantiates ``Email`` instance from ``MIMEText`` instance.
:param message: ``email.mime.text.MIMEText`` instance.
:param manager: :py:class:`EmailManager` instance.
:return: :py:class:`Email` | postmarker/models/emails.py | def from_mime(cls, message, manager):
"""
Instantiates ``Email`` instance from ``MIMEText`` instance.
:param message: ``email.mime.text.MIMEText`` instance.
:param manager: :py:class:`EmailManager` instance.
:return: :py:class:`Email`
"""
text, html, attachments ... | def from_mime(cls, message, manager):
"""
Instantiates ``Email`` instance from ``MIMEText`` instance.
:param message: ``email.mime.text.MIMEText`` instance.
:param manager: :py:class:`EmailManager` instance.
:return: :py:class:`Email`
"""
text, html, attachments ... | [
"Instantiates",
"Email",
"instance",
"from",
"MIMEText",
"instance",
"."
] | Stranger6667/postmarker | python | https://github.com/Stranger6667/postmarker/blob/013224ab1761e95c488c7d2701e6fa83f3108d94/postmarker/models/emails.py#L182-L210 | [
"def",
"from_mime",
"(",
"cls",
",",
"message",
",",
"manager",
")",
":",
"text",
",",
"html",
",",
"attachments",
"=",
"deconstruct_multipart",
"(",
"message",
")",
"subject",
"=",
"prepare_header",
"(",
"message",
"[",
"\"Subject\"",
"]",
")",
"sender",
... | 013224ab1761e95c488c7d2701e6fa83f3108d94 |
train | EmailBatch.as_dict | Converts all available emails to dictionaries.
:return: List of dictionaries. | postmarker/models/emails.py | def as_dict(self, **extra):
"""
Converts all available emails to dictionaries.
:return: List of dictionaries.
"""
return [self._construct_email(email, **extra) for email in self.emails] | def as_dict(self, **extra):
"""
Converts all available emails to dictionaries.
:return: List of dictionaries.
"""
return [self._construct_email(email, **extra) for email in self.emails] | [
"Converts",
"all",
"available",
"emails",
"to",
"dictionaries",
"."
] | Stranger6667/postmarker | python | https://github.com/Stranger6667/postmarker/blob/013224ab1761e95c488c7d2701e6fa83f3108d94/postmarker/models/emails.py#L235-L241 | [
"def",
"as_dict",
"(",
"self",
",",
"*",
"*",
"extra",
")",
":",
"return",
"[",
"self",
".",
"_construct_email",
"(",
"email",
",",
"*",
"*",
"extra",
")",
"for",
"email",
"in",
"self",
".",
"emails",
"]"
] | 013224ab1761e95c488c7d2701e6fa83f3108d94 |
train | EmailBatch._construct_email | Converts incoming data to properly structured dictionary. | postmarker/models/emails.py | def _construct_email(self, email, **extra):
"""
Converts incoming data to properly structured dictionary.
"""
if isinstance(email, dict):
email = Email(manager=self._manager, **email)
elif isinstance(email, (MIMEText, MIMEMultipart)):
email = Email.from_mi... | def _construct_email(self, email, **extra):
"""
Converts incoming data to properly structured dictionary.
"""
if isinstance(email, dict):
email = Email(manager=self._manager, **email)
elif isinstance(email, (MIMEText, MIMEMultipart)):
email = Email.from_mi... | [
"Converts",
"incoming",
"data",
"to",
"properly",
"structured",
"dictionary",
"."
] | Stranger6667/postmarker | python | https://github.com/Stranger6667/postmarker/blob/013224ab1761e95c488c7d2701e6fa83f3108d94/postmarker/models/emails.py#L243-L254 | [
"def",
"_construct_email",
"(",
"self",
",",
"email",
",",
"*",
"*",
"extra",
")",
":",
"if",
"isinstance",
"(",
"email",
",",
"dict",
")",
":",
"email",
"=",
"Email",
"(",
"manager",
"=",
"self",
".",
"_manager",
",",
"*",
"*",
"email",
")",
"elif... | 013224ab1761e95c488c7d2701e6fa83f3108d94 |
train | EmailBatch.send | Sends email batch.
:return: Information about sent emails.
:rtype: `list` | postmarker/models/emails.py | def send(self, **extra):
"""
Sends email batch.
:return: Information about sent emails.
:rtype: `list`
"""
emails = self.as_dict(**extra)
responses = [self._manager._send_batch(*batch) for batch in chunks(emails, self.MAX_SIZE)]
return sum(responses, []) | def send(self, **extra):
"""
Sends email batch.
:return: Information about sent emails.
:rtype: `list`
"""
emails = self.as_dict(**extra)
responses = [self._manager._send_batch(*batch) for batch in chunks(emails, self.MAX_SIZE)]
return sum(responses, []) | [
"Sends",
"email",
"batch",
"."
] | Stranger6667/postmarker | python | https://github.com/Stranger6667/postmarker/blob/013224ab1761e95c488c7d2701e6fa83f3108d94/postmarker/models/emails.py#L256-L265 | [
"def",
"send",
"(",
"self",
",",
"*",
"*",
"extra",
")",
":",
"emails",
"=",
"self",
".",
"as_dict",
"(",
"*",
"*",
"extra",
")",
"responses",
"=",
"[",
"self",
".",
"_manager",
".",
"_send_batch",
"(",
"*",
"batch",
")",
"for",
"batch",
"in",
"c... | 013224ab1761e95c488c7d2701e6fa83f3108d94 |
train | EmailManager.send | Sends a single email.
:param message: :py:class:`Email` or ``email.mime.text.MIMEText`` instance.
:param str From: The sender email address.
:param To: Recipient's email address.
Multiple recipients could be specified as a list or string with comma separated values.
:... | postmarker/models/emails.py | def send(
self,
message=None,
From=None,
To=None,
Cc=None,
Bcc=None,
Subject=None,
Tag=None,
HtmlBody=None,
TextBody=None,
Metadata=None,
ReplyTo=None,
Headers=None,
TrackOpens=None,
TrackLinks="None"... | def send(
self,
message=None,
From=None,
To=None,
Cc=None,
Bcc=None,
Subject=None,
Tag=None,
HtmlBody=None,
TextBody=None,
Metadata=None,
ReplyTo=None,
Headers=None,
TrackOpens=None,
TrackLinks="None"... | [
"Sends",
"a",
"single",
"email",
"."
] | Stranger6667/postmarker | python | https://github.com/Stranger6667/postmarker/blob/013224ab1761e95c488c7d2701e6fa83f3108d94/postmarker/models/emails.py#L295-L362 | [
"def",
"send",
"(",
"self",
",",
"message",
"=",
"None",
",",
"From",
"=",
"None",
",",
"To",
"=",
"None",
",",
"Cc",
"=",
"None",
",",
"Bcc",
"=",
"None",
",",
"Subject",
"=",
"None",
",",
"Tag",
"=",
"None",
",",
"HtmlBody",
"=",
"None",
",",... | 013224ab1761e95c488c7d2701e6fa83f3108d94 |
train | EmailManager.Email | Constructs :py:class:`Email` instance.
:return: :py:class:`Email` | postmarker/models/emails.py | def Email(
self,
From,
To,
Cc=None,
Bcc=None,
Subject=None,
Tag=None,
HtmlBody=None,
TextBody=None,
Metadata=None,
ReplyTo=None,
Headers=None,
TrackOpens=None,
TrackLinks="None",
Attachments=None,
... | def Email(
self,
From,
To,
Cc=None,
Bcc=None,
Subject=None,
Tag=None,
HtmlBody=None,
TextBody=None,
Metadata=None,
ReplyTo=None,
Headers=None,
TrackOpens=None,
TrackLinks="None",
Attachments=None,
... | [
"Constructs",
":",
"py",
":",
"class",
":",
"Email",
"instance",
"."
] | Stranger6667/postmarker | python | https://github.com/Stranger6667/postmarker/blob/013224ab1761e95c488c7d2701e6fa83f3108d94/postmarker/models/emails.py#L411-L449 | [
"def",
"Email",
"(",
"self",
",",
"From",
",",
"To",
",",
"Cc",
"=",
"None",
",",
"Bcc",
"=",
"None",
",",
"Subject",
"=",
"None",
",",
"Tag",
"=",
"None",
",",
"HtmlBody",
"=",
"None",
",",
"TextBody",
"=",
"None",
",",
"Metadata",
"=",
"None",
... | 013224ab1761e95c488c7d2701e6fa83f3108d94 |
train | EmailManager.EmailTemplate | Constructs :py:class:`EmailTemplate` instance.
:return: :py:class:`EmailTemplate` | postmarker/models/emails.py | def EmailTemplate(
self,
TemplateId,
TemplateModel,
From,
To,
TemplateAlias=None,
Cc=None,
Bcc=None,
Subject=None,
Tag=None,
ReplyTo=None,
Headers=None,
TrackOpens=None,
TrackLinks="None",
Attachments... | def EmailTemplate(
self,
TemplateId,
TemplateModel,
From,
To,
TemplateAlias=None,
Cc=None,
Bcc=None,
Subject=None,
Tag=None,
ReplyTo=None,
Headers=None,
TrackOpens=None,
TrackLinks="None",
Attachments... | [
"Constructs",
":",
"py",
":",
"class",
":",
"EmailTemplate",
"instance",
"."
] | Stranger6667/postmarker | python | https://github.com/Stranger6667/postmarker/blob/013224ab1761e95c488c7d2701e6fa83f3108d94/postmarker/models/emails.py#L451-L491 | [
"def",
"EmailTemplate",
"(",
"self",
",",
"TemplateId",
",",
"TemplateModel",
",",
"From",
",",
"To",
",",
"TemplateAlias",
"=",
"None",
",",
"Cc",
"=",
"None",
",",
"Bcc",
"=",
"None",
",",
"Subject",
"=",
"None",
",",
"Tag",
"=",
"None",
",",
"Repl... | 013224ab1761e95c488c7d2701e6fa83f3108d94 |
train | Bounce.activate | Activates the bounce instance and updates it with the latest data.
:return: Activation status.
:rtype: `str` | postmarker/models/bounces.py | def activate(self):
"""
Activates the bounce instance and updates it with the latest data.
:return: Activation status.
:rtype: `str`
"""
response = self._manager.activate(self.ID)
self._update(response["Bounce"])
return response["Message"] | def activate(self):
"""
Activates the bounce instance and updates it with the latest data.
:return: Activation status.
:rtype: `str`
"""
response = self._manager.activate(self.ID)
self._update(response["Bounce"])
return response["Message"] | [
"Activates",
"the",
"bounce",
"instance",
"and",
"updates",
"it",
"with",
"the",
"latest",
"data",
"."
] | Stranger6667/postmarker | python | https://github.com/Stranger6667/postmarker/blob/013224ab1761e95c488c7d2701e6fa83f3108d94/postmarker/models/bounces.py#L24-L33 | [
"def",
"activate",
"(",
"self",
")",
":",
"response",
"=",
"self",
".",
"_manager",
".",
"activate",
"(",
"self",
".",
"ID",
")",
"self",
".",
"_update",
"(",
"response",
"[",
"\"Bounce\"",
"]",
")",
"return",
"response",
"[",
"\"Message\"",
"]"
] | 013224ab1761e95c488c7d2701e6fa83f3108d94 |
train | BounceManager.all | Returns many bounces.
:param int count: Number of bounces to return per request.
:param int offset: Number of bounces to skip.
:param str type: Filter by type of bounce.
:param bool inactive: Filter by emails that were deactivated by Postmark due to the bounce.
:param str emailF... | postmarker/models/bounces.py | def all(
self,
count=500,
offset=0,
type=None,
inactive=None,
emailFilter=None,
tag=None,
messageID=None,
fromdate=None,
todate=None,
):
"""
Returns many bounces.
:param int count: Number of bounces to return pe... | def all(
self,
count=500,
offset=0,
type=None,
inactive=None,
emailFilter=None,
tag=None,
messageID=None,
fromdate=None,
todate=None,
):
"""
Returns many bounces.
:param int count: Number of bounces to return pe... | [
"Returns",
"many",
"bounces",
"."
] | Stranger6667/postmarker | python | https://github.com/Stranger6667/postmarker/blob/013224ab1761e95c488c7d2701e6fa83f3108d94/postmarker/models/bounces.py#L72-L112 | [
"def",
"all",
"(",
"self",
",",
"count",
"=",
"500",
",",
"offset",
"=",
"0",
",",
"type",
"=",
"None",
",",
"inactive",
"=",
"None",
",",
"emailFilter",
"=",
"None",
",",
"tag",
"=",
"None",
",",
"messageID",
"=",
"None",
",",
"fromdate",
"=",
"... | 013224ab1761e95c488c7d2701e6fa83f3108d94 |
train | ModelManager.update_kwargs | Helper to support handy dictionaries merging on all Python versions. | postmarker/models/base.py | def update_kwargs(self, kwargs, count, offset):
"""
Helper to support handy dictionaries merging on all Python versions.
"""
kwargs.update({self.count_key: count, self.offset_key: offset})
return kwargs | def update_kwargs(self, kwargs, count, offset):
"""
Helper to support handy dictionaries merging on all Python versions.
"""
kwargs.update({self.count_key: count, self.offset_key: offset})
return kwargs | [
"Helper",
"to",
"support",
"handy",
"dictionaries",
"merging",
"on",
"all",
"Python",
"versions",
"."
] | Stranger6667/postmarker | python | https://github.com/Stranger6667/postmarker/blob/013224ab1761e95c488c7d2701e6fa83f3108d94/postmarker/models/base.py#L97-L102 | [
"def",
"update_kwargs",
"(",
"self",
",",
"kwargs",
",",
"count",
",",
"offset",
")",
":",
"kwargs",
".",
"update",
"(",
"{",
"self",
".",
"count_key",
":",
"count",
",",
"self",
".",
"offset_key",
":",
"offset",
"}",
")",
"return",
"kwargs"
] | 013224ab1761e95c488c7d2701e6fa83f3108d94 |
train | StatsManager.overview | Gets a brief overview of statistics for all of your outbound email. | postmarker/models/stats.py | def overview(self, tag=None, fromdate=None, todate=None):
"""
Gets a brief overview of statistics for all of your outbound email.
"""
return self.call("GET", "/stats/outbound", tag=tag, fromdate=fromdate, todate=todate) | def overview(self, tag=None, fromdate=None, todate=None):
"""
Gets a brief overview of statistics for all of your outbound email.
"""
return self.call("GET", "/stats/outbound", tag=tag, fromdate=fromdate, todate=todate) | [
"Gets",
"a",
"brief",
"overview",
"of",
"statistics",
"for",
"all",
"of",
"your",
"outbound",
"email",
"."
] | Stranger6667/postmarker | python | https://github.com/Stranger6667/postmarker/blob/013224ab1761e95c488c7d2701e6fa83f3108d94/postmarker/models/stats.py#L8-L12 | [
"def",
"overview",
"(",
"self",
",",
"tag",
"=",
"None",
",",
"fromdate",
"=",
"None",
",",
"todate",
"=",
"None",
")",
":",
"return",
"self",
".",
"call",
"(",
"\"GET\"",
",",
"\"/stats/outbound\"",
",",
"tag",
"=",
"tag",
",",
"fromdate",
"=",
"fro... | 013224ab1761e95c488c7d2701e6fa83f3108d94 |
train | StatsManager.sends | Gets a total count of emails you’ve sent out. | postmarker/models/stats.py | def sends(self, tag=None, fromdate=None, todate=None):
"""
Gets a total count of emails you’ve sent out.
"""
return self.call("GET", "/stats/outbound/sends", tag=tag, fromdate=fromdate, todate=todate) | def sends(self, tag=None, fromdate=None, todate=None):
"""
Gets a total count of emails you’ve sent out.
"""
return self.call("GET", "/stats/outbound/sends", tag=tag, fromdate=fromdate, todate=todate) | [
"Gets",
"a",
"total",
"count",
"of",
"emails",
"you’ve",
"sent",
"out",
"."
] | Stranger6667/postmarker | python | https://github.com/Stranger6667/postmarker/blob/013224ab1761e95c488c7d2701e6fa83f3108d94/postmarker/models/stats.py#L14-L18 | [
"def",
"sends",
"(",
"self",
",",
"tag",
"=",
"None",
",",
"fromdate",
"=",
"None",
",",
"todate",
"=",
"None",
")",
":",
"return",
"self",
".",
"call",
"(",
"\"GET\"",
",",
"\"/stats/outbound/sends\"",
",",
"tag",
"=",
"tag",
",",
"fromdate",
"=",
"... | 013224ab1761e95c488c7d2701e6fa83f3108d94 |
train | StatsManager.bounces | Gets total counts of emails you’ve sent out that have been returned as bounced. | postmarker/models/stats.py | def bounces(self, tag=None, fromdate=None, todate=None):
"""
Gets total counts of emails you’ve sent out that have been returned as bounced.
"""
return self.call("GET", "/stats/outbound/bounces", tag=tag, fromdate=fromdate, todate=todate) | def bounces(self, tag=None, fromdate=None, todate=None):
"""
Gets total counts of emails you’ve sent out that have been returned as bounced.
"""
return self.call("GET", "/stats/outbound/bounces", tag=tag, fromdate=fromdate, todate=todate) | [
"Gets",
"total",
"counts",
"of",
"emails",
"you’ve",
"sent",
"out",
"that",
"have",
"been",
"returned",
"as",
"bounced",
"."
] | Stranger6667/postmarker | python | https://github.com/Stranger6667/postmarker/blob/013224ab1761e95c488c7d2701e6fa83f3108d94/postmarker/models/stats.py#L20-L24 | [
"def",
"bounces",
"(",
"self",
",",
"tag",
"=",
"None",
",",
"fromdate",
"=",
"None",
",",
"todate",
"=",
"None",
")",
":",
"return",
"self",
".",
"call",
"(",
"\"GET\"",
",",
"\"/stats/outbound/bounces\"",
",",
"tag",
"=",
"tag",
",",
"fromdate",
"=",... | 013224ab1761e95c488c7d2701e6fa83f3108d94 |
train | StatsManager.spam | Gets a total count of recipients who have marked your email as spam. | postmarker/models/stats.py | def spam(self, tag=None, fromdate=None, todate=None):
"""
Gets a total count of recipients who have marked your email as spam.
"""
return self.call("GET", "/stats/outbound/spam", tag=tag, fromdate=fromdate, todate=todate) | def spam(self, tag=None, fromdate=None, todate=None):
"""
Gets a total count of recipients who have marked your email as spam.
"""
return self.call("GET", "/stats/outbound/spam", tag=tag, fromdate=fromdate, todate=todate) | [
"Gets",
"a",
"total",
"count",
"of",
"recipients",
"who",
"have",
"marked",
"your",
"email",
"as",
"spam",
"."
] | Stranger6667/postmarker | python | https://github.com/Stranger6667/postmarker/blob/013224ab1761e95c488c7d2701e6fa83f3108d94/postmarker/models/stats.py#L26-L30 | [
"def",
"spam",
"(",
"self",
",",
"tag",
"=",
"None",
",",
"fromdate",
"=",
"None",
",",
"todate",
"=",
"None",
")",
":",
"return",
"self",
".",
"call",
"(",
"\"GET\"",
",",
"\"/stats/outbound/spam\"",
",",
"tag",
"=",
"tag",
",",
"fromdate",
"=",
"fr... | 013224ab1761e95c488c7d2701e6fa83f3108d94 |
train | StatsManager.tracked | Gets a total count of emails you’ve sent with open tracking or link tracking enabled. | postmarker/models/stats.py | def tracked(self, tag=None, fromdate=None, todate=None):
"""
Gets a total count of emails you’ve sent with open tracking or link tracking enabled.
"""
return self.call("GET", "/stats/outbound/tracked", tag=tag, fromdate=fromdate, todate=todate) | def tracked(self, tag=None, fromdate=None, todate=None):
"""
Gets a total count of emails you’ve sent with open tracking or link tracking enabled.
"""
return self.call("GET", "/stats/outbound/tracked", tag=tag, fromdate=fromdate, todate=todate) | [
"Gets",
"a",
"total",
"count",
"of",
"emails",
"you’ve",
"sent",
"with",
"open",
"tracking",
"or",
"link",
"tracking",
"enabled",
"."
] | Stranger6667/postmarker | python | https://github.com/Stranger6667/postmarker/blob/013224ab1761e95c488c7d2701e6fa83f3108d94/postmarker/models/stats.py#L32-L36 | [
"def",
"tracked",
"(",
"self",
",",
"tag",
"=",
"None",
",",
"fromdate",
"=",
"None",
",",
"todate",
"=",
"None",
")",
":",
"return",
"self",
".",
"call",
"(",
"\"GET\"",
",",
"\"/stats/outbound/tracked\"",
",",
"tag",
"=",
"tag",
",",
"fromdate",
"=",... | 013224ab1761e95c488c7d2701e6fa83f3108d94 |
train | StatsManager.opens | Gets total counts of recipients who opened your emails.
This is only recorded when open tracking is enabled for that email. | postmarker/models/stats.py | def opens(self, tag=None, fromdate=None, todate=None):
"""
Gets total counts of recipients who opened your emails.
This is only recorded when open tracking is enabled for that email.
"""
return self.call("GET", "/stats/outbound/opens", tag=tag, fromdate=fromdate, todate=todate) | def opens(self, tag=None, fromdate=None, todate=None):
"""
Gets total counts of recipients who opened your emails.
This is only recorded when open tracking is enabled for that email.
"""
return self.call("GET", "/stats/outbound/opens", tag=tag, fromdate=fromdate, todate=todate) | [
"Gets",
"total",
"counts",
"of",
"recipients",
"who",
"opened",
"your",
"emails",
".",
"This",
"is",
"only",
"recorded",
"when",
"open",
"tracking",
"is",
"enabled",
"for",
"that",
"email",
"."
] | Stranger6667/postmarker | python | https://github.com/Stranger6667/postmarker/blob/013224ab1761e95c488c7d2701e6fa83f3108d94/postmarker/models/stats.py#L38-L43 | [
"def",
"opens",
"(",
"self",
",",
"tag",
"=",
"None",
",",
"fromdate",
"=",
"None",
",",
"todate",
"=",
"None",
")",
":",
"return",
"self",
".",
"call",
"(",
"\"GET\"",
",",
"\"/stats/outbound/opens\"",
",",
"tag",
"=",
"tag",
",",
"fromdate",
"=",
"... | 013224ab1761e95c488c7d2701e6fa83f3108d94 |
train | StatsManager.opens_platforms | Gets an overview of the platforms used to open your emails.
This is only recorded when open tracking is enabled for that email. | postmarker/models/stats.py | def opens_platforms(self, tag=None, fromdate=None, todate=None):
"""
Gets an overview of the platforms used to open your emails.
This is only recorded when open tracking is enabled for that email.
"""
return self.call("GET", "/stats/outbound/opens/platforms", tag=tag, fromdate=fr... | def opens_platforms(self, tag=None, fromdate=None, todate=None):
"""
Gets an overview of the platforms used to open your emails.
This is only recorded when open tracking is enabled for that email.
"""
return self.call("GET", "/stats/outbound/opens/platforms", tag=tag, fromdate=fr... | [
"Gets",
"an",
"overview",
"of",
"the",
"platforms",
"used",
"to",
"open",
"your",
"emails",
".",
"This",
"is",
"only",
"recorded",
"when",
"open",
"tracking",
"is",
"enabled",
"for",
"that",
"email",
"."
] | Stranger6667/postmarker | python | https://github.com/Stranger6667/postmarker/blob/013224ab1761e95c488c7d2701e6fa83f3108d94/postmarker/models/stats.py#L45-L50 | [
"def",
"opens_platforms",
"(",
"self",
",",
"tag",
"=",
"None",
",",
"fromdate",
"=",
"None",
",",
"todate",
"=",
"None",
")",
":",
"return",
"self",
".",
"call",
"(",
"\"GET\"",
",",
"\"/stats/outbound/opens/platforms\"",
",",
"tag",
"=",
"tag",
",",
"f... | 013224ab1761e95c488c7d2701e6fa83f3108d94 |
train | StatsManager.emailclients | Gets an overview of the email clients used to open your emails.
This is only recorded when open tracking is enabled for that email. | postmarker/models/stats.py | def emailclients(self, tag=None, fromdate=None, todate=None):
"""
Gets an overview of the email clients used to open your emails.
This is only recorded when open tracking is enabled for that email.
"""
return self.call("GET", "/stats/outbound/opens/emailclients", tag=tag, fromdat... | def emailclients(self, tag=None, fromdate=None, todate=None):
"""
Gets an overview of the email clients used to open your emails.
This is only recorded when open tracking is enabled for that email.
"""
return self.call("GET", "/stats/outbound/opens/emailclients", tag=tag, fromdat... | [
"Gets",
"an",
"overview",
"of",
"the",
"email",
"clients",
"used",
"to",
"open",
"your",
"emails",
".",
"This",
"is",
"only",
"recorded",
"when",
"open",
"tracking",
"is",
"enabled",
"for",
"that",
"email",
"."
] | Stranger6667/postmarker | python | https://github.com/Stranger6667/postmarker/blob/013224ab1761e95c488c7d2701e6fa83f3108d94/postmarker/models/stats.py#L52-L57 | [
"def",
"emailclients",
"(",
"self",
",",
"tag",
"=",
"None",
",",
"fromdate",
"=",
"None",
",",
"todate",
"=",
"None",
")",
":",
"return",
"self",
".",
"call",
"(",
"\"GET\"",
",",
"\"/stats/outbound/opens/emailclients\"",
",",
"tag",
"=",
"tag",
",",
"f... | 013224ab1761e95c488c7d2701e6fa83f3108d94 |
train | StatsManager.readtimes | Gets the length of time that recipients read emails along with counts for each time.
This is only recorded when open tracking is enabled for that email.
Read time tracking stops at 20 seconds, so any read times above that will appear in the 20s+ field. | postmarker/models/stats.py | def readtimes(self, tag=None, fromdate=None, todate=None):
"""
Gets the length of time that recipients read emails along with counts for each time.
This is only recorded when open tracking is enabled for that email.
Read time tracking stops at 20 seconds, so any read times above that wil... | def readtimes(self, tag=None, fromdate=None, todate=None):
"""
Gets the length of time that recipients read emails along with counts for each time.
This is only recorded when open tracking is enabled for that email.
Read time tracking stops at 20 seconds, so any read times above that wil... | [
"Gets",
"the",
"length",
"of",
"time",
"that",
"recipients",
"read",
"emails",
"along",
"with",
"counts",
"for",
"each",
"time",
".",
"This",
"is",
"only",
"recorded",
"when",
"open",
"tracking",
"is",
"enabled",
"for",
"that",
"email",
".",
"Read",
"time"... | Stranger6667/postmarker | python | https://github.com/Stranger6667/postmarker/blob/013224ab1761e95c488c7d2701e6fa83f3108d94/postmarker/models/stats.py#L59-L65 | [
"def",
"readtimes",
"(",
"self",
",",
"tag",
"=",
"None",
",",
"fromdate",
"=",
"None",
",",
"todate",
"=",
"None",
")",
":",
"return",
"self",
".",
"call",
"(",
"\"GET\"",
",",
"\"/stats/outbound/opens/readtimes\"",
",",
"tag",
"=",
"tag",
",",
"fromdat... | 013224ab1761e95c488c7d2701e6fa83f3108d94 |
train | StatsManager.clicks | Gets total counts of unique links that were clicked. | postmarker/models/stats.py | def clicks(self, tag=None, fromdate=None, todate=None):
"""
Gets total counts of unique links that were clicked.
"""
return self.call("GET", "/stats/outbound/clicks", tag=tag, fromdate=fromdate, todate=todate) | def clicks(self, tag=None, fromdate=None, todate=None):
"""
Gets total counts of unique links that were clicked.
"""
return self.call("GET", "/stats/outbound/clicks", tag=tag, fromdate=fromdate, todate=todate) | [
"Gets",
"total",
"counts",
"of",
"unique",
"links",
"that",
"were",
"clicked",
"."
] | Stranger6667/postmarker | python | https://github.com/Stranger6667/postmarker/blob/013224ab1761e95c488c7d2701e6fa83f3108d94/postmarker/models/stats.py#L67-L71 | [
"def",
"clicks",
"(",
"self",
",",
"tag",
"=",
"None",
",",
"fromdate",
"=",
"None",
",",
"todate",
"=",
"None",
")",
":",
"return",
"self",
".",
"call",
"(",
"\"GET\"",
",",
"\"/stats/outbound/clicks\"",
",",
"tag",
"=",
"tag",
",",
"fromdate",
"=",
... | 013224ab1761e95c488c7d2701e6fa83f3108d94 |
train | StatsManager.browserfamilies | Gets an overview of the browsers used to open links in your emails.
This is only recorded when Link Tracking is enabled for that email. | postmarker/models/stats.py | def browserfamilies(self, tag=None, fromdate=None, todate=None):
"""
Gets an overview of the browsers used to open links in your emails.
This is only recorded when Link Tracking is enabled for that email.
"""
return self.call("GET", "/stats/outbound/clicks/browserfamilies", tag=t... | def browserfamilies(self, tag=None, fromdate=None, todate=None):
"""
Gets an overview of the browsers used to open links in your emails.
This is only recorded when Link Tracking is enabled for that email.
"""
return self.call("GET", "/stats/outbound/clicks/browserfamilies", tag=t... | [
"Gets",
"an",
"overview",
"of",
"the",
"browsers",
"used",
"to",
"open",
"links",
"in",
"your",
"emails",
".",
"This",
"is",
"only",
"recorded",
"when",
"Link",
"Tracking",
"is",
"enabled",
"for",
"that",
"email",
"."
] | Stranger6667/postmarker | python | https://github.com/Stranger6667/postmarker/blob/013224ab1761e95c488c7d2701e6fa83f3108d94/postmarker/models/stats.py#L73-L78 | [
"def",
"browserfamilies",
"(",
"self",
",",
"tag",
"=",
"None",
",",
"fromdate",
"=",
"None",
",",
"todate",
"=",
"None",
")",
":",
"return",
"self",
".",
"call",
"(",
"\"GET\"",
",",
"\"/stats/outbound/clicks/browserfamilies\"",
",",
"tag",
"=",
"tag",
",... | 013224ab1761e95c488c7d2701e6fa83f3108d94 |
train | StatsManager.clicks_platforms | Gets an overview of the browser platforms used to open your emails.
This is only recorded when Link Tracking is enabled for that email. | postmarker/models/stats.py | def clicks_platforms(self, tag=None, fromdate=None, todate=None):
"""
Gets an overview of the browser platforms used to open your emails.
This is only recorded when Link Tracking is enabled for that email.
"""
return self.call("GET", "/stats/outbound/clicks/platforms", tag=tag, f... | def clicks_platforms(self, tag=None, fromdate=None, todate=None):
"""
Gets an overview of the browser platforms used to open your emails.
This is only recorded when Link Tracking is enabled for that email.
"""
return self.call("GET", "/stats/outbound/clicks/platforms", tag=tag, f... | [
"Gets",
"an",
"overview",
"of",
"the",
"browser",
"platforms",
"used",
"to",
"open",
"your",
"emails",
".",
"This",
"is",
"only",
"recorded",
"when",
"Link",
"Tracking",
"is",
"enabled",
"for",
"that",
"email",
"."
] | Stranger6667/postmarker | python | https://github.com/Stranger6667/postmarker/blob/013224ab1761e95c488c7d2701e6fa83f3108d94/postmarker/models/stats.py#L80-L85 | [
"def",
"clicks_platforms",
"(",
"self",
",",
"tag",
"=",
"None",
",",
"fromdate",
"=",
"None",
",",
"todate",
"=",
"None",
")",
":",
"return",
"self",
".",
"call",
"(",
"\"GET\"",
",",
"\"/stats/outbound/clicks/platforms\"",
",",
"tag",
"=",
"tag",
",",
... | 013224ab1761e95c488c7d2701e6fa83f3108d94 |
train | StatsManager.location | Gets an overview of which part of the email links were clicked from (HTML or Text).
This is only recorded when Link Tracking is enabled for that email. | postmarker/models/stats.py | def location(self, tag=None, fromdate=None, todate=None):
"""
Gets an overview of which part of the email links were clicked from (HTML or Text).
This is only recorded when Link Tracking is enabled for that email.
"""
return self.call("GET", "/stats/outbound/clicks/location", tag... | def location(self, tag=None, fromdate=None, todate=None):
"""
Gets an overview of which part of the email links were clicked from (HTML or Text).
This is only recorded when Link Tracking is enabled for that email.
"""
return self.call("GET", "/stats/outbound/clicks/location", tag... | [
"Gets",
"an",
"overview",
"of",
"which",
"part",
"of",
"the",
"email",
"links",
"were",
"clicked",
"from",
"(",
"HTML",
"or",
"Text",
")",
".",
"This",
"is",
"only",
"recorded",
"when",
"Link",
"Tracking",
"is",
"enabled",
"for",
"that",
"email",
"."
] | Stranger6667/postmarker | python | https://github.com/Stranger6667/postmarker/blob/013224ab1761e95c488c7d2701e6fa83f3108d94/postmarker/models/stats.py#L87-L92 | [
"def",
"location",
"(",
"self",
",",
"tag",
"=",
"None",
",",
"fromdate",
"=",
"None",
",",
"todate",
"=",
"None",
")",
":",
"return",
"self",
".",
"call",
"(",
"\"GET\"",
",",
"\"/stats/outbound/clicks/location\"",
",",
"tag",
"=",
"tag",
",",
"fromdate... | 013224ab1761e95c488c7d2701e6fa83f3108d94 |
train | Cobertura.line_rate | Return the global line rate of the coverage report. If the
`filename` file is given, return the line rate of the file. | pycobertura/cobertura.py | def line_rate(self, filename=None):
"""
Return the global line rate of the coverage report. If the
`filename` file is given, return the line rate of the file.
"""
if filename is None:
el = self.xml
else:
el = self._get_class_element_by_filename(fil... | def line_rate(self, filename=None):
"""
Return the global line rate of the coverage report. If the
`filename` file is given, return the line rate of the file.
"""
if filename is None:
el = self.xml
else:
el = self._get_class_element_by_filename(fil... | [
"Return",
"the",
"global",
"line",
"rate",
"of",
"the",
"coverage",
"report",
".",
"If",
"the",
"filename",
"file",
"is",
"given",
"return",
"the",
"line",
"rate",
"of",
"the",
"file",
"."
] | aconrad/pycobertura | python | https://github.com/aconrad/pycobertura/blob/26e472f1424f5cd499c42232dc5ee12e4042806f/pycobertura/cobertura.py#L93-L103 | [
"def",
"line_rate",
"(",
"self",
",",
"filename",
"=",
"None",
")",
":",
"if",
"filename",
"is",
"None",
":",
"el",
"=",
"self",
".",
"xml",
"else",
":",
"el",
"=",
"self",
".",
"_get_class_element_by_filename",
"(",
"filename",
")",
"return",
"float",
... | 26e472f1424f5cd499c42232dc5ee12e4042806f |
train | Cobertura.branch_rate | Return the global branch rate of the coverage report. If the
`filename` file is given, return the branch rate of the file. | pycobertura/cobertura.py | def branch_rate(self, filename=None):
"""
Return the global branch rate of the coverage report. If the
`filename` file is given, return the branch rate of the file.
"""
if filename is None:
el = self.xml
else:
el = self._get_class_element_by_filena... | def branch_rate(self, filename=None):
"""
Return the global branch rate of the coverage report. If the
`filename` file is given, return the branch rate of the file.
"""
if filename is None:
el = self.xml
else:
el = self._get_class_element_by_filena... | [
"Return",
"the",
"global",
"branch",
"rate",
"of",
"the",
"coverage",
"report",
".",
"If",
"the",
"filename",
"file",
"is",
"given",
"return",
"the",
"branch",
"rate",
"of",
"the",
"file",
"."
] | aconrad/pycobertura | python | https://github.com/aconrad/pycobertura/blob/26e472f1424f5cd499c42232dc5ee12e4042806f/pycobertura/cobertura.py#L105-L115 | [
"def",
"branch_rate",
"(",
"self",
",",
"filename",
"=",
"None",
")",
":",
"if",
"filename",
"is",
"None",
":",
"el",
"=",
"self",
".",
"xml",
"else",
":",
"el",
"=",
"self",
".",
"_get_class_element_by_filename",
"(",
"filename",
")",
"return",
"float",... | 26e472f1424f5cd499c42232dc5ee12e4042806f |
train | Cobertura.missed_statements | Return a list of uncovered line numbers for each of the missed
statements found for the file `filename`. | pycobertura/cobertura.py | def missed_statements(self, filename):
"""
Return a list of uncovered line numbers for each of the missed
statements found for the file `filename`.
"""
el = self._get_class_element_by_filename(filename)
lines = el.xpath('./lines/line[@hits=0]')
return [int(l.attri... | def missed_statements(self, filename):
"""
Return a list of uncovered line numbers for each of the missed
statements found for the file `filename`.
"""
el = self._get_class_element_by_filename(filename)
lines = el.xpath('./lines/line[@hits=0]')
return [int(l.attri... | [
"Return",
"a",
"list",
"of",
"uncovered",
"line",
"numbers",
"for",
"each",
"of",
"the",
"missed",
"statements",
"found",
"for",
"the",
"file",
"filename",
"."
] | aconrad/pycobertura | python | https://github.com/aconrad/pycobertura/blob/26e472f1424f5cd499c42232dc5ee12e4042806f/pycobertura/cobertura.py#L118-L125 | [
"def",
"missed_statements",
"(",
"self",
",",
"filename",
")",
":",
"el",
"=",
"self",
".",
"_get_class_element_by_filename",
"(",
"filename",
")",
"lines",
"=",
"el",
".",
"xpath",
"(",
"'./lines/line[@hits=0]'",
")",
"return",
"[",
"int",
"(",
"l",
".",
... | 26e472f1424f5cd499c42232dc5ee12e4042806f |
train | Cobertura.line_statuses | Return a list of tuples `(lineno, status)` of all the lines found in
the Cobertura report for the given file `filename` where `lineno` is
the line number and `status` is coverage status of the line which can
be either `True` (line hit) or `False` (line miss). | pycobertura/cobertura.py | def line_statuses(self, filename):
"""
Return a list of tuples `(lineno, status)` of all the lines found in
the Cobertura report for the given file `filename` where `lineno` is
the line number and `status` is coverage status of the line which can
be either `True` (line hit) or `F... | def line_statuses(self, filename):
"""
Return a list of tuples `(lineno, status)` of all the lines found in
the Cobertura report for the given file `filename` where `lineno` is
the line number and `status` is coverage status of the line which can
be either `True` (line hit) or `F... | [
"Return",
"a",
"list",
"of",
"tuples",
"(",
"lineno",
"status",
")",
"of",
"all",
"the",
"lines",
"found",
"in",
"the",
"Cobertura",
"report",
"for",
"the",
"given",
"file",
"filename",
"where",
"lineno",
"is",
"the",
"line",
"number",
"and",
"status",
"... | aconrad/pycobertura | python | https://github.com/aconrad/pycobertura/blob/26e472f1424f5cd499c42232dc5ee12e4042806f/pycobertura/cobertura.py#L137-L152 | [
"def",
"line_statuses",
"(",
"self",
",",
"filename",
")",
":",
"line_elements",
"=",
"self",
".",
"_get_lines_by_filename",
"(",
"filename",
")",
"lines_w_status",
"=",
"[",
"]",
"for",
"line",
"in",
"line_elements",
":",
"lineno",
"=",
"int",
"(",
"line",
... | 26e472f1424f5cd499c42232dc5ee12e4042806f |
train | Cobertura.missed_lines | Return a list of extrapolated uncovered line numbers for the
file `filename` according to `Cobertura.line_statuses`. | pycobertura/cobertura.py | def missed_lines(self, filename):
"""
Return a list of extrapolated uncovered line numbers for the
file `filename` according to `Cobertura.line_statuses`.
"""
statuses = self.line_statuses(filename)
statuses = extrapolate_coverage(statuses)
return [lno for lno, st... | def missed_lines(self, filename):
"""
Return a list of extrapolated uncovered line numbers for the
file `filename` according to `Cobertura.line_statuses`.
"""
statuses = self.line_statuses(filename)
statuses = extrapolate_coverage(statuses)
return [lno for lno, st... | [
"Return",
"a",
"list",
"of",
"extrapolated",
"uncovered",
"line",
"numbers",
"for",
"the",
"file",
"filename",
"according",
"to",
"Cobertura",
".",
"line_statuses",
"."
] | aconrad/pycobertura | python | https://github.com/aconrad/pycobertura/blob/26e472f1424f5cd499c42232dc5ee12e4042806f/pycobertura/cobertura.py#L154-L161 | [
"def",
"missed_lines",
"(",
"self",
",",
"filename",
")",
":",
"statuses",
"=",
"self",
".",
"line_statuses",
"(",
"filename",
")",
"statuses",
"=",
"extrapolate_coverage",
"(",
"statuses",
")",
"return",
"[",
"lno",
"for",
"lno",
",",
"status",
"in",
"sta... | 26e472f1424f5cd499c42232dc5ee12e4042806f |
train | Cobertura.file_source | Return a list of namedtuple `Line` for each line of code found in the
source file with the given `filename`. | pycobertura/cobertura.py | def file_source(self, filename):
"""
Return a list of namedtuple `Line` for each line of code found in the
source file with the given `filename`.
"""
lines = []
try:
with self.filesystem.open(filename) as f:
line_statuses = dict(self.line_statu... | def file_source(self, filename):
"""
Return a list of namedtuple `Line` for each line of code found in the
source file with the given `filename`.
"""
lines = []
try:
with self.filesystem.open(filename) as f:
line_statuses = dict(self.line_statu... | [
"Return",
"a",
"list",
"of",
"namedtuple",
"Line",
"for",
"each",
"line",
"of",
"code",
"found",
"in",
"the",
"source",
"file",
"with",
"the",
"given",
"filename",
"."
] | aconrad/pycobertura | python | https://github.com/aconrad/pycobertura/blob/26e472f1424f5cd499c42232dc5ee12e4042806f/pycobertura/cobertura.py#L164-L183 | [
"def",
"file_source",
"(",
"self",
",",
"filename",
")",
":",
"lines",
"=",
"[",
"]",
"try",
":",
"with",
"self",
".",
"filesystem",
".",
"open",
"(",
"filename",
")",
"as",
"f",
":",
"line_statuses",
"=",
"dict",
"(",
"self",
".",
"line_statuses",
"... | 26e472f1424f5cd499c42232dc5ee12e4042806f |
train | Cobertura.total_misses | Return the total number of uncovered statements for the file
`filename`. If `filename` is not given, return the total
number of uncovered statements for all files. | pycobertura/cobertura.py | def total_misses(self, filename=None):
"""
Return the total number of uncovered statements for the file
`filename`. If `filename` is not given, return the total
number of uncovered statements for all files.
"""
if filename is not None:
return len(self.missed_s... | def total_misses(self, filename=None):
"""
Return the total number of uncovered statements for the file
`filename`. If `filename` is not given, return the total
number of uncovered statements for all files.
"""
if filename is not None:
return len(self.missed_s... | [
"Return",
"the",
"total",
"number",
"of",
"uncovered",
"statements",
"for",
"the",
"file",
"filename",
".",
"If",
"filename",
"is",
"not",
"given",
"return",
"the",
"total",
"number",
"of",
"uncovered",
"statements",
"for",
"all",
"files",
"."
] | aconrad/pycobertura | python | https://github.com/aconrad/pycobertura/blob/26e472f1424f5cd499c42232dc5ee12e4042806f/pycobertura/cobertura.py#L185-L198 | [
"def",
"total_misses",
"(",
"self",
",",
"filename",
"=",
"None",
")",
":",
"if",
"filename",
"is",
"not",
"None",
":",
"return",
"len",
"(",
"self",
".",
"missed_statements",
"(",
"filename",
")",
")",
"total",
"=",
"0",
"for",
"filename",
"in",
"self... | 26e472f1424f5cd499c42232dc5ee12e4042806f |
train | Cobertura.total_hits | Return the total number of covered statements for the file
`filename`. If `filename` is not given, return the total
number of covered statements for all files. | pycobertura/cobertura.py | def total_hits(self, filename=None):
"""
Return the total number of covered statements for the file
`filename`. If `filename` is not given, return the total
number of covered statements for all files.
"""
if filename is not None:
return len(self.hit_statements... | def total_hits(self, filename=None):
"""
Return the total number of covered statements for the file
`filename`. If `filename` is not given, return the total
number of covered statements for all files.
"""
if filename is not None:
return len(self.hit_statements... | [
"Return",
"the",
"total",
"number",
"of",
"covered",
"statements",
"for",
"the",
"file",
"filename",
".",
"If",
"filename",
"is",
"not",
"given",
"return",
"the",
"total",
"number",
"of",
"covered",
"statements",
"for",
"all",
"files",
"."
] | aconrad/pycobertura | python | https://github.com/aconrad/pycobertura/blob/26e472f1424f5cd499c42232dc5ee12e4042806f/pycobertura/cobertura.py#L200-L213 | [
"def",
"total_hits",
"(",
"self",
",",
"filename",
"=",
"None",
")",
":",
"if",
"filename",
"is",
"not",
"None",
":",
"return",
"len",
"(",
"self",
".",
"hit_statements",
"(",
"filename",
")",
")",
"total",
"=",
"0",
"for",
"filename",
"in",
"self",
... | 26e472f1424f5cd499c42232dc5ee12e4042806f |
train | Cobertura.total_statements | Return the total number of statements for the file
`filename`. If `filename` is not given, return the total
number of statements for all files. | pycobertura/cobertura.py | def total_statements(self, filename=None):
"""
Return the total number of statements for the file
`filename`. If `filename` is not given, return the total
number of statements for all files.
"""
if filename is not None:
statements = self._get_lines_by_filename... | def total_statements(self, filename=None):
"""
Return the total number of statements for the file
`filename`. If `filename` is not given, return the total
number of statements for all files.
"""
if filename is not None:
statements = self._get_lines_by_filename... | [
"Return",
"the",
"total",
"number",
"of",
"statements",
"for",
"the",
"file",
"filename",
".",
"If",
"filename",
"is",
"not",
"given",
"return",
"the",
"total",
"number",
"of",
"statements",
"for",
"all",
"files",
"."
] | aconrad/pycobertura | python | https://github.com/aconrad/pycobertura/blob/26e472f1424f5cd499c42232dc5ee12e4042806f/pycobertura/cobertura.py#L215-L230 | [
"def",
"total_statements",
"(",
"self",
",",
"filename",
"=",
"None",
")",
":",
"if",
"filename",
"is",
"not",
"None",
":",
"statements",
"=",
"self",
".",
"_get_lines_by_filename",
"(",
"filename",
")",
"return",
"len",
"(",
"statements",
")",
"total",
"=... | 26e472f1424f5cd499c42232dc5ee12e4042806f |
train | Cobertura.files | Return the list of available files in the coverage report. | pycobertura/cobertura.py | def files(self):
"""
Return the list of available files in the coverage report.
"""
# maybe replace with a trie at some point? see has_file FIXME
already_seen = set()
filenames = []
for el in self.xml.xpath("//class"):
filename = el.attrib['filename']... | def files(self):
"""
Return the list of available files in the coverage report.
"""
# maybe replace with a trie at some point? see has_file FIXME
already_seen = set()
filenames = []
for el in self.xml.xpath("//class"):
filename = el.attrib['filename']... | [
"Return",
"the",
"list",
"of",
"available",
"files",
"in",
"the",
"coverage",
"report",
"."
] | aconrad/pycobertura | python | https://github.com/aconrad/pycobertura/blob/26e472f1424f5cd499c42232dc5ee12e4042806f/pycobertura/cobertura.py#L233-L248 | [
"def",
"files",
"(",
"self",
")",
":",
"# maybe replace with a trie at some point? see has_file FIXME",
"already_seen",
"=",
"set",
"(",
")",
"filenames",
"=",
"[",
"]",
"for",
"el",
"in",
"self",
".",
"xml",
".",
"xpath",
"(",
"\"//class\"",
")",
":",
"filena... | 26e472f1424f5cd499c42232dc5ee12e4042806f |
train | Cobertura.source_lines | Return a list for source lines of file `filename`. | pycobertura/cobertura.py | def source_lines(self, filename):
"""
Return a list for source lines of file `filename`.
"""
with self.filesystem.open(filename) as f:
return f.readlines() | def source_lines(self, filename):
"""
Return a list for source lines of file `filename`.
"""
with self.filesystem.open(filename) as f:
return f.readlines() | [
"Return",
"a",
"list",
"for",
"source",
"lines",
"of",
"file",
"filename",
"."
] | aconrad/pycobertura | python | https://github.com/aconrad/pycobertura/blob/26e472f1424f5cd499c42232dc5ee12e4042806f/pycobertura/cobertura.py#L259-L264 | [
"def",
"source_lines",
"(",
"self",
",",
"filename",
")",
":",
"with",
"self",
".",
"filesystem",
".",
"open",
"(",
"filename",
")",
"as",
"f",
":",
"return",
"f",
".",
"readlines",
"(",
")"
] | 26e472f1424f5cd499c42232dc5ee12e4042806f |
train | CoberturaDiff.has_better_coverage | Return `True` if coverage of has improved, `False` otherwise.
This does not ensure that all changes have been covered. If this is
what you want, use `CoberturaDiff.has_all_changes_covered()` instead. | pycobertura/cobertura.py | def has_better_coverage(self):
"""
Return `True` if coverage of has improved, `False` otherwise.
This does not ensure that all changes have been covered. If this is
what you want, use `CoberturaDiff.has_all_changes_covered()` instead.
"""
for filename in self.files():
... | def has_better_coverage(self):
"""
Return `True` if coverage of has improved, `False` otherwise.
This does not ensure that all changes have been covered. If this is
what you want, use `CoberturaDiff.has_all_changes_covered()` instead.
"""
for filename in self.files():
... | [
"Return",
"True",
"if",
"coverage",
"of",
"has",
"improved",
"False",
"otherwise",
"."
] | aconrad/pycobertura | python | https://github.com/aconrad/pycobertura/blob/26e472f1424f5cd499c42232dc5ee12e4042806f/pycobertura/cobertura.py#L282-L292 | [
"def",
"has_better_coverage",
"(",
"self",
")",
":",
"for",
"filename",
"in",
"self",
".",
"files",
"(",
")",
":",
"if",
"self",
".",
"diff_total_misses",
"(",
"filename",
")",
">",
"0",
":",
"return",
"False",
"return",
"True"
] | 26e472f1424f5cd499c42232dc5ee12e4042806f |
train | CoberturaDiff.has_all_changes_covered | Return `True` if all changes have been covered, `False` otherwise. | pycobertura/cobertura.py | def has_all_changes_covered(self):
"""
Return `True` if all changes have been covered, `False` otherwise.
"""
for filename in self.files():
for hunk in self.file_source_hunks(filename):
for line in hunk:
if line.reason is None:
... | def has_all_changes_covered(self):
"""
Return `True` if all changes have been covered, `False` otherwise.
"""
for filename in self.files():
for hunk in self.file_source_hunks(filename):
for line in hunk:
if line.reason is None:
... | [
"Return",
"True",
"if",
"all",
"changes",
"have",
"been",
"covered",
"False",
"otherwise",
"."
] | aconrad/pycobertura | python | https://github.com/aconrad/pycobertura/blob/26e472f1424f5cd499c42232dc5ee12e4042806f/pycobertura/cobertura.py#L294-L305 | [
"def",
"has_all_changes_covered",
"(",
"self",
")",
":",
"for",
"filename",
"in",
"self",
".",
"files",
"(",
")",
":",
"for",
"hunk",
"in",
"self",
".",
"file_source_hunks",
"(",
"filename",
")",
":",
"for",
"line",
"in",
"hunk",
":",
"if",
"line",
"."... | 26e472f1424f5cd499c42232dc5ee12e4042806f |
train | CoberturaDiff._diff_attr | Return the difference between
`self.cobertura2.<attr_name>(filename)` and
`self.cobertura1.<attr_name>(filename)`.
This generic method is meant to diff the count of methods that return
counts for a given file `filename`, e.g. `Cobertura.total_statements`,
`Cobertura.total_misses... | pycobertura/cobertura.py | def _diff_attr(self, attr_name, filename):
"""
Return the difference between
`self.cobertura2.<attr_name>(filename)` and
`self.cobertura1.<attr_name>(filename)`.
This generic method is meant to diff the count of methods that return
counts for a given file `filename`, e.g... | def _diff_attr(self, attr_name, filename):
"""
Return the difference between
`self.cobertura2.<attr_name>(filename)` and
`self.cobertura1.<attr_name>(filename)`.
This generic method is meant to diff the count of methods that return
counts for a given file `filename`, e.g... | [
"Return",
"the",
"difference",
"between",
"self",
".",
"cobertura2",
".",
"<attr_name",
">",
"(",
"filename",
")",
"and",
"self",
".",
"cobertura1",
".",
"<attr_name",
">",
"(",
"filename",
")",
"."
] | aconrad/pycobertura | python | https://github.com/aconrad/pycobertura/blob/26e472f1424f5cd499c42232dc5ee12e4042806f/pycobertura/cobertura.py#L307-L335 | [
"def",
"_diff_attr",
"(",
"self",
",",
"attr_name",
",",
"filename",
")",
":",
"if",
"filename",
"is",
"not",
"None",
":",
"files",
"=",
"[",
"filename",
"]",
"else",
":",
"files",
"=",
"self",
".",
"files",
"(",
")",
"total_count",
"=",
"0.0",
"for"... | 26e472f1424f5cd499c42232dc5ee12e4042806f |
train | CoberturaDiff.diff_missed_lines | Return a list of 2-element tuples `(lineno, is_new)` for the given
file `filename` where `lineno` is a missed line number and `is_new`
indicates whether the missed line was introduced (True) or removed
(False). | pycobertura/cobertura.py | def diff_missed_lines(self, filename):
"""
Return a list of 2-element tuples `(lineno, is_new)` for the given
file `filename` where `lineno` is a missed line number and `is_new`
indicates whether the missed line was introduced (True) or removed
(False).
"""
line_c... | def diff_missed_lines(self, filename):
"""
Return a list of 2-element tuples `(lineno, is_new)` for the given
file `filename` where `lineno` is a missed line number and `is_new`
indicates whether the missed line was introduced (True) or removed
(False).
"""
line_c... | [
"Return",
"a",
"list",
"of",
"2",
"-",
"element",
"tuples",
"(",
"lineno",
"is_new",
")",
"for",
"the",
"given",
"file",
"filename",
"where",
"lineno",
"is",
"a",
"missed",
"line",
"number",
"and",
"is_new",
"indicates",
"whether",
"the",
"missed",
"line",... | aconrad/pycobertura | python | https://github.com/aconrad/pycobertura/blob/26e472f1424f5cd499c42232dc5ee12e4042806f/pycobertura/cobertura.py#L351-L363 | [
"def",
"diff_missed_lines",
"(",
"self",
",",
"filename",
")",
":",
"line_changed",
"=",
"[",
"]",
"for",
"line",
"in",
"self",
".",
"file_source",
"(",
"filename",
")",
":",
"if",
"line",
".",
"status",
"is",
"not",
"None",
":",
"is_new",
"=",
"not",
... | 26e472f1424f5cd499c42232dc5ee12e4042806f |
train | CoberturaDiff.file_source | Return a list of namedtuple `Line` for each line of code found in the
given file `filename`. | pycobertura/cobertura.py | def file_source(self, filename):
"""
Return a list of namedtuple `Line` for each line of code found in the
given file `filename`.
"""
if self.cobertura1.has_file(filename) and \
self.cobertura1.filesystem.has_file(filename):
lines1 = self.cobertura1.s... | def file_source(self, filename):
"""
Return a list of namedtuple `Line` for each line of code found in the
given file `filename`.
"""
if self.cobertura1.has_file(filename) and \
self.cobertura1.filesystem.has_file(filename):
lines1 = self.cobertura1.s... | [
"Return",
"a",
"list",
"of",
"namedtuple",
"Line",
"for",
"each",
"line",
"of",
"code",
"found",
"in",
"the",
"given",
"file",
"filename",
"."
] | aconrad/pycobertura | python | https://github.com/aconrad/pycobertura/blob/26e472f1424f5cd499c42232dc5ee12e4042806f/pycobertura/cobertura.py#L371-L418 | [
"def",
"file_source",
"(",
"self",
",",
"filename",
")",
":",
"if",
"self",
".",
"cobertura1",
".",
"has_file",
"(",
"filename",
")",
"and",
"self",
".",
"cobertura1",
".",
"filesystem",
".",
"has_file",
"(",
"filename",
")",
":",
"lines1",
"=",
"self",
... | 26e472f1424f5cd499c42232dc5ee12e4042806f |
train | CoberturaDiff.file_source_hunks | Like `CoberturaDiff.file_source`, but returns a list of line hunks of
the lines that have changed for the given file `filename`. An empty
list means that the file has no lines that have a change in coverage
status. | pycobertura/cobertura.py | def file_source_hunks(self, filename):
"""
Like `CoberturaDiff.file_source`, but returns a list of line hunks of
the lines that have changed for the given file `filename`. An empty
list means that the file has no lines that have a change in coverage
status.
"""
li... | def file_source_hunks(self, filename):
"""
Like `CoberturaDiff.file_source`, but returns a list of line hunks of
the lines that have changed for the given file `filename`. An empty
list means that the file has no lines that have a change in coverage
status.
"""
li... | [
"Like",
"CoberturaDiff",
".",
"file_source",
"but",
"returns",
"a",
"list",
"of",
"line",
"hunks",
"of",
"the",
"lines",
"that",
"have",
"changed",
"for",
"the",
"given",
"file",
"filename",
".",
"An",
"empty",
"list",
"means",
"that",
"the",
"file",
"has"... | aconrad/pycobertura | python | https://github.com/aconrad/pycobertura/blob/26e472f1424f5cd499c42232dc5ee12e4042806f/pycobertura/cobertura.py#L420-L429 | [
"def",
"file_source_hunks",
"(",
"self",
",",
"filename",
")",
":",
"lines",
"=",
"self",
".",
"file_source",
"(",
"filename",
")",
"hunks",
"=",
"hunkify_lines",
"(",
"lines",
")",
"return",
"hunks"
] | 26e472f1424f5cd499c42232dc5ee12e4042806f |
train | KinesisProducer.monitor | Flushes the queue periodically. | kiner/producer.py | def monitor(self):
"""Flushes the queue periodically."""
while self.monitor_running.is_set():
if time.time() - self.last_flush > self.batch_time:
if not self.queue.empty():
logger.info("Queue Flush: time without flush exceeded")
self.fl... | def monitor(self):
"""Flushes the queue periodically."""
while self.monitor_running.is_set():
if time.time() - self.last_flush > self.batch_time:
if not self.queue.empty():
logger.info("Queue Flush: time without flush exceeded")
self.fl... | [
"Flushes",
"the",
"queue",
"periodically",
"."
] | bufferapp/kiner | python | https://github.com/bufferapp/kiner/blob/c4c6e7ef24e5600864d0bdc4c8b967b339245238/kiner/producer.py#L63-L70 | [
"def",
"monitor",
"(",
"self",
")",
":",
"while",
"self",
".",
"monitor_running",
".",
"is_set",
"(",
")",
":",
"if",
"time",
".",
"time",
"(",
")",
"-",
"self",
".",
"last_flush",
">",
"self",
".",
"batch_time",
":",
"if",
"not",
"self",
".",
"que... | c4c6e7ef24e5600864d0bdc4c8b967b339245238 |
train | KinesisProducer.put_records | Add a list of data records to the record queue in the proper format.
Convinience method that calls self.put_record for each element.
Parameters
----------
records : list
Lists of records to send.
partition_key: str
Hash that determines which shard a given... | kiner/producer.py | def put_records(self, records, partition_key=None):
"""Add a list of data records to the record queue in the proper format.
Convinience method that calls self.put_record for each element.
Parameters
----------
records : list
Lists of records to send.
partitio... | def put_records(self, records, partition_key=None):
"""Add a list of data records to the record queue in the proper format.
Convinience method that calls self.put_record for each element.
Parameters
----------
records : list
Lists of records to send.
partitio... | [
"Add",
"a",
"list",
"of",
"data",
"records",
"to",
"the",
"record",
"queue",
"in",
"the",
"proper",
"format",
".",
"Convinience",
"method",
"that",
"calls",
"self",
".",
"put_record",
"for",
"each",
"element",
"."
] | bufferapp/kiner | python | https://github.com/bufferapp/kiner/blob/c4c6e7ef24e5600864d0bdc4c8b967b339245238/kiner/producer.py#L72-L85 | [
"def",
"put_records",
"(",
"self",
",",
"records",
",",
"partition_key",
"=",
"None",
")",
":",
"for",
"record",
"in",
"records",
":",
"self",
".",
"put_record",
"(",
"record",
",",
"partition_key",
")"
] | c4c6e7ef24e5600864d0bdc4c8b967b339245238 |
train | KinesisProducer.put_record | Add data to the record queue in the proper format.
Parameters
----------
data : str
Data to send.
partition_key: str
Hash that determines which shard a given data record belongs to. | kiner/producer.py | def put_record(self, data, partition_key=None):
"""Add data to the record queue in the proper format.
Parameters
----------
data : str
Data to send.
partition_key: str
Hash that determines which shard a given data record belongs to.
"""
#... | def put_record(self, data, partition_key=None):
"""Add data to the record queue in the proper format.
Parameters
----------
data : str
Data to send.
partition_key: str
Hash that determines which shard a given data record belongs to.
"""
#... | [
"Add",
"data",
"to",
"the",
"record",
"queue",
"in",
"the",
"proper",
"format",
"."
] | bufferapp/kiner | python | https://github.com/bufferapp/kiner/blob/c4c6e7ef24e5600864d0bdc4c8b967b339245238/kiner/producer.py#L87-L118 | [
"def",
"put_record",
"(",
"self",
",",
"data",
",",
"partition_key",
"=",
"None",
")",
":",
"# Byte encode the data",
"data",
"=",
"encode_data",
"(",
"data",
")",
"# Create a random partition key if not provided",
"if",
"not",
"partition_key",
":",
"partition_key",
... | c4c6e7ef24e5600864d0bdc4c8b967b339245238 |
train | KinesisProducer.close | Flushes the queue and waits for the executor to finish. | kiner/producer.py | def close(self):
"""Flushes the queue and waits for the executor to finish."""
logger.info('Closing producer')
self.flush_queue()
self.monitor_running.clear()
self.pool.shutdown()
logger.info('Producer closed') | def close(self):
"""Flushes the queue and waits for the executor to finish."""
logger.info('Closing producer')
self.flush_queue()
self.monitor_running.clear()
self.pool.shutdown()
logger.info('Producer closed') | [
"Flushes",
"the",
"queue",
"and",
"waits",
"for",
"the",
"executor",
"to",
"finish",
"."
] | bufferapp/kiner | python | https://github.com/bufferapp/kiner/blob/c4c6e7ef24e5600864d0bdc4c8b967b339245238/kiner/producer.py#L120-L126 | [
"def",
"close",
"(",
"self",
")",
":",
"logger",
".",
"info",
"(",
"'Closing producer'",
")",
"self",
".",
"flush_queue",
"(",
")",
"self",
".",
"monitor_running",
".",
"clear",
"(",
")",
"self",
".",
"pool",
".",
"shutdown",
"(",
")",
"logger",
".",
... | c4c6e7ef24e5600864d0bdc4c8b967b339245238 |
train | KinesisProducer.flush_queue | Grab all the current records in the queue and send them. | kiner/producer.py | def flush_queue(self):
"""Grab all the current records in the queue and send them."""
records = []
while not self.queue.empty() and len(records) < self.batch_size:
records.append(self.queue.get())
if records:
self.send_records(records)
self.last_flus... | def flush_queue(self):
"""Grab all the current records in the queue and send them."""
records = []
while not self.queue.empty() and len(records) < self.batch_size:
records.append(self.queue.get())
if records:
self.send_records(records)
self.last_flus... | [
"Grab",
"all",
"the",
"current",
"records",
"in",
"the",
"queue",
"and",
"send",
"them",
"."
] | bufferapp/kiner | python | https://github.com/bufferapp/kiner/blob/c4c6e7ef24e5600864d0bdc4c8b967b339245238/kiner/producer.py#L128-L137 | [
"def",
"flush_queue",
"(",
"self",
")",
":",
"records",
"=",
"[",
"]",
"while",
"not",
"self",
".",
"queue",
".",
"empty",
"(",
")",
"and",
"len",
"(",
"records",
")",
"<",
"self",
".",
"batch_size",
":",
"records",
".",
"append",
"(",
"self",
".",... | c4c6e7ef24e5600864d0bdc4c8b967b339245238 |
train | KinesisProducer.send_records | Send records to the Kinesis stream.
Falied records are sent again with an exponential backoff decay.
Parameters
----------
records : array
Array of formated records to send.
attempt: int
Number of times the records have been sent without success. | kiner/producer.py | def send_records(self, records, attempt=0):
"""Send records to the Kinesis stream.
Falied records are sent again with an exponential backoff decay.
Parameters
----------
records : array
Array of formated records to send.
attempt: int
Number of ti... | def send_records(self, records, attempt=0):
"""Send records to the Kinesis stream.
Falied records are sent again with an exponential backoff decay.
Parameters
----------
records : array
Array of formated records to send.
attempt: int
Number of ti... | [
"Send",
"records",
"to",
"the",
"Kinesis",
"stream",
"."
] | bufferapp/kiner | python | https://github.com/bufferapp/kiner/blob/c4c6e7ef24e5600864d0bdc4c8b967b339245238/kiner/producer.py#L139-L178 | [
"def",
"send_records",
"(",
"self",
",",
"records",
",",
"attempt",
"=",
"0",
")",
":",
"# If we already tried more times than we wanted, save to a file",
"if",
"attempt",
">",
"self",
".",
"max_retries",
":",
"logger",
".",
"warning",
"(",
"'Writing {} records to fil... | c4c6e7ef24e5600864d0bdc4c8b967b339245238 |
train | rangify | Assumes the list is sorted. | pycobertura/utils.py | def rangify(number_list):
"""Assumes the list is sorted."""
if not number_list:
return number_list
ranges = []
range_start = prev_num = number_list[0]
for num in number_list[1:]:
if num != (prev_num + 1):
ranges.append((range_start, prev_num))
range_start = ... | def rangify(number_list):
"""Assumes the list is sorted."""
if not number_list:
return number_list
ranges = []
range_start = prev_num = number_list[0]
for num in number_list[1:]:
if num != (prev_num + 1):
ranges.append((range_start, prev_num))
range_start = ... | [
"Assumes",
"the",
"list",
"is",
"sorted",
"."
] | aconrad/pycobertura | python | https://github.com/aconrad/pycobertura/blob/26e472f1424f5cd499c42232dc5ee12e4042806f/pycobertura/utils.py#L61-L76 | [
"def",
"rangify",
"(",
"number_list",
")",
":",
"if",
"not",
"number_list",
":",
"return",
"number_list",
"ranges",
"=",
"[",
"]",
"range_start",
"=",
"prev_num",
"=",
"number_list",
"[",
"0",
"]",
"for",
"num",
"in",
"number_list",
"[",
"1",
":",
"]",
... | 26e472f1424f5cd499c42232dc5ee12e4042806f |
train | extrapolate_coverage | Given the following input:
>>> lines_w_status = [
(1, True),
(4, True),
(7, False),
(9, False),
]
Return expanded lines with their extrapolated line status.
>>> extrapolate_coverage(lines_w_status) == [
(1, True),
(2, True),
(3, True),
(... | pycobertura/utils.py | def extrapolate_coverage(lines_w_status):
"""
Given the following input:
>>> lines_w_status = [
(1, True),
(4, True),
(7, False),
(9, False),
]
Return expanded lines with their extrapolated line status.
>>> extrapolate_coverage(lines_w_status) == [
(1, ... | def extrapolate_coverage(lines_w_status):
"""
Given the following input:
>>> lines_w_status = [
(1, True),
(4, True),
(7, False),
(9, False),
]
Return expanded lines with their extrapolated line status.
>>> extrapolate_coverage(lines_w_status) == [
(1, ... | [
"Given",
"the",
"following",
"input",
":"
] | aconrad/pycobertura | python | https://github.com/aconrad/pycobertura/blob/26e472f1424f5cd499c42232dc5ee12e4042806f/pycobertura/utils.py#L79-L120 | [
"def",
"extrapolate_coverage",
"(",
"lines_w_status",
")",
":",
"lines",
"=",
"[",
"]",
"prev_lineno",
"=",
"0",
"prev_status",
"=",
"True",
"for",
"lineno",
",",
"status",
"in",
"lines_w_status",
":",
"while",
"(",
"lineno",
"-",
"prev_lineno",
")",
">",
... | 26e472f1424f5cd499c42232dc5ee12e4042806f |
train | reconcile_lines | Return a dict `{lineno1: lineno2}` which reconciles line numbers `lineno1`
of list `lines1` to line numbers `lineno2` of list `lines2`. Only lines
that are common in both sets are present in the dict, lines unique to one
of the sets are omitted. | pycobertura/utils.py | def reconcile_lines(lines1, lines2):
"""
Return a dict `{lineno1: lineno2}` which reconciles line numbers `lineno1`
of list `lines1` to line numbers `lineno2` of list `lines2`. Only lines
that are common in both sets are present in the dict, lines unique to one
of the sets are omitted.
"""
d... | def reconcile_lines(lines1, lines2):
"""
Return a dict `{lineno1: lineno2}` which reconciles line numbers `lineno1`
of list `lines1` to line numbers `lineno2` of list `lines2`. Only lines
that are common in both sets are present in the dict, lines unique to one
of the sets are omitted.
"""
d... | [
"Return",
"a",
"dict",
"{",
"lineno1",
":",
"lineno2",
"}",
"which",
"reconciles",
"line",
"numbers",
"lineno1",
"of",
"list",
"lines1",
"to",
"line",
"numbers",
"lineno2",
"of",
"list",
"lines2",
".",
"Only",
"lines",
"that",
"are",
"common",
"in",
"both"... | aconrad/pycobertura | python | https://github.com/aconrad/pycobertura/blob/26e472f1424f5cd499c42232dc5ee12e4042806f/pycobertura/utils.py#L123-L159 | [
"def",
"reconcile_lines",
"(",
"lines1",
",",
"lines2",
")",
":",
"differ",
"=",
"difflib",
".",
"Differ",
"(",
")",
"diff",
"=",
"differ",
".",
"compare",
"(",
"lines1",
",",
"lines2",
")",
"SAME",
"=",
"' '",
"ADDED",
"=",
"'+ '",
"REMOVED",
"=",
... | 26e472f1424f5cd499c42232dc5ee12e4042806f |
train | hunkify_lines | Return a list of line hunks given a list of lines `lines`. The number of
context lines can be control with `context` which will return line hunks
surrounded with `context` lines before and after the code change. | pycobertura/utils.py | def hunkify_lines(lines, context=3):
"""
Return a list of line hunks given a list of lines `lines`. The number of
context lines can be control with `context` which will return line hunks
surrounded with `context` lines before and after the code change.
"""
# Find contiguous line changes
rang... | def hunkify_lines(lines, context=3):
"""
Return a list of line hunks given a list of lines `lines`. The number of
context lines can be control with `context` which will return line hunks
surrounded with `context` lines before and after the code change.
"""
# Find contiguous line changes
rang... | [
"Return",
"a",
"list",
"of",
"line",
"hunks",
"given",
"a",
"list",
"of",
"lines",
"lines",
".",
"The",
"number",
"of",
"context",
"lines",
"can",
"be",
"control",
"with",
"context",
"which",
"will",
"return",
"line",
"hunks",
"surrounded",
"with",
"contex... | aconrad/pycobertura | python | https://github.com/aconrad/pycobertura/blob/26e472f1424f5cd499c42232dc5ee12e4042806f/pycobertura/utils.py#L162-L210 | [
"def",
"hunkify_lines",
"(",
"lines",
",",
"context",
"=",
"3",
")",
":",
"# Find contiguous line changes",
"ranges",
"=",
"[",
"]",
"range_start",
"=",
"None",
"for",
"i",
",",
"line",
"in",
"enumerate",
"(",
"lines",
")",
":",
"if",
"line",
".",
"statu... | 26e472f1424f5cd499c42232dc5ee12e4042806f |
train | show | show coverage summary of a Cobertura report | pycobertura/cli.py | def show(cobertura_file, format, output, source, source_prefix):
"""show coverage summary of a Cobertura report"""
cobertura = Cobertura(cobertura_file, source=source)
Reporter = reporters[format]
reporter = Reporter(cobertura)
report = reporter.generate()
if not isinstance(report, bytes):
... | def show(cobertura_file, format, output, source, source_prefix):
"""show coverage summary of a Cobertura report"""
cobertura = Cobertura(cobertura_file, source=source)
Reporter = reporters[format]
reporter = Reporter(cobertura)
report = reporter.generate()
if not isinstance(report, bytes):
... | [
"show",
"coverage",
"summary",
"of",
"a",
"Cobertura",
"report"
] | aconrad/pycobertura | python | https://github.com/aconrad/pycobertura/blob/26e472f1424f5cd499c42232dc5ee12e4042806f/pycobertura/cli.py#L65-L76 | [
"def",
"show",
"(",
"cobertura_file",
",",
"format",
",",
"output",
",",
"source",
",",
"source_prefix",
")",
":",
"cobertura",
"=",
"Cobertura",
"(",
"cobertura_file",
",",
"source",
"=",
"source",
")",
"Reporter",
"=",
"reporters",
"[",
"format",
"]",
"r... | 26e472f1424f5cd499c42232dc5ee12e4042806f |
train | diff | compare coverage of two Cobertura reports | pycobertura/cli.py | def diff(
cobertura_file1, cobertura_file2,
color, format, output, source1, source2,
source_prefix1, source_prefix2, source):
"""compare coverage of two Cobertura reports"""
cobertura1 = Cobertura(
cobertura_file1,
source=source1,
source_prefix=source_prefix1
... | def diff(
cobertura_file1, cobertura_file2,
color, format, output, source1, source2,
source_prefix1, source_prefix2, source):
"""compare coverage of two Cobertura reports"""
cobertura1 = Cobertura(
cobertura_file1,
source=source1,
source_prefix=source_prefix1
... | [
"compare",
"coverage",
"of",
"two",
"Cobertura",
"reports"
] | aconrad/pycobertura | python | https://github.com/aconrad/pycobertura/blob/26e472f1424f5cd499c42232dc5ee12e4042806f/pycobertura/cli.py#L141-L176 | [
"def",
"diff",
"(",
"cobertura_file1",
",",
"cobertura_file2",
",",
"color",
",",
"format",
",",
"output",
",",
"source1",
",",
"source2",
",",
"source_prefix1",
",",
"source_prefix2",
",",
"source",
")",
":",
"cobertura1",
"=",
"Cobertura",
"(",
"cobertura_fi... | 26e472f1424f5cd499c42232dc5ee12e4042806f |
train | DirectoryFileSystem.open | Yield a file-like object for file `filename`.
This function is a context manager. | pycobertura/filesystem.py | def open(self, filename):
"""
Yield a file-like object for file `filename`.
This function is a context manager.
"""
filename = self.real_filename(filename)
if not os.path.exists(filename):
raise self.FileNotFound(filename)
with codecs.open(filename,... | def open(self, filename):
"""
Yield a file-like object for file `filename`.
This function is a context manager.
"""
filename = self.real_filename(filename)
if not os.path.exists(filename):
raise self.FileNotFound(filename)
with codecs.open(filename,... | [
"Yield",
"a",
"file",
"-",
"like",
"object",
"for",
"file",
"filename",
"."
] | aconrad/pycobertura | python | https://github.com/aconrad/pycobertura/blob/26e472f1424f5cd499c42232dc5ee12e4042806f/pycobertura/filesystem.py#L31-L43 | [
"def",
"open",
"(",
"self",
",",
"filename",
")",
":",
"filename",
"=",
"self",
".",
"real_filename",
"(",
"filename",
")",
"if",
"not",
"os",
".",
"path",
".",
"exists",
"(",
"filename",
")",
":",
"raise",
"self",
".",
"FileNotFound",
"(",
"filename",... | 26e472f1424f5cd499c42232dc5ee12e4042806f |
train | PyrosClient.topic_inject | Injecting message into topic. if _msg_content, we inject it directly. if not, we use all extra kwargs
:param topic_name: name of the topic
:param _msg_content: optional message content
:param kwargs: each extra kwarg will be put int he message is structure matches
:return: | pyros/client/client.py | def topic_inject(self, topic_name, _msg_content=None, **kwargs):
"""
Injecting message into topic. if _msg_content, we inject it directly. if not, we use all extra kwargs
:param topic_name: name of the topic
:param _msg_content: optional message content
:param kwargs: each extra ... | def topic_inject(self, topic_name, _msg_content=None, **kwargs):
"""
Injecting message into topic. if _msg_content, we inject it directly. if not, we use all extra kwargs
:param topic_name: name of the topic
:param _msg_content: optional message content
:param kwargs: each extra ... | [
"Injecting",
"message",
"into",
"topic",
".",
"if",
"_msg_content",
"we",
"inject",
"it",
"directly",
".",
"if",
"not",
"we",
"use",
"all",
"extra",
"kwargs",
":",
"param",
"topic_name",
":",
"name",
"of",
"the",
"topic",
":",
"param",
"_msg_content",
":",... | pyros-dev/pyros | python | https://github.com/pyros-dev/pyros/blob/59f6c8848a66481a4039cbf28b7673428181842e/pyros/client/client.py#L111-L130 | [
"def",
"topic_inject",
"(",
"self",
",",
"topic_name",
",",
"_msg_content",
"=",
"None",
",",
"*",
"*",
"kwargs",
")",
":",
"#changing unicode to string ( testing stability of multiprocess debugging )",
"if",
"isinstance",
"(",
"topic_name",
",",
"unicode",
")",
":",
... | 59f6c8848a66481a4039cbf28b7673428181842e |
train | PyrosClient.param_set | Setting parameter. if _value, we inject it directly. if not, we use all extra kwargs
:param topic_name: name of the topic
:param _value: optional value
:param kwargs: each extra kwarg will be put in the value if structure matches
:return: | pyros/client/client.py | def param_set(self, param_name, _value=None, **kwargs):
"""
Setting parameter. if _value, we inject it directly. if not, we use all extra kwargs
:param topic_name: name of the topic
:param _value: optional value
:param kwargs: each extra kwarg will be put in the value if structur... | def param_set(self, param_name, _value=None, **kwargs):
"""
Setting parameter. if _value, we inject it directly. if not, we use all extra kwargs
:param topic_name: name of the topic
:param _value: optional value
:param kwargs: each extra kwarg will be put in the value if structur... | [
"Setting",
"parameter",
".",
"if",
"_value",
"we",
"inject",
"it",
"directly",
".",
"if",
"not",
"we",
"use",
"all",
"extra",
"kwargs",
":",
"param",
"topic_name",
":",
"name",
"of",
"the",
"topic",
":",
"param",
"_value",
":",
"optional",
"value",
":",
... | pyros-dev/pyros | python | https://github.com/pyros-dev/pyros/blob/59f6c8848a66481a4039cbf28b7673428181842e/pyros/client/client.py#L165-L187 | [
"def",
"param_set",
"(",
"self",
",",
"param_name",
",",
"_value",
"=",
"None",
",",
"*",
"*",
"kwargs",
")",
":",
"#changing unicode to string ( testing stability of multiprocess debugging )",
"if",
"isinstance",
"(",
"param_name",
",",
"unicode",
")",
":",
"param_... | 59f6c8848a66481a4039cbf28b7673428181842e |
train | PrepareReleaseCommand.run | runner | setup.py | def run(self):
"""runner"""
# change version in code and changelog before running this
subprocess.check_call("git commit CHANGELOG.rst pyros/_version.py CHANGELOG.rst -m 'v{0}'".format(__version__), shell=True)
subprocess.check_call("git push", shell=True)
print("You should ver... | def run(self):
"""runner"""
# change version in code and changelog before running this
subprocess.check_call("git commit CHANGELOG.rst pyros/_version.py CHANGELOG.rst -m 'v{0}'".format(__version__), shell=True)
subprocess.check_call("git push", shell=True)
print("You should ver... | [
"runner"
] | pyros-dev/pyros | python | https://github.com/pyros-dev/pyros/blob/59f6c8848a66481a4039cbf28b7673428181842e/setup.py#L40-L49 | [
"def",
"run",
"(",
"self",
")",
":",
"# change version in code and changelog before running this",
"subprocess",
".",
"check_call",
"(",
"\"git commit CHANGELOG.rst pyros/_version.py CHANGELOG.rst -m 'v{0}'\"",
".",
"format",
"(",
"__version__",
")",
",",
"shell",
"=",
"True"... | 59f6c8848a66481a4039cbf28b7673428181842e |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.