Search is not available for this dataset
identifier stringlengths 1 155 | parameters stringlengths 2 6.09k | docstring stringlengths 11 63.4k | docstring_summary stringlengths 0 63.4k | function stringlengths 29 99.8k | function_tokens list | start_point list | end_point list | language stringclasses 1
value | docstring_language stringlengths 2 7 | docstring_language_predictions stringlengths 18 23 | is_langid_reliable stringclasses 2
values |
|---|---|---|---|---|---|---|---|---|---|---|---|
PageQuerySet.not_type | (self, *types) |
This filters the QuerySet to exclude any pages which are an instance of the specified model(s).
|
This filters the QuerySet to exclude any pages which are an instance of the specified model(s).
| def not_type(self, *types):
"""
This filters the QuerySet to exclude any pages which are an instance of the specified model(s).
"""
return self.exclude(self.type_q(*types)) | [
"def",
"not_type",
"(",
"self",
",",
"*",
"types",
")",
":",
"return",
"self",
".",
"exclude",
"(",
"self",
".",
"type_q",
"(",
"*",
"types",
")",
")"
] | [
211,
4
] | [
215,
48
] | python | en | ['en', 'error', 'th'] | False |
PageQuerySet.exact_type | (self, *types) |
This filters the QuerySet to only contain pages that are an instance of the specified model(s)
(matching the model exactly, not subclasses).
|
This filters the QuerySet to only contain pages that are an instance of the specified model(s)
(matching the model exactly, not subclasses).
| def exact_type(self, *types):
"""
This filters the QuerySet to only contain pages that are an instance of the specified model(s)
(matching the model exactly, not subclasses).
"""
return self.filter(self.exact_type_q(*types)) | [
"def",
"exact_type",
"(",
"self",
",",
"*",
"types",
")",
":",
"return",
"self",
".",
"filter",
"(",
"self",
".",
"exact_type_q",
"(",
"*",
"types",
")",
")"
] | [
221,
4
] | [
226,
53
] | python | en | ['en', 'error', 'th'] | False |
PageQuerySet.not_exact_type | (self, *types) |
This filters the QuerySet to exclude any pages which are an instance of the specified model(s)
(matching the model exactly, not subclasses).
|
This filters the QuerySet to exclude any pages which are an instance of the specified model(s)
(matching the model exactly, not subclasses).
| def not_exact_type(self, *types):
"""
This filters the QuerySet to exclude any pages which are an instance of the specified model(s)
(matching the model exactly, not subclasses).
"""
return self.exclude(self.exact_type_q(*types)) | [
"def",
"not_exact_type",
"(",
"self",
",",
"*",
"types",
")",
":",
"return",
"self",
".",
"exclude",
"(",
"self",
".",
"exact_type_q",
"(",
"*",
"types",
")",
")"
] | [
228,
4
] | [
233,
54
] | python | en | ['en', 'error', 'th'] | False |
PageQuerySet.public | (self) |
This filters the QuerySet to only contain pages that are not in a private section
|
This filters the QuerySet to only contain pages that are not in a private section
| def public(self):
"""
This filters the QuerySet to only contain pages that are not in a private section
"""
return self.filter(self.public_q()) | [
"def",
"public",
"(",
"self",
")",
":",
"return",
"self",
".",
"filter",
"(",
"self",
".",
"public_q",
"(",
")",
")"
] | [
243,
4
] | [
247,
43
] | python | en | ['en', 'error', 'th'] | False |
PageQuerySet.not_public | (self) |
This filters the QuerySet to only contain pages that are in a private section
|
This filters the QuerySet to only contain pages that are in a private section
| def not_public(self):
"""
This filters the QuerySet to only contain pages that are in a private section
"""
return self.exclude(self.public_q()) | [
"def",
"not_public",
"(",
"self",
")",
":",
"return",
"self",
".",
"exclude",
"(",
"self",
".",
"public_q",
"(",
")",
")"
] | [
249,
4
] | [
253,
44
] | python | en | ['en', 'error', 'th'] | False |
PageQuerySet.first_common_ancestor | (self, include_self=False, strict=False) |
Find the first ancestor that all pages in this queryset have in common.
For example, consider a page hierarchy like::
- Home/
- Foo Event Index/
- Foo Event Page 1/
- Foo Event Page 2/
- Bar Event Index/
... |
Find the first ancestor that all pages in this queryset have in common.
For example, consider a page hierarchy like:: | def first_common_ancestor(self, include_self=False, strict=False):
"""
Find the first ancestor that all pages in this queryset have in common.
For example, consider a page hierarchy like::
- Home/
- Foo Event Index/
- Foo Event Page 1/
... | [
"def",
"first_common_ancestor",
"(",
"self",
",",
"include_self",
"=",
"False",
",",
"strict",
"=",
"False",
")",
":",
"# An empty queryset has no ancestors. This is a problem",
"if",
"not",
"self",
".",
"exists",
"(",
")",
":",
"if",
"strict",
":",
"raise",
"se... | [
255,
4
] | [
352,
62
] | python | en | ['en', 'error', 'th'] | False |
PageQuerySet.unpublish | (self) |
This unpublishes all live pages in the QuerySet.
|
This unpublishes all live pages in the QuerySet.
| def unpublish(self):
"""
This unpublishes all live pages in the QuerySet.
"""
for page in self.live():
page.unpublish() | [
"def",
"unpublish",
"(",
"self",
")",
":",
"for",
"page",
"in",
"self",
".",
"live",
"(",
")",
":",
"page",
".",
"unpublish",
"(",
")"
] | [
354,
4
] | [
359,
28
] | python | en | ['en', 'error', 'th'] | False |
PageQuerySet.defer_streamfields | (self) |
Apply to a queryset to prevent fetching/decoding of StreamField values on
evaluation. Useful when working with potentially large numbers of results,
where StreamField values are unlikely to be needed. For example, when
generating a sitemap or a long list of page links.
|
Apply to a queryset to prevent fetching/decoding of StreamField values on
evaluation. Useful when working with potentially large numbers of results,
where StreamField values are unlikely to be needed. For example, when
generating a sitemap or a long list of page links.
| def defer_streamfields(self):
"""
Apply to a queryset to prevent fetching/decoding of StreamField values on
evaluation. Useful when working with potentially large numbers of results,
where StreamField values are unlikely to be needed. For example, when
generating a sitemap or a l... | [
"def",
"defer_streamfields",
"(",
"self",
")",
":",
"clone",
"=",
"self",
".",
"_clone",
"(",
")",
"clone",
".",
"_defer_streamfields",
"=",
"True",
"# used by specific_iterator()",
"streamfield_names",
"=",
"self",
".",
"model",
".",
"get_streamfield_names",
"(",... | [
361,
4
] | [
373,
46
] | python | en | ['en', 'error', 'th'] | False |
PageQuerySet.specific | (self, defer=False) |
This efficiently gets all the specific pages for the queryset, using
the minimum number of queries.
When the "defer" keyword argument is set to True, only generic page
field values will be loaded and all specific fields will be deferred.
|
This efficiently gets all the specific pages for the queryset, using
the minimum number of queries. | def specific(self, defer=False):
"""
This efficiently gets all the specific pages for the queryset, using
the minimum number of queries.
When the "defer" keyword argument is set to True, only generic page
field values will be loaded and all specific fields will be deferred.
... | [
"def",
"specific",
"(",
"self",
",",
"defer",
"=",
"False",
")",
":",
"clone",
"=",
"self",
".",
"_clone",
"(",
")",
"if",
"defer",
":",
"clone",
".",
"_iterable_class",
"=",
"DeferredSpecificIterable",
"else",
":",
"clone",
".",
"_iterable_class",
"=",
... | [
375,
4
] | [
388,
20
] | python | en | ['en', 'error', 'th'] | False |
PageQuerySet.in_site | (self, site) |
This filters the QuerySet to only contain pages within the specified site.
|
This filters the QuerySet to only contain pages within the specified site.
| def in_site(self, site):
"""
This filters the QuerySet to only contain pages within the specified site.
"""
return self.descendant_of(site.root_page, inclusive=True) | [
"def",
"in_site",
"(",
"self",
",",
"site",
")",
":",
"return",
"self",
".",
"descendant_of",
"(",
"site",
".",
"root_page",
",",
"inclusive",
"=",
"True",
")"
] | [
390,
4
] | [
394,
65
] | python | en | ['en', 'error', 'th'] | False |
PageQuerySet.translation_of | (self, page, inclusive=False) |
This filters the QuerySet to only contain pages that are translations of the specified page.
If inclusive is True, the page itself is returned.
|
This filters the QuerySet to only contain pages that are translations of the specified page. | def translation_of(self, page, inclusive=False):
"""
This filters the QuerySet to only contain pages that are translations of the specified page.
If inclusive is True, the page itself is returned.
"""
return self.filter(self.translation_of_q(page, inclusive)) | [
"def",
"translation_of",
"(",
"self",
",",
"page",
",",
"inclusive",
"=",
"False",
")",
":",
"return",
"self",
".",
"filter",
"(",
"self",
".",
"translation_of_q",
"(",
"page",
",",
"inclusive",
")",
")"
] | [
404,
4
] | [
410,
66
] | python | en | ['en', 'error', 'th'] | False |
PageQuerySet.not_translation_of | (self, page, inclusive=False) |
This filters the QuerySet to only contain pages that are not translations of the specified page.
Note, this will include the page itself as the page is technically not a translation of itself.
If inclusive is True, we consider the page to be a translation of itself so this excludes the page
... |
This filters the QuerySet to only contain pages that are not translations of the specified page. | def not_translation_of(self, page, inclusive=False):
"""
This filters the QuerySet to only contain pages that are not translations of the specified page.
Note, this will include the page itself as the page is technically not a translation of itself.
If inclusive is True, we consider the... | [
"def",
"not_translation_of",
"(",
"self",
",",
"page",
",",
"inclusive",
"=",
"False",
")",
":",
"return",
"self",
".",
"exclude",
"(",
"self",
".",
"translation_of_q",
"(",
"page",
",",
"inclusive",
")",
")"
] | [
412,
4
] | [
420,
67
] | python | en | ['en', 'error', 'th'] | False |
PageQuerySet.prefetch_workflow_states | (self) |
Performance optimisation for listing pages.
Prefetches the active workflow states on each page in this queryset.
Used by `workflow_in_progress` and `current_workflow_progress` properties on
`wagtailcore.models.Page`.
|
Performance optimisation for listing pages.
Prefetches the active workflow states on each page in this queryset.
Used by `workflow_in_progress` and `current_workflow_progress` properties on
`wagtailcore.models.Page`.
| def prefetch_workflow_states(self):
"""
Performance optimisation for listing pages.
Prefetches the active workflow states on each page in this queryset.
Used by `workflow_in_progress` and `current_workflow_progress` properties on
`wagtailcore.models.Page`.
"""
fro... | [
"def",
"prefetch_workflow_states",
"(",
"self",
")",
":",
"from",
".",
"models",
"import",
"WorkflowState",
"workflow_states",
"=",
"WorkflowState",
".",
"objects",
".",
"active",
"(",
")",
".",
"select_related",
"(",
"\"current_task_state__task\"",
")",
"return",
... | [
422,
4
] | [
441,
9
] | python | en | ['en', 'error', 'th'] | False |
PageQuerySet.annotate_approved_schedule | (self) |
Performance optimisation for listing pages.
Annotates each page with the existence of an approved go live time.
Used by `approved_schedule` property on `wagtailcore.models.Page`.
|
Performance optimisation for listing pages.
Annotates each page with the existence of an approved go live time.
Used by `approved_schedule` property on `wagtailcore.models.Page`.
| def annotate_approved_schedule(self):
"""
Performance optimisation for listing pages.
Annotates each page with the existence of an approved go live time.
Used by `approved_schedule` property on `wagtailcore.models.Page`.
"""
from .models import PageRevision
retur... | [
"def",
"annotate_approved_schedule",
"(",
"self",
")",
":",
"from",
".",
"models",
"import",
"PageRevision",
"return",
"self",
".",
"annotate",
"(",
"_approved_schedule",
"=",
"Exists",
"(",
"PageRevision",
".",
"objects",
".",
"exclude",
"(",
"approved_go_live_at... | [
443,
4
] | [
457,
9
] | python | en | ['en', 'error', 'th'] | False |
PageQuerySet.annotate_site_root_state | (self) |
Performance optimisation for listing pages.
Annotates each object with whether it is a root page of any site.
Used by `is_site_root` method on `wagtailcore.models.Page`.
|
Performance optimisation for listing pages.
Annotates each object with whether it is a root page of any site.
Used by `is_site_root` method on `wagtailcore.models.Page`.
| def annotate_site_root_state(self):
"""
Performance optimisation for listing pages.
Annotates each object with whether it is a root page of any site.
Used by `is_site_root` method on `wagtailcore.models.Page`.
"""
return self.annotate(
_is_site_root=Exists(
... | [
"def",
"annotate_site_root_state",
"(",
"self",
")",
":",
"return",
"self",
".",
"annotate",
"(",
"_is_site_root",
"=",
"Exists",
"(",
"Site",
".",
"objects",
".",
"filter",
"(",
"root_page__translation_key",
"=",
"OuterRef",
"(",
"\"translation_key\"",
")",
")"... | [
459,
4
] | [
471,
9
] | python | en | ['en', 'error', 'th'] | False |
remove_document_permissions | (apps, schema_editor) | Reverse the above additions of permissions. | Reverse the above additions of permissions. | def remove_document_permissions(apps, schema_editor):
"""Reverse the above additions of permissions."""
ContentType = apps.get_model('contenttypes.ContentType')
Permission = apps.get_model('auth.Permission')
document_content_type = ContentType.objects.get(
model='document',
app_label='wa... | [
"def",
"remove_document_permissions",
"(",
"apps",
",",
"schema_editor",
")",
":",
"ContentType",
"=",
"apps",
".",
"get_model",
"(",
"'contenttypes.ContentType'",
")",
"Permission",
"=",
"apps",
".",
"get_model",
"(",
"'auth.Permission'",
")",
"document_content_type"... | [
36,
0
] | [
48,
14
] | python | en | ['en', 'en', 'en'] | True |
SolanoHookTests.test_solano_message_001 | (self) |
Build notifications are generated by Solano Labs after build completes.
|
Build notifications are generated by Solano Labs after build completes.
| def test_solano_message_001(self) -> None:
"""
Build notifications are generated by Solano Labs after build completes.
"""
expected_topic = "build update"
expected_message = """
Build update (see [build log](https://ci.solanolabs.com:443/reports/3316175)):
* **Author**: solano-ci... | [
"def",
"test_solano_message_001",
"(",
"self",
")",
"->",
"None",
":",
"expected_topic",
"=",
"\"build update\"",
"expected_message",
"=",
"\"\"\"\nBuild update (see [build log](https://ci.solanolabs.com:443/reports/3316175)):\n* **Author**: solano-ci[bot]@users.noreply.github.com\n* **Com... | [
8,
4
] | [
25,
9
] | python | en | ['en', 'error', 'th'] | False |
SolanoHookTests.test_solano_message_002 | (self) |
Build notifications are generated by Solano Labs after build completes.
|
Build notifications are generated by Solano Labs after build completes.
| def test_solano_message_002(self) -> None:
"""
Build notifications are generated by Solano Labs after build completes.
"""
expected_topic = "build update"
expected_message = """
Build update (see [build log](https://ci.solanolabs.com:443/reports/3316723)):
* **Author**: Unknown
*... | [
"def",
"test_solano_message_002",
"(",
"self",
")",
"->",
"None",
":",
"expected_topic",
"=",
"\"build update\"",
"expected_message",
"=",
"\"\"\"\nBuild update (see [build log](https://ci.solanolabs.com:443/reports/3316723)):\n* **Author**: Unknown\n* **Commit**: [5d0b92e](bitbucket.org/f... | [
27,
4
] | [
44,
9
] | python | en | ['en', 'error', 'th'] | False |
SolanoHookTests.test_solano_message_received | (self) |
Build notifications are generated by Solano Labs after build completes.
|
Build notifications are generated by Solano Labs after build completes.
| def test_solano_message_received(self) -> None:
"""
Build notifications are generated by Solano Labs after build completes.
"""
expected_topic = "build update"
expected_message = """
Build update (see [build log](https://ci.solanolabs.com:443/reports/3317799)):
* **Author**: sola... | [
"def",
"test_solano_message_received",
"(",
"self",
")",
"->",
"None",
":",
"expected_topic",
"=",
"\"build update\"",
"expected_message",
"=",
"\"\"\"\nBuild update (see [build log](https://ci.solanolabs.com:443/reports/3317799)):\n* **Author**: solano-ci[bot]@users.noreply.github.com\n* ... | [
46,
4
] | [
63,
9
] | python | en | ['en', 'error', 'th'] | False |
DatabaseSchemaEditor._remake_table | (self, model, create_field=None, delete_field=None, alter_field=None) |
Shortcut to transform a model from old_model into new_model
The essential steps are:
1. rename the model's existing table, e.g. "app_model" to "app_model__old"
2. create a table with the updated definition called "app_model"
3. copy the data from the old renamed table to ... |
Shortcut to transform a model from old_model into new_model | def _remake_table(self, model, create_field=None, delete_field=None, alter_field=None):
"""
Shortcut to transform a model from old_model into new_model
The essential steps are:
1. rename the model's existing table, e.g. "app_model" to "app_model__old"
2. create a table with ... | [
"def",
"_remake_table",
"(",
"self",
",",
"model",
",",
"create_field",
"=",
"None",
",",
"delete_field",
"=",
"None",
",",
"alter_field",
"=",
"None",
")",
":",
"# Self-referential fields must be recreated rather than copied from",
"# the old model to ensure their remote_f... | [
69,
4
] | [
217,
47
] | python | en | ['en', 'error', 'th'] | False |
DatabaseSchemaEditor.add_field | (self, model, field) |
Creates a field on a model.
Usually involves adding a column, but may involve adding a
table instead (for M2M fields)
|
Creates a field on a model.
Usually involves adding a column, but may involve adding a
table instead (for M2M fields)
| def add_field(self, model, field):
"""
Creates a field on a model.
Usually involves adding a column, but may involve adding a
table instead (for M2M fields)
"""
# Special-case implicit M2M tables
if field.many_to_many and field.remote_field.through._meta.auto_crea... | [
"def",
"add_field",
"(",
"self",
",",
"model",
",",
"field",
")",
":",
"# Special-case implicit M2M tables",
"if",
"field",
".",
"many_to_many",
"and",
"field",
".",
"remote_field",
".",
"through",
".",
"_meta",
".",
"auto_created",
":",
"return",
"self",
".",... | [
228,
4
] | [
237,
53
] | python | en | ['en', 'error', 'th'] | False |
DatabaseSchemaEditor.remove_field | (self, model, field) |
Removes a field from a model. Usually involves deleting a column,
but for M2Ms may involve deleting a table.
|
Removes a field from a model. Usually involves deleting a column,
but for M2Ms may involve deleting a table.
| def remove_field(self, model, field):
"""
Removes a field from a model. Usually involves deleting a column,
but for M2Ms may involve deleting a table.
"""
# M2M fields are a special case
if field.many_to_many:
# For implicit M2M tables, delete the auto-created... | [
"def",
"remove_field",
"(",
"self",
",",
"model",
",",
"field",
")",
":",
"# M2M fields are a special case",
"if",
"field",
".",
"many_to_many",
":",
"# For implicit M2M tables, delete the auto-created table",
"if",
"field",
".",
"remote_field",
".",
"through",
".",
"... | [
239,
4
] | [
255,
57
] | python | en | ['en', 'error', 'th'] | False |
DatabaseSchemaEditor._alter_field | (self, model, old_field, new_field, old_type, new_type,
old_db_params, new_db_params, strict=False) | Actually perform a "physical" (non-ManyToMany) field update. | Actually perform a "physical" (non-ManyToMany) field update. | def _alter_field(self, model, old_field, new_field, old_type, new_type,
old_db_params, new_db_params, strict=False):
"""Actually perform a "physical" (non-ManyToMany) field update."""
# Alter by remaking table
self._remake_table(model, alter_field=(old_field, new_field)) | [
"def",
"_alter_field",
"(",
"self",
",",
"model",
",",
"old_field",
",",
"new_field",
",",
"old_type",
",",
"new_type",
",",
"old_db_params",
",",
"new_db_params",
",",
"strict",
"=",
"False",
")",
":",
"# Alter by remaking table",
"self",
".",
"_remake_table",
... | [
257,
4
] | [
261,
69
] | python | en | ['en', 'en', 'en'] | True |
DatabaseSchemaEditor._alter_many_to_many | (self, model, old_field, new_field, strict) |
Alters M2Ms to repoint their to= endpoints.
|
Alters M2Ms to repoint their to= endpoints.
| def _alter_many_to_many(self, model, old_field, new_field, strict):
"""
Alters M2Ms to repoint their to= endpoints.
"""
if old_field.remote_field.through._meta.db_table == new_field.remote_field.through._meta.db_table:
# The field name didn't change, but some options did; we ... | [
"def",
"_alter_many_to_many",
"(",
"self",
",",
"model",
",",
"old_field",
",",
"new_field",
",",
"strict",
")",
":",
"if",
"old_field",
".",
"remote_field",
".",
"through",
".",
"_meta",
".",
"db_table",
"==",
"new_field",
".",
"remote_field",
".",
"through... | [
263,
4
] | [
298,
57
] | python | en | ['en', 'error', 'th'] | False |
_RegistryQueryBase | (sysdir, key, value) | Use reg.exe to read a particular key.
While ideally we might use the win32 module, we would like gyp to be
python neutral, so for instance cygwin python lacks this module.
Arguments:
sysdir: The system subdirectory to attempt to launch reg.exe from.
key: The registry key to read from.
value: The par... | Use reg.exe to read a particular key. | def _RegistryQueryBase(sysdir, key, value):
"""Use reg.exe to read a particular key.
While ideally we might use the win32 module, we would like gyp to be
python neutral, so for instance cygwin python lacks this module.
Arguments:
sysdir: The system subdirectory to attempt to launch reg.exe from.
key... | [
"def",
"_RegistryQueryBase",
"(",
"sysdir",
",",
"key",
",",
"value",
")",
":",
"# Skip if not on Windows or Python Win32 setup issue",
"if",
"sys",
".",
"platform",
"not",
"in",
"(",
"\"win32\"",
",",
"\"cygwin\"",
")",
":",
"return",
"None",
"# Setup params to pas... | [
155,
0
] | [
184,
15
] | python | en | ['en', 'en', 'en'] | True |
_RegistryQuery | (key, value=None) | r"""Use reg.exe to read a particular key through _RegistryQueryBase.
First tries to launch from %WinDir%\Sysnative to avoid WoW64 redirection. If
that fails, it falls back to System32. Sysnative is available on Vista and
up and available on Windows Server 2003 and XP through KB patch 942589. Note
that Sysnati... | r"""Use reg.exe to read a particular key through _RegistryQueryBase. | def _RegistryQuery(key, value=None):
r"""Use reg.exe to read a particular key through _RegistryQueryBase.
First tries to launch from %WinDir%\Sysnative to avoid WoW64 redirection. If
that fails, it falls back to System32. Sysnative is available on Vista and
up and available on Windows Server 2003 and XP thr... | [
"def",
"_RegistryQuery",
"(",
"key",
",",
"value",
"=",
"None",
")",
":",
"text",
"=",
"None",
"try",
":",
"text",
"=",
"_RegistryQueryBase",
"(",
"\"Sysnative\"",
",",
"key",
",",
"value",
")",
"except",
"OSError",
"as",
"e",
":",
"if",
"e",
".",
"e... | [
187,
0
] | [
212,
15
] | python | en | ['en', 'en', 'en'] | True |
_RegistryGetValueUsingWinReg | (key, value) | Use the _winreg module to obtain the value of a registry key.
Args:
key: The registry key.
value: The particular registry value to read.
Return:
contents of the registry key's value, or None on failure. Throws
ImportError if _winreg is unavailable.
| Use the _winreg module to obtain the value of a registry key. | def _RegistryGetValueUsingWinReg(key, value):
"""Use the _winreg module to obtain the value of a registry key.
Args:
key: The registry key.
value: The particular registry value to read.
Return:
contents of the registry key's value, or None on failure. Throws
ImportError if _winreg is unavailab... | [
"def",
"_RegistryGetValueUsingWinReg",
"(",
"key",
",",
"value",
")",
":",
"try",
":",
"# Python 2",
"from",
"_winreg",
"import",
"HKEY_LOCAL_MACHINE",
",",
"OpenKey",
",",
"QueryValueEx",
"except",
"ImportError",
":",
"# Python 3",
"from",
"winreg",
"import",
"HK... | [
215,
0
] | [
238,
19
] | python | en | ['en', 'en', 'en'] | True |
_RegistryGetValue | (key, value) | Use _winreg or reg.exe to obtain the value of a registry key.
Using _winreg is preferable because it solves an issue on some corporate
environments where access to reg.exe is locked down. However, we still need
to fallback to reg.exe for the case where the _winreg module is not available
(for example in cygwin... | Use _winreg or reg.exe to obtain the value of a registry key. | def _RegistryGetValue(key, value):
"""Use _winreg or reg.exe to obtain the value of a registry key.
Using _winreg is preferable because it solves an issue on some corporate
environments where access to reg.exe is locked down. However, we still need
to fallback to reg.exe for the case where the _winreg module... | [
"def",
"_RegistryGetValue",
"(",
"key",
",",
"value",
")",
":",
"try",
":",
"return",
"_RegistryGetValueUsingWinReg",
"(",
"key",
",",
"value",
")",
"except",
"ImportError",
":",
"pass",
"# Fallback to reg.exe if we fail to import _winreg.",
"text",
"=",
"_RegistryQue... | [
241,
0
] | [
268,
25
] | python | en | ['en', 'en', 'en'] | True |
_CreateVersion | (name, path, sdk_based=False) | Sets up MSVS project generation.
Setup is based off the GYP_MSVS_VERSION environment variable or whatever is
autodetected if GYP_MSVS_VERSION is not explicitly specified. If a version is
passed in that doesn't match a value in versions python will throw a error.
| Sets up MSVS project generation. | def _CreateVersion(name, path, sdk_based=False):
"""Sets up MSVS project generation.
Setup is based off the GYP_MSVS_VERSION environment variable or whatever is
autodetected if GYP_MSVS_VERSION is not explicitly specified. If a version is
passed in that doesn't match a value in versions python will throw a e... | [
"def",
"_CreateVersion",
"(",
"name",
",",
"path",
",",
"sdk_based",
"=",
"False",
")",
":",
"if",
"path",
":",
"path",
"=",
"os",
".",
"path",
".",
"normpath",
"(",
"path",
")",
"versions",
"=",
"{",
"\"2019\"",
":",
"VisualStudioVersion",
"(",
"\"201... | [
271,
0
] | [
421,
30
] | python | en | ['en', 'en', 'en'] | True |
_ConvertToCygpath | (path) | Convert to cygwin path if we are using cygwin. | Convert to cygwin path if we are using cygwin. | def _ConvertToCygpath(path):
"""Convert to cygwin path if we are using cygwin."""
if sys.platform == "cygwin":
p = subprocess.Popen(["cygpath", path], stdout=subprocess.PIPE)
path = p.communicate()[0].strip()
if PY3:
path = path.decode("utf-8")
return path | [
"def",
"_ConvertToCygpath",
"(",
"path",
")",
":",
"if",
"sys",
".",
"platform",
"==",
"\"cygwin\"",
":",
"p",
"=",
"subprocess",
".",
"Popen",
"(",
"[",
"\"cygpath\"",
",",
"path",
"]",
",",
"stdout",
"=",
"subprocess",
".",
"PIPE",
")",
"path",
"=",
... | [
424,
0
] | [
431,
15
] | python | en | ['en', 'en', 'en'] | True |
_DetectVisualStudioVersions | (versions_to_check, force_express) | Collect the list of installed visual studio versions.
Returns:
A list of visual studio versions installed in descending order of
usage preference.
Base this on the registry and a quick check if devenv.exe exists.
Possibilities are:
2005(e) - Visual Studio 2005 (8)
2008(e) - Visual Studio ... | Collect the list of installed visual studio versions. | def _DetectVisualStudioVersions(versions_to_check, force_express):
"""Collect the list of installed visual studio versions.
Returns:
A list of visual studio versions installed in descending order of
usage preference.
Base this on the registry and a quick check if devenv.exe exists.
Possibilities ... | [
"def",
"_DetectVisualStudioVersions",
"(",
"versions_to_check",
",",
"force_express",
")",
":",
"version_to_year",
"=",
"{",
"\"8.0\"",
":",
"\"2005\"",
",",
"\"9.0\"",
":",
"\"2008\"",
",",
"\"10.0\"",
":",
"\"2010\"",
",",
"\"11.0\"",
":",
"\"2012\"",
",",
"\"... | [
434,
0
] | [
521,
19
] | python | en | ['en', 'en', 'en'] | True |
SelectVisualStudioVersion | (version="auto", allow_fallback=True) | Select which version of Visual Studio projects to generate.
Arguments:
version: Hook to allow caller to force a particular version (vs auto).
Returns:
An object representing a visual studio project format version.
| Select which version of Visual Studio projects to generate. | def SelectVisualStudioVersion(version="auto", allow_fallback=True):
"""Select which version of Visual Studio projects to generate.
Arguments:
version: Hook to allow caller to force a particular version (vs auto).
Returns:
An object representing a visual studio project format version.
"""
# In aut... | [
"def",
"SelectVisualStudioVersion",
"(",
"version",
"=",
"\"auto\"",
",",
"allow_fallback",
"=",
"True",
")",
":",
"# In auto mode, check environment variable for override.",
"if",
"version",
"==",
"\"auto\"",
":",
"version",
"=",
"os",
".",
"environ",
".",
"get",
"... | [
524,
0
] | [
570,
22
] | python | en | ['en', 'en', 'en'] | True |
VisualStudioVersion.Description | (self) | Get the full description of the version. | Get the full description of the version. | def Description(self):
"""Get the full description of the version."""
return self.description | [
"def",
"Description",
"(",
"self",
")",
":",
"return",
"self",
".",
"description"
] | [
52,
4
] | [
54,
31
] | python | en | ['en', 'en', 'en'] | True |
VisualStudioVersion.SolutionVersion | (self) | Get the version number of the sln files. | Get the version number of the sln files. | def SolutionVersion(self):
"""Get the version number of the sln files."""
return self.solution_version | [
"def",
"SolutionVersion",
"(",
"self",
")",
":",
"return",
"self",
".",
"solution_version"
] | [
56,
4
] | [
58,
36
] | python | en | ['en', 'en', 'en'] | True |
VisualStudioVersion.ProjectVersion | (self) | Get the version number of the vcproj or vcxproj files. | Get the version number of the vcproj or vcxproj files. | def ProjectVersion(self):
"""Get the version number of the vcproj or vcxproj files."""
return self.project_version | [
"def",
"ProjectVersion",
"(",
"self",
")",
":",
"return",
"self",
".",
"project_version"
] | [
60,
4
] | [
62,
35
] | python | en | ['en', 'en', 'pt'] | True |
VisualStudioVersion.UsesVcxproj | (self) | Returns true if this version uses a vcxproj file. | Returns true if this version uses a vcxproj file. | def UsesVcxproj(self):
"""Returns true if this version uses a vcxproj file."""
return self.uses_vcxproj | [
"def",
"UsesVcxproj",
"(",
"self",
")",
":",
"return",
"self",
".",
"uses_vcxproj"
] | [
67,
4
] | [
69,
32
] | python | en | ['en', 'en', 'en'] | True |
VisualStudioVersion.ProjectExtension | (self) | Returns the file extension for the project. | Returns the file extension for the project. | def ProjectExtension(self):
"""Returns the file extension for the project."""
return self.uses_vcxproj and ".vcxproj" or ".vcproj" | [
"def",
"ProjectExtension",
"(",
"self",
")",
":",
"return",
"self",
".",
"uses_vcxproj",
"and",
"\".vcxproj\"",
"or",
"\".vcproj\""
] | [
71,
4
] | [
73,
60
] | python | en | ['en', 'en', 'en'] | True |
VisualStudioVersion.Path | (self) | Returns the path to Visual Studio installation. | Returns the path to Visual Studio installation. | def Path(self):
"""Returns the path to Visual Studio installation."""
return self.path | [
"def",
"Path",
"(",
"self",
")",
":",
"return",
"self",
".",
"path"
] | [
75,
4
] | [
77,
24
] | python | en | ['en', 'en', 'en'] | True |
VisualStudioVersion.ToolPath | (self, tool) | Returns the path to a given compiler tool. | Returns the path to a given compiler tool. | def ToolPath(self, tool):
"""Returns the path to a given compiler tool. """
return os.path.normpath(os.path.join(self.path, "VC/bin", tool)) | [
"def",
"ToolPath",
"(",
"self",
",",
"tool",
")",
":",
"return",
"os",
".",
"path",
".",
"normpath",
"(",
"os",
".",
"path",
".",
"join",
"(",
"self",
".",
"path",
",",
"\"VC/bin\"",
",",
"tool",
")",
")"
] | [
79,
4
] | [
81,
72
] | python | en | ['en', 'en', 'en'] | True |
VisualStudioVersion.DefaultToolset | (self) | Returns the msbuild toolset version that will be used in the absence
of a user override. | Returns the msbuild toolset version that will be used in the absence
of a user override. | def DefaultToolset(self):
"""Returns the msbuild toolset version that will be used in the absence
of a user override."""
return self.default_toolset | [
"def",
"DefaultToolset",
"(",
"self",
")",
":",
"return",
"self",
".",
"default_toolset"
] | [
83,
4
] | [
86,
35
] | python | en | ['en', 'en', 'en'] | True |
VisualStudioVersion._SetupScriptInternal | (self, target_arch) | Returns a command (with arguments) to be used to set up the
environment. | Returns a command (with arguments) to be used to set up the
environment. | def _SetupScriptInternal(self, target_arch):
"""Returns a command (with arguments) to be used to set up the
environment."""
assert target_arch in ("x86", "x64"), "target_arch not supported"
# If WindowsSDKDir is set and SetEnv.Cmd exists then we are using the
# depot_tools build tool... | [
"def",
"_SetupScriptInternal",
"(",
"self",
",",
"target_arch",
")",
":",
"assert",
"target_arch",
"in",
"(",
"\"x86\"",
",",
"\"x64\"",
")",
",",
"\"target_arch not supported\"",
"# If WindowsSDKDir is set and SetEnv.Cmd exists then we are using the",
"# depot_tools build tool... | [
88,
4
] | [
143,
35
] | python | en | ['en', 'en', 'en'] | True |
Format.editor_attributes | (self, image, alt_text) |
Return additional attributes to go on the HTML element
when outputting this image within a rich text editor field
|
Return additional attributes to go on the HTML element
when outputting this image within a rich text editor field
| def editor_attributes(self, image, alt_text):
"""
Return additional attributes to go on the HTML element
when outputting this image within a rich text editor field
"""
return {
'data-embedtype': "image",
'data-id': image.id,
'data-format': self... | [
"def",
"editor_attributes",
"(",
"self",
",",
"image",
",",
"alt_text",
")",
":",
"return",
"{",
"'data-embedtype'",
":",
"\"image\"",
",",
"'data-id'",
":",
"image",
".",
"id",
",",
"'data-format'",
":",
"self",
".",
"name",
",",
"'data-alt'",
":",
"escap... | [
21,
4
] | [
31,
9
] | python | en | ['en', 'error', 'th'] | False |
dump_db | (engine, hostname, port, dbname, dbuser, dbpass, output) |
Dumps a database
Args:
engine: the name of the database system (either postgresql)
hostname: the hostname of the database
port: the port of the database server
dbname: the database name to be dumped
dbuser: the user authorised to do the dump
dbpass: the pw for t... |
Dumps a database | def dump_db(engine, hostname, port, dbname, dbuser, dbpass, output):
"""
Dumps a database
Args:
engine: the name of the database system (either postgresql)
hostname: the hostname of the database
port: the port of the database server
dbname: the database name to be dumped
... | [
"def",
"dump_db",
"(",
"engine",
",",
"hostname",
",",
"port",
",",
"dbname",
",",
"dbuser",
",",
"dbpass",
",",
"output",
")",
":",
"if",
"engine",
"==",
"\"postgresql\"",
":",
"return",
"dump_pg",
"(",
"hostname",
",",
"port",
",",
"dbname",
",",
"db... | [
10,
0
] | [
26,
68
] | python | en | ['en', 'error', 'th'] | False |
dump_pg | (hostname, port, dbname, dbuser, dbpass, output_filename) |
Dumps a PostgreSQL database in specified output file
|
Dumps a PostgreSQL database in specified output file
| def dump_pg(hostname, port, dbname, dbuser, dbpass, output_filename):
"""
Dumps a PostgreSQL database in specified output file
"""
pg_dump_executable = "pg_dump"
try:
env = os.environ
env["PGPASSWORD"]= dbpass
subprocess.check_call(
[
pg_dump_exec... | [
"def",
"dump_pg",
"(",
"hostname",
",",
"port",
",",
"dbname",
",",
"dbuser",
",",
"dbpass",
",",
"output_filename",
")",
":",
"pg_dump_executable",
"=",
"\"pg_dump\"",
"try",
":",
"env",
"=",
"os",
".",
"environ",
"env",
"[",
"\"PGPASSWORD\"",
"]",
"=",
... | [
29,
0
] | [
51,
13
] | python | en | ['en', 'error', 'th'] | False |
choose_boundary | () |
Our embarrassingly-simple replacement for mimetools.choose_boundary.
|
Our embarrassingly-simple replacement for mimetools.choose_boundary.
| def choose_boundary():
"""
Our embarrassingly-simple replacement for mimetools.choose_boundary.
"""
boundary = binascii.hexlify(os.urandom(16))
if not six.PY2:
boundary = boundary.decode("ascii")
return boundary | [
"def",
"choose_boundary",
"(",
")",
":",
"boundary",
"=",
"binascii",
".",
"hexlify",
"(",
"os",
".",
"urandom",
"(",
"16",
")",
")",
"if",
"not",
"six",
".",
"PY2",
":",
"boundary",
"=",
"boundary",
".",
"decode",
"(",
"\"ascii\"",
")",
"return",
"b... | [
14,
0
] | [
21,
19
] | python | en | ['en', 'error', 'th'] | False |
iter_field_objects | (fields) |
Iterate over fields.
Supports list of (k, v) tuples and dicts, and lists of
:class:`~urllib3.fields.RequestField`.
|
Iterate over fields. | def iter_field_objects(fields):
"""
Iterate over fields.
Supports list of (k, v) tuples and dicts, and lists of
:class:`~urllib3.fields.RequestField`.
"""
if isinstance(fields, dict):
i = six.iteritems(fields)
else:
i = iter(fields)
for field in i:
if isinstanc... | [
"def",
"iter_field_objects",
"(",
"fields",
")",
":",
"if",
"isinstance",
"(",
"fields",
",",
"dict",
")",
":",
"i",
"=",
"six",
".",
"iteritems",
"(",
"fields",
")",
"else",
":",
"i",
"=",
"iter",
"(",
"fields",
")",
"for",
"field",
"in",
"i",
":"... | [
24,
0
] | [
41,
50
] | python | en | ['en', 'error', 'th'] | False |
iter_fields | (fields) |
.. deprecated:: 1.6
Iterate over fields.
The addition of :class:`~urllib3.fields.RequestField` makes this function
obsolete. Instead, use :func:`iter_field_objects`, which returns
:class:`~urllib3.fields.RequestField` objects.
Supports list of (k, v) tuples and dicts.
|
.. deprecated:: 1.6 | def iter_fields(fields):
"""
.. deprecated:: 1.6
Iterate over fields.
The addition of :class:`~urllib3.fields.RequestField` makes this function
obsolete. Instead, use :func:`iter_field_objects`, which returns
:class:`~urllib3.fields.RequestField` objects.
Supports list of (k, v) tuples an... | [
"def",
"iter_fields",
"(",
"fields",
")",
":",
"if",
"isinstance",
"(",
"fields",
",",
"dict",
")",
":",
"return",
"(",
"(",
"k",
",",
"v",
")",
"for",
"k",
",",
"v",
"in",
"six",
".",
"iteritems",
"(",
"fields",
")",
")",
"return",
"(",
"(",
"... | [
44,
0
] | [
59,
38
] | python | en | ['en', 'error', 'th'] | False |
encode_multipart_formdata | (fields, boundary=None) |
Encode a dictionary of ``fields`` using the multipart/form-data MIME format.
:param fields:
Dictionary of fields or list of (key, :class:`~urllib3.fields.RequestField`).
:param boundary:
If not specified, then a random boundary will be generated using
:func:`urllib3.filepost.choos... |
Encode a dictionary of ``fields`` using the multipart/form-data MIME format. | def encode_multipart_formdata(fields, boundary=None):
"""
Encode a dictionary of ``fields`` using the multipart/form-data MIME format.
:param fields:
Dictionary of fields or list of (key, :class:`~urllib3.fields.RequestField`).
:param boundary:
If not specified, then a random boundary ... | [
"def",
"encode_multipart_formdata",
"(",
"fields",
",",
"boundary",
"=",
"None",
")",
":",
"body",
"=",
"BytesIO",
"(",
")",
"if",
"boundary",
"is",
"None",
":",
"boundary",
"=",
"choose_boundary",
"(",
")",
"for",
"field",
"in",
"iter_field_objects",
"(",
... | [
62,
0
] | [
97,
40
] | python | en | ['en', 'error', 'th'] | False |
SettingsRegistry.__init__ | (self, settings=None) |
:param settings: a ``django.conf.LazySettings`` object used to lookup
file-based field values (e.g., ``local_settings.py``
and ``/etc/tower/conf.d/example.py``). If unspecified,
defaults to ``django.conf.settings``.
|
:param settings: a ``django.conf.LazySettings`` object used to lookup
file-based field values (e.g., ``local_settings.py``
and ``/etc/tower/conf.d/example.py``). If unspecified,
defaults to ``django.conf.settings``.
| def __init__(self, settings=None):
"""
:param settings: a ``django.conf.LazySettings`` object used to lookup
file-based field values (e.g., ``local_settings.py``
and ``/etc/tower/conf.d/example.py``). If unspecified,
defaults to... | [
"def",
"__init__",
"(",
"self",
",",
"settings",
"=",
"None",
")",
":",
"if",
"settings",
"is",
"None",
":",
"from",
"django",
".",
"conf",
"import",
"settings",
"self",
".",
"_registry",
"=",
"OrderedDict",
"(",
")",
"self",
".",
"_validate_registry",
"... | [
22,
4
] | [
34,
32
] | python | en | ['en', 'error', 'th'] | False |
FileLister.resource_files | (self) |
Get list of resource files
:rtype: list
|
Get list of resource files | def resource_files(self):
"""
Get list of resource files
:rtype: list
"""
pass | [
"def",
"resource_files",
"(",
"self",
")",
":",
"pass"
] | [
26,
4
] | [
32,
12
] | python | en | ['en', 'error', 'th'] | False |
SelfDiagnosable.get_error_diagnostics | (self) |
:rtype: list[str]
| def get_error_diagnostics(self):
"""
:rtype: list[str]
"""
pass | [
"def",
"get_error_diagnostics",
"(",
"self",
")",
":",
"pass"
] | [
47,
4
] | [
52,
12
] | python | en | ['en', 'error', 'th'] | False | |
tempdir_registry | () | Provides a scoped global tempdir registry that can be used to dictate
whether directories should be deleted.
| Provides a scoped global tempdir registry that can be used to dictate
whether directories should be deleted.
| def tempdir_registry():
# type: () -> Iterator[TempDirectoryTypeRegistry]
"""Provides a scoped global tempdir registry that can be used to dictate
whether directories should be deleted.
"""
global _tempdir_registry
old_tempdir_registry = _tempdir_registry
_tempdir_registry = TempDirectoryTyp... | [
"def",
"tempdir_registry",
"(",
")",
":",
"# type: () -> Iterator[TempDirectoryTypeRegistry]",
"global",
"_tempdir_registry",
"old_tempdir_registry",
"=",
"_tempdir_registry",
"_tempdir_registry",
"=",
"TempDirectoryTypeRegistry",
"(",
")",
"try",
":",
"yield",
"_tempdir_regist... | [
76,
0
] | [
87,
48
] | python | en | ['en', 'en', 'en'] | True |
TempDirectoryTypeRegistry.set_delete | (self, kind, value) | Indicate whether a TempDirectory of the given kind should be
auto-deleted.
| Indicate whether a TempDirectory of the given kind should be
auto-deleted.
| def set_delete(self, kind, value):
# type: (str, bool) -> None
"""Indicate whether a TempDirectory of the given kind should be
auto-deleted.
"""
self._should_delete[kind] = value | [
"def",
"set_delete",
"(",
"self",
",",
"kind",
",",
"value",
")",
":",
"# type: (str, bool) -> None",
"self",
".",
"_should_delete",
"[",
"kind",
"]",
"=",
"value"
] | [
57,
4
] | [
62,
41
] | python | en | ['en', 'en', 'en'] | True |
TempDirectoryTypeRegistry.get_delete | (self, kind) | Get configured auto-delete flag for a given TempDirectory type,
default True.
| Get configured auto-delete flag for a given TempDirectory type,
default True.
| def get_delete(self, kind):
# type: (str) -> bool
"""Get configured auto-delete flag for a given TempDirectory type,
default True.
"""
return self._should_delete.get(kind, True) | [
"def",
"get_delete",
"(",
"self",
",",
"kind",
")",
":",
"# type: (str) -> bool",
"return",
"self",
".",
"_should_delete",
".",
"get",
"(",
"kind",
",",
"True",
")"
] | [
64,
4
] | [
69,
50
] | python | en | ['en', 'en', 'en'] | True |
TempDirectory._create | (self, kind) | Create a temporary directory and store its path in self.path
| Create a temporary directory and store its path in self.path
| def _create(self, kind):
# type: (str) -> str
"""Create a temporary directory and store its path in self.path
"""
# We realpath here because some systems have their default tmpdir
# symlinked to another directory. This tends to confuse build
# scripts, so we canonicalize... | [
"def",
"_create",
"(",
"self",
",",
"kind",
")",
":",
"# type: (str) -> str",
"# We realpath here because some systems have their default tmpdir",
"# symlinked to another directory. This tends to confuse build",
"# scripts, so we canonicalize the path by traversing potential",
"# symlinks h... | [
179,
4
] | [
191,
19
] | python | en | ['en', 'en', 'en'] | True |
TempDirectory.cleanup | (self) | Remove the temporary directory created and reset state
| Remove the temporary directory created and reset state
| def cleanup(self):
# type: () -> None
"""Remove the temporary directory created and reset state
"""
self._deleted = True
if not os.path.exists(self._path):
return
# Make sure to pass unicode on Python 2 to make the contents also
# use unicode, ensuring... | [
"def",
"cleanup",
"(",
"self",
")",
":",
"# type: () -> None",
"self",
".",
"_deleted",
"=",
"True",
"if",
"not",
"os",
".",
"path",
".",
"exists",
"(",
"self",
".",
"_path",
")",
":",
"return",
"# Make sure to pass unicode on Python 2 to make the contents also",
... | [
193,
4
] | [
208,
30
] | python | en | ['en', 'en', 'en'] | True |
AdjacentTempDirectory._generate_names | (cls, name) | Generates a series of temporary names.
The algorithm replaces the leading characters in the name
with ones that are valid filesystem characters, but are not
valid package names (for both Python and pip definitions of
package).
| Generates a series of temporary names. | def _generate_names(cls, name):
# type: (str) -> Iterator[str]
"""Generates a series of temporary names.
The algorithm replaces the leading characters in the name
with ones that are valid filesystem characters, but are not
valid package names (for both Python and pip definitions... | [
"def",
"_generate_names",
"(",
"cls",
",",
"name",
")",
":",
"# type: (str) -> Iterator[str]",
"for",
"i",
"in",
"range",
"(",
"1",
",",
"len",
"(",
"name",
")",
")",
":",
"for",
"candidate",
"in",
"itertools",
".",
"combinations_with_replacement",
"(",
"cls... | [
238,
4
] | [
260,
34
] | python | en | ['en', 'en', 'en'] | True |
generateRequestHash | (request: dict) | Generate request hash. | Generate request hash. | def generateRequestHash(request: dict) -> str:
"""Generate request hash."""
normalizedURL = request.get('url', '')
try:
normalizedURL = unquote(normalizedURL)
except Exception:
pass
_hash = {
'url': normalizedURL,
'method': request.get('method'),
'postData': ... | [
"def",
"generateRequestHash",
"(",
"request",
":",
"dict",
")",
"->",
"str",
":",
"normalizedURL",
"=",
"request",
".",
"get",
"(",
"'url'",
",",
"''",
")",
"try",
":",
"normalizedURL",
"=",
"unquote",
"(",
"normalizedURL",
")",
"except",
"Exception",
":",... | [
698,
0
] | [
727,
28
] | python | en | ['en', 'co', 'en'] | True |
NetworkManager.__init__ | (self, client: CDPSession, frameManager: FrameManager) | Make new NetworkManager. | Make new NetworkManager. | def __init__(self, client: CDPSession, frameManager: FrameManager) -> None:
"""Make new NetworkManager."""
super().__init__()
self._client = client
self._frameManager = frameManager
self._requestIdToRequest: Dict[Optional[str], Request] = dict()
self._requestIdToResponseW... | [
"def",
"__init__",
"(",
"self",
",",
"client",
":",
"CDPSession",
",",
"frameManager",
":",
"FrameManager",
")",
"->",
"None",
":",
"super",
"(",
")",
".",
"__init__",
"(",
")",
"self",
".",
"_client",
"=",
"client",
"self",
".",
"_frameManager",
"=",
... | [
39,
4
] | [
65,
71
] | python | en | ['en', 'en', 'en'] | True |
NetworkManager.authenticate | (self, credentials: Dict[str, str]) | Provide credentials for http auth. | Provide credentials for http auth. | async def authenticate(self, credentials: Dict[str, str]) -> None:
"""Provide credentials for http auth."""
self._credentials = credentials
await self._updateProtocolRequestInterception() | [
"async",
"def",
"authenticate",
"(",
"self",
",",
"credentials",
":",
"Dict",
"[",
"str",
",",
"str",
"]",
")",
"->",
"None",
":",
"self",
".",
"_credentials",
"=",
"credentials",
"await",
"self",
".",
"_updateProtocolRequestInterception",
"(",
")"
] | [
67,
4
] | [
70,
55
] | python | en | ['en', 'en', 'en'] | True |
NetworkManager.setExtraHTTPHeaders | (self, extraHTTPHeaders: Dict[str, str]
) | Set extra http headers. | Set extra http headers. | async def setExtraHTTPHeaders(self, extraHTTPHeaders: Dict[str, str]
) -> None:
"""Set extra http headers."""
self._extraHTTPHeaders = OrderedDict()
for k, v in extraHTTPHeaders.items():
if not isinstance(v, str):
raise TypeError(
... | [
"async",
"def",
"setExtraHTTPHeaders",
"(",
"self",
",",
"extraHTTPHeaders",
":",
"Dict",
"[",
"str",
",",
"str",
"]",
")",
"->",
"None",
":",
"self",
".",
"_extraHTTPHeaders",
"=",
"OrderedDict",
"(",
")",
"for",
"k",
",",
"v",
"in",
"extraHTTPHeaders",
... | [
72,
4
] | [
83,
68
] | python | en | ['nl', 'sv', 'en'] | False |
NetworkManager.extraHTTPHeaders | (self) | Get extra http headers. | Get extra http headers. | def extraHTTPHeaders(self) -> Dict[str, str]:
"""Get extra http headers."""
return dict(**self._extraHTTPHeaders) | [
"def",
"extraHTTPHeaders",
"(",
"self",
")",
"->",
"Dict",
"[",
"str",
",",
"str",
"]",
":",
"return",
"dict",
"(",
"*",
"*",
"self",
".",
"_extraHTTPHeaders",
")"
] | [
85,
4
] | [
87,
45
] | python | en | ['nl', 'en', 'en'] | True |
NetworkManager.setOfflineMode | (self, value: bool) | Change offline mode enable/disable. | Change offline mode enable/disable. | async def setOfflineMode(self, value: bool) -> None:
"""Change offline mode enable/disable."""
if self._offline == value:
return
self._offline = value
await self._client.send('Network.emulateNetworkConditions', {
'offline': self._offline,
'latency': 0,... | [
"async",
"def",
"setOfflineMode",
"(",
"self",
",",
"value",
":",
"bool",
")",
"->",
"None",
":",
"if",
"self",
".",
"_offline",
"==",
"value",
":",
"return",
"self",
".",
"_offline",
"=",
"value",
"await",
"self",
".",
"_client",
".",
"send",
"(",
"... | [
89,
4
] | [
99,
10
] | python | en | ['en', 'en', 'en'] | True |
NetworkManager.setUserAgent | (self, userAgent: str) | Set user agent. | Set user agent. | async def setUserAgent(self, userAgent: str) -> None:
"""Set user agent."""
await self._client.send('Network.setUserAgentOverride',
{'userAgent': userAgent}) | [
"async",
"def",
"setUserAgent",
"(",
"self",
",",
"userAgent",
":",
"str",
")",
"->",
"None",
":",
"await",
"self",
".",
"_client",
".",
"send",
"(",
"'Network.setUserAgentOverride'",
",",
"{",
"'userAgent'",
":",
"userAgent",
"}",
")"
] | [
101,
4
] | [
104,
57
] | python | en | ['en', 'ja', 'en'] | True |
NetworkManager.setRequestInterception | (self, value: bool) | Enable request interception. | Enable request interception. | async def setRequestInterception(self, value: bool) -> None:
"""Enable request interception."""
self._userRequestInterceptionEnabled = value
await self._updateProtocolRequestInterception() | [
"async",
"def",
"setRequestInterception",
"(",
"self",
",",
"value",
":",
"bool",
")",
"->",
"None",
":",
"self",
".",
"_userRequestInterceptionEnabled",
"=",
"value",
"await",
"self",
".",
"_updateProtocolRequestInterception",
"(",
")"
] | [
106,
4
] | [
109,
55
] | python | en | ['en', 'en', 'en'] | True |
Request.url | (self) | URL of this request. | URL of this request. | def url(self) -> str:
"""URL of this request."""
return self._url | [
"def",
"url",
"(",
"self",
")",
"->",
"str",
":",
"return",
"self",
".",
"_url"
] | [
349,
4
] | [
351,
24
] | python | en | ['en', 'en', 'en'] | True |
Request.resourceType | (self) | Resource type of this request perceived by the rendering engine.
ResourceType will be one of the following: ``document``,
``stylesheet``, ``image``, ``media``, ``font``, ``script``,
``texttrack``, ``xhr``, ``fetch``, ``eventsource``, ``websocket``,
``manifest``, ``other``.
| Resource type of this request perceived by the rendering engine. | def resourceType(self) -> str:
"""Resource type of this request perceived by the rendering engine.
ResourceType will be one of the following: ``document``,
``stylesheet``, ``image``, ``media``, ``font``, ``script``,
``texttrack``, ``xhr``, ``fetch``, ``eventsource``, ``websocket``,
... | [
"def",
"resourceType",
"(",
"self",
")",
"->",
"str",
":",
"return",
"self",
".",
"_resourceType"
] | [
354,
4
] | [
362,
33
] | python | en | ['en', 'en', 'en'] | True |
Request.method | (self) | Return this request's method (GET, POST, etc.). | Return this request's method (GET, POST, etc.). | def method(self) -> Optional[str]:
"""Return this request's method (GET, POST, etc.)."""
return self._method | [
"def",
"method",
"(",
"self",
")",
"->",
"Optional",
"[",
"str",
"]",
":",
"return",
"self",
".",
"_method"
] | [
365,
4
] | [
367,
27
] | python | en | ['en', 'la', 'en'] | True |
Request.postData | (self) | Return post body of this request. | Return post body of this request. | def postData(self) -> Optional[str]:
"""Return post body of this request."""
return self._postData | [
"def",
"postData",
"(",
"self",
")",
"->",
"Optional",
"[",
"str",
"]",
":",
"return",
"self",
".",
"_postData"
] | [
370,
4
] | [
372,
29
] | python | en | ['en', 'en', 'en'] | True |
Request.headers | (self) | Return a dictionary of HTTP headers of this request.
All header names are lower-case.
| Return a dictionary of HTTP headers of this request. | def headers(self) -> Dict:
"""Return a dictionary of HTTP headers of this request.
All header names are lower-case.
"""
return self._headers | [
"def",
"headers",
"(",
"self",
")",
"->",
"Dict",
":",
"return",
"self",
".",
"_headers"
] | [
375,
4
] | [
380,
28
] | python | en | ['en', 'en', 'en'] | True |
Request.response | (self) | Return matching :class:`Response` object, or ``None``.
If the response has not been received, return ``None``.
| Return matching :class:`Response` object, or ``None``. | def response(self) -> Optional['Response']:
"""Return matching :class:`Response` object, or ``None``.
If the response has not been received, return ``None``.
"""
return self._response | [
"def",
"response",
"(",
"self",
")",
"->",
"Optional",
"[",
"'Response'",
"]",
":",
"return",
"self",
".",
"_response"
] | [
383,
4
] | [
388,
29
] | python | en | ['en', 'en', 'en'] | True |
Request.frame | (self) | Return a matching :class:`~pyppeteer.frame_manager.frame` object.
Return ``None`` if navigating to error page.
| Return a matching :class:`~pyppeteer.frame_manager.frame` object. | def frame(self) -> Optional[Frame]:
"""Return a matching :class:`~pyppeteer.frame_manager.frame` object.
Return ``None`` if navigating to error page.
"""
return self._frame | [
"def",
"frame",
"(",
"self",
")",
"->",
"Optional",
"[",
"Frame",
"]",
":",
"return",
"self",
".",
"_frame"
] | [
391,
4
] | [
396,
26
] | python | en | ['en', 'en', 'en'] | True |
Request.isNavigationRequest | (self) | Whether this request is driving frame's navigation. | Whether this request is driving frame's navigation. | def isNavigationRequest(self) -> bool:
"""Whether this request is driving frame's navigation."""
return self._isNavigationRequest | [
"def",
"isNavigationRequest",
"(",
"self",
")",
"->",
"bool",
":",
"return",
"self",
".",
"_isNavigationRequest"
] | [
398,
4
] | [
400,
40
] | python | en | ['en', 'en', 'en'] | True |
Request.redirectChain | (self) | Return chain of requests initiated to fetch a resource.
* If there are no redirects and request was successful, the chain will
be empty.
* If a server responds with at least a single redirect, then the chain
will contain all the requests that were redirected.
``redirectChai... | Return chain of requests initiated to fetch a resource. | def redirectChain(self) -> List['Request']:
"""Return chain of requests initiated to fetch a resource.
* If there are no redirects and request was successful, the chain will
be empty.
* If a server responds with at least a single redirect, then the chain
will contain all the... | [
"def",
"redirectChain",
"(",
"self",
")",
"->",
"List",
"[",
"'Request'",
"]",
":",
"return",
"copy",
".",
"copy",
"(",
"self",
".",
"_redirectChain",
")"
] | [
403,
4
] | [
413,
45
] | python | en | ['en', 'en', 'en'] | True |
Request.failure | (self) | Return error text.
Return ``None`` unless this request was failed, as reported by
``requestfailed`` event.
When request failed, this method return dictionary which has a
``errorText`` field, which contains human-readable error message, e.g.
``'net::ERR_RAILED'``.
| Return error text. | def failure(self) -> Optional[Dict]:
"""Return error text.
Return ``None`` unless this request was failed, as reported by
``requestfailed`` event.
When request failed, this method return dictionary which has a
``errorText`` field, which contains human-readable error message, e.... | [
"def",
"failure",
"(",
"self",
")",
"->",
"Optional",
"[",
"Dict",
"]",
":",
"if",
"not",
"self",
".",
"_failureText",
":",
"return",
"None",
"return",
"{",
"'errorText'",
":",
"self",
".",
"_failureText",
"}"
] | [
415,
4
] | [
427,
47
] | python | en | ['en', 'de', 'en'] | True |
Request.continue_ | (self, overrides: Dict = None) | Continue request with optional request overrides.
To use this method, request interception should be enabled by
:meth:`pyppeteer.page.Page.setRequestInterception`. If request
interception is not enabled, raise ``NetworkError``.
``overrides`` can have the following fields:
* ``... | Continue request with optional request overrides. | async def continue_(self, overrides: Dict = None) -> None:
"""Continue request with optional request overrides.
To use this method, request interception should be enabled by
:meth:`pyppeteer.page.Page.setRequestInterception`. If request
interception is not enabled, raise ``NetworkError`... | [
"async",
"def",
"continue_",
"(",
"self",
",",
"overrides",
":",
"Dict",
"=",
"None",
")",
"->",
"None",
":",
"if",
"overrides",
"is",
"None",
":",
"overrides",
"=",
"{",
"}",
"if",
"not",
"self",
".",
"_allowInterception",
":",
"raise",
"NetworkError",
... | [
429,
4
] | [
457,
33
] | python | en | ['en', 'en', 'en'] | True |
Request.respond | (self, response: Dict) | Fulfills request with given response.
To use this, request interception should by enabled by
:meth:`pyppeteer.page.Page.setRequestInterception`. Request
interception is not enabled, raise ``NetworkError``.
``response`` is a dictionary which can have the following fields:
* ``s... | Fulfills request with given response. | async def respond(self, response: Dict) -> None: # noqa: C901
"""Fulfills request with given response.
To use this, request interception should by enabled by
:meth:`pyppeteer.page.Page.setRequestInterception`. Request
interception is not enabled, raise ``NetworkError``.
``resp... | [
"async",
"def",
"respond",
"(",
"self",
",",
"response",
":",
"Dict",
")",
"->",
"None",
":",
"# noqa: C901",
"if",
"self",
".",
"_url",
".",
"startswith",
"(",
"'data:'",
")",
":",
"return",
"if",
"not",
"self",
".",
"_allowInterception",
":",
"raise",
... | [
459,
4
] | [
516,
33
] | python | en | ['en', 'en', 'en'] | True |
Request.abort | (self, errorCode: str = 'failed') | Abort request.
To use this, request interception should be enabled by
:meth:`pyppeteer.page.Page.setRequestInterception`.
If request interception is not enabled, raise ``NetworkError``.
``errorCode`` is an optional error code string. Defaults to ``failed``,
could be one of the ... | Abort request. | async def abort(self, errorCode: str = 'failed') -> None:
"""Abort request.
To use this, request interception should be enabled by
:meth:`pyppeteer.page.Page.setRequestInterception`.
If request interception is not enabled, raise ``NetworkError``.
``errorCode`` is an optional er... | [
"async",
"def",
"abort",
"(",
"self",
",",
"errorCode",
":",
"str",
"=",
"'failed'",
")",
"->",
"None",
":",
"errorReason",
"=",
"errorReasons",
"[",
"errorCode",
"]",
"if",
"not",
"errorReason",
":",
"raise",
"NetworkError",
"(",
"'Unknown error code: {}'",
... | [
518,
4
] | [
565,
33
] | python | en | ['en', 'la', 'en'] | False |
Response.url | (self) | URL of the response. | URL of the response. | def url(self) -> str:
"""URL of the response."""
return self._url | [
"def",
"url",
"(",
"self",
")",
"->",
"str",
":",
"return",
"self",
".",
"_url"
] | [
617,
4
] | [
619,
24
] | python | en | ['en', 'en', 'en'] | True |
Response.ok | (self) | Return bool whether this request is successful (200-299) or not. | Return bool whether this request is successful (200-299) or not. | def ok(self) -> bool:
"""Return bool whether this request is successful (200-299) or not."""
return self._status == 0 or 200 <= self._status <= 299 | [
"def",
"ok",
"(",
"self",
")",
"->",
"bool",
":",
"return",
"self",
".",
"_status",
"==",
"0",
"or",
"200",
"<=",
"self",
".",
"_status",
"<=",
"299"
] | [
622,
4
] | [
624,
62
] | python | en | ['en', 'en', 'en'] | True |
Response.status | (self) | Status code of the response. | Status code of the response. | def status(self) -> int:
"""Status code of the response."""
return self._status | [
"def",
"status",
"(",
"self",
")",
"->",
"int",
":",
"return",
"self",
".",
"_status"
] | [
627,
4
] | [
629,
27
] | python | en | ['en', 'sn', 'en'] | True |
Response.headers | (self) | Return dictionary of HTTP headers of this response.
All header names are lower-case.
| Return dictionary of HTTP headers of this response. | def headers(self) -> Dict:
"""Return dictionary of HTTP headers of this response.
All header names are lower-case.
"""
return self._headers | [
"def",
"headers",
"(",
"self",
")",
"->",
"Dict",
":",
"return",
"self",
".",
"_headers"
] | [
632,
4
] | [
637,
28
] | python | en | ['en', 'en', 'en'] | True |
Response.securityDetails | (self) | Return security details associated with this response.
Security details if the response was received over the secure
connection, or `None` otherwise.
| Return security details associated with this response. | def securityDetails(self) -> Union[Dict, 'SecurityDetails']:
"""Return security details associated with this response.
Security details if the response was received over the secure
connection, or `None` otherwise.
"""
return self._securityDetails | [
"def",
"securityDetails",
"(",
"self",
")",
"->",
"Union",
"[",
"Dict",
",",
"'SecurityDetails'",
"]",
":",
"return",
"self",
".",
"_securityDetails"
] | [
640,
4
] | [
646,
36
] | python | en | ['en', 'en', 'en'] | True |
Response.buffer | (self) | Return awaitable which resolves to bytes with response body. | Return awaitable which resolves to bytes with response body. | def buffer(self) -> Awaitable[bytes]:
"""Return awaitable which resolves to bytes with response body."""
if not self._contentPromise.done():
return self._client._loop.create_task(self._bufread())
return self._contentPromise | [
"def",
"buffer",
"(",
"self",
")",
"->",
"Awaitable",
"[",
"bytes",
"]",
":",
"if",
"not",
"self",
".",
"_contentPromise",
".",
"done",
"(",
")",
":",
"return",
"self",
".",
"_client",
".",
"_loop",
".",
"create_task",
"(",
"self",
".",
"_bufread",
"... | [
660,
4
] | [
664,
35
] | python | en | ['en', 'en', 'en'] | True |
Response.text | (self) | Get text representation of response body. | Get text representation of response body. | async def text(self) -> str:
"""Get text representation of response body."""
content = await self.buffer()
if isinstance(content, str):
return content
else:
return content.decode('utf-8') | [
"async",
"def",
"text",
"(",
"self",
")",
"->",
"str",
":",
"content",
"=",
"await",
"self",
".",
"buffer",
"(",
")",
"if",
"isinstance",
"(",
"content",
",",
"str",
")",
":",
"return",
"content",
"else",
":",
"return",
"content",
".",
"decode",
"(",... | [
666,
4
] | [
672,
42
] | python | en | ['en', 'en', 'en'] | True |
Response.json | (self) | Get JSON representation of response body. | Get JSON representation of response body. | async def json(self) -> dict:
"""Get JSON representation of response body."""
content = await self.text()
return json.loads(content) | [
"async",
"def",
"json",
"(",
"self",
")",
"->",
"dict",
":",
"content",
"=",
"await",
"self",
".",
"text",
"(",
")",
"return",
"json",
".",
"loads",
"(",
"content",
")"
] | [
674,
4
] | [
677,
34
] | python | en | ['en', 'en', 'en'] | True |
Response.request | (self) | Get matching :class:`Request` object. | Get matching :class:`Request` object. | def request(self) -> Request:
"""Get matching :class:`Request` object."""
return self._request | [
"def",
"request",
"(",
"self",
")",
"->",
"Request",
":",
"return",
"self",
".",
"_request"
] | [
680,
4
] | [
682,
28
] | python | en | ['en', 'en', 'en'] | True |
Response.fromCache | (self) | Return ``True`` if the response was served from cache.
Here `cache` is either the browser's disk cache or memory cache.
| Return ``True`` if the response was served from cache. | def fromCache(self) -> bool:
"""Return ``True`` if the response was served from cache.
Here `cache` is either the browser's disk cache or memory cache.
"""
return self._fromDiskCache or self._request._fromMemoryCache | [
"def",
"fromCache",
"(",
"self",
")",
"->",
"bool",
":",
"return",
"self",
".",
"_fromDiskCache",
"or",
"self",
".",
"_request",
".",
"_fromMemoryCache"
] | [
685,
4
] | [
690,
68
] | python | en | ['en', 'en', 'en'] | True |
Response.fromServiceWorker | (self) | Return ``True`` if the response was served by a service worker. | Return ``True`` if the response was served by a service worker. | def fromServiceWorker(self) -> bool:
"""Return ``True`` if the response was served by a service worker."""
return self._fromServiceWorker | [
"def",
"fromServiceWorker",
"(",
"self",
")",
"->",
"bool",
":",
"return",
"self",
".",
"_fromServiceWorker"
] | [
693,
4
] | [
695,
38
] | python | en | ['en', 'en', 'en'] | True |
SecurityDetails.subjectName | (self) | Return the subject to which the certificate was issued to. | Return the subject to which the certificate was issued to. | def subjectName(self) -> str:
"""Return the subject to which the certificate was issued to."""
return self._subjectName | [
"def",
"subjectName",
"(",
"self",
")",
"->",
"str",
":",
"return",
"self",
".",
"_subjectName"
] | [
742,
4
] | [
744,
32
] | python | en | ['en', 'en', 'en'] | True |
SecurityDetails.issuer | (self) | Return a string with the name of issuer of the certificate. | Return a string with the name of issuer of the certificate. | def issuer(self) -> str:
"""Return a string with the name of issuer of the certificate."""
return self._issuer | [
"def",
"issuer",
"(",
"self",
")",
"->",
"str",
":",
"return",
"self",
".",
"_issuer"
] | [
747,
4
] | [
749,
27
] | python | en | ['en', 'en', 'en'] | True |
SecurityDetails.validFrom | (self) | Return UnixTime of the start of validity of the certificate. | Return UnixTime of the start of validity of the certificate. | def validFrom(self) -> int:
"""Return UnixTime of the start of validity of the certificate."""
return self._validFrom | [
"def",
"validFrom",
"(",
"self",
")",
"->",
"int",
":",
"return",
"self",
".",
"_validFrom"
] | [
752,
4
] | [
754,
30
] | python | en | ['en', 'en', 'en'] | True |
SecurityDetails.validTo | (self) | Return UnixTime of the end of validity of the certificate. | Return UnixTime of the end of validity of the certificate. | def validTo(self) -> int:
"""Return UnixTime of the end of validity of the certificate."""
return self._validTo | [
"def",
"validTo",
"(",
"self",
")",
"->",
"int",
":",
"return",
"self",
".",
"_validTo"
] | [
757,
4
] | [
759,
28
] | python | en | ['en', 'en', 'en'] | True |
SecurityDetails.protocol | (self) | Return string of with the security protocol, e.g. "TLS1.2". | Return string of with the security protocol, e.g. "TLS1.2". | def protocol(self) -> str:
"""Return string of with the security protocol, e.g. "TLS1.2"."""
return self._protocol | [
"def",
"protocol",
"(",
"self",
")",
"->",
"str",
":",
"return",
"self",
".",
"_protocol"
] | [
762,
4
] | [
764,
29
] | python | en | ['en', 'en', 'en'] | True |
default_storage | (request) |
Callable with the same interface as the storage classes.
This isn't just default_storage = import_string(settings.MESSAGE_STORAGE)
to avoid accessing the settings at the module level.
|
Callable with the same interface as the storage classes. | def default_storage(request):
"""
Callable with the same interface as the storage classes.
This isn't just default_storage = import_string(settings.MESSAGE_STORAGE)
to avoid accessing the settings at the module level.
"""
return import_string(settings.MESSAGE_STORAGE)(request) | [
"def",
"default_storage",
"(",
"request",
")",
":",
"return",
"import_string",
"(",
"settings",
".",
"MESSAGE_STORAGE",
")",
"(",
"request",
")"
] | [
4,
0
] | [
11,
59
] | python | en | ['en', 'error', 'th'] | False |
DBObject.__init__ | (self, data=None, database=None, id=None) | Basic initialization.
Inherited classes need to implement any actual database action,
by calling self._init_data() at the end of their __init__
method.
| Basic initialization. | def __init__(self, data=None, database=None, id=None):
"""Basic initialization.
Inherited classes need to implement any actual database action,
by calling self._init_data() at the end of their __init__
method.
"""
# Call the id property to set the _id attribute
s... | [
"def",
"__init__",
"(",
"self",
",",
"data",
"=",
"None",
",",
"database",
"=",
"None",
",",
"id",
"=",
"None",
")",
":",
"# Call the id property to set the _id attribute",
"self",
".",
"_id",
"=",
"id",
"self",
".",
"_data",
"=",
"{",
"}",
"if",
"data",... | [
142,
4
] | [
152,
32
] | python | en | ['en', 'zu', 'en'] | False |
DBObject._init_data | (self) | Set up the data, either by creating a new DBOject or
updating it from the database using the id
This method should only be called from __init__(), probably at the end.
Note that this does prevent proper (multi) inheritance,
because it would get called several times then.
Raise... | Set up the data, either by creating a new DBOject or
updating it from the database using the id | def _init_data(self):
"""Set up the data, either by creating a new DBOject or
updating it from the database using the id
This method should only be called from __init__(), probably at the end.
Note that this does prevent proper (multi) inheritance,
because it would get called s... | [
"def",
"_init_data",
"(",
"self",
")",
":",
"if",
"self",
".",
"_id",
"is",
"not",
"None",
":",
"# object created using an existing table row",
"self",
".",
"update",
"(",
")",
"else",
":",
"# Verify required data keys",
"for",
"key",
"in",
"self",
".",
"REQUI... | [
154,
4
] | [
176,
19
] | python | en | ['en', 'en', 'en'] | True |
DBObject.__getattr__ | (self, name) | Obtain the 'name' attribute, where 'name' is a database column name | Obtain the 'name' attribute, where 'name' is a database column name | def __getattr__(self, name):
"""Obtain the 'name' attribute, where 'name' is a database column name"""
#DEVELOPERS NOTE: if this property fails for some reason, python will
#ignore it, and continue using the __getattr__ method. This is very
#confusing. So if for any reason you are gettin... | [
"def",
"__getattr__",
"(",
"self",
",",
"name",
")",
":",
"#DEVELOPERS NOTE: if this property fails for some reason, python will",
"#ignore it, and continue using the __getattr__ method. This is very",
"#confusing. So if for any reason you are getting 'attribute not found'",
"#errors while you... | [
178,
4
] | [
189,
67
] | python | en | ['en', 'en', 'en'] | True |
DBObject.id | (self) | Add or obtain an id to/from the table
The id is generated if self._id does not exist, effectively
creating a new row in the database.
Several containers have their specific SQL function to create
a new object, so this property will need to overridden.
| Add or obtain an id to/from the table | def id(self):
"""Add or obtain an id to/from the table
The id is generated if self._id does not exist, effectively
creating a new row in the database.
Several containers have their specific SQL function to create
a new object, so this property will need to overridden.
... | [
"def",
"id",
"(",
"self",
")",
":",
"if",
"self",
".",
"_id",
"is",
"None",
":",
"query",
"=",
"(",
"\"INSERT INTO \"",
"+",
"self",
".",
"TABLE",
"+",
"\" (\"",
"+",
"\", \"",
".",
"join",
"(",
"self",
".",
"_data",
".",
"iterkeys",
"(",
")",
")... | [
192,
4
] | [
231,
23
] | python | en | ['en', 'en', 'en'] | True |
DBObject.update | (self, **kwargs) | Update attributes from database, and set database values to
kwargs when provided
This method performs two functions, the first always and the
second optionally after the first:
- it updates the attributes from the database. That is, it
makes sure the Python instance i... | Update attributes from database, and set database values to
kwargs when provided | def update(self, **kwargs):
"""Update attributes from database, and set database values to
kwargs when provided
This method performs two functions, the first always and the
second optionally after the first:
- it updates the attributes from the database. That is, it
... | [
"def",
"update",
"(",
"self",
",",
"*",
"*",
"kwargs",
")",
":",
"self",
".",
"_sync_with_database",
"(",
")",
"self",
".",
"_set_data",
"(",
"*",
"*",
"kwargs",
")"
] | [
233,
4
] | [
256,
32
] | python | en | ['en', 'en', 'en'] | True |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.