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 |
|---|---|---|---|---|---|---|---|---|---|---|---|
_get_current_value | (caller, keyname, comparer=None, formatter=str, only_inherit=False) |
Return current value, marking if value comes from parent or set in this prototype.
Args:
keyname (str): Name of prototoype key to get current value of.
comparer (callable, optional): This will be called as comparer(prototype_value,
flattened_value) and is expected to return the val... |
Return current value, marking if value comes from parent or set in this prototype. | def _get_current_value(caller, keyname, comparer=None, formatter=str, only_inherit=False):
"""
Return current value, marking if value comes from parent or set in this prototype.
Args:
keyname (str): Name of prototoype key to get current value of.
comparer (callable, optional): This will be ... | [
"def",
"_get_current_value",
"(",
"caller",
",",
"keyname",
",",
"comparer",
"=",
"None",
",",
"formatter",
"=",
"str",
",",
"only_inherit",
"=",
"False",
")",
":",
"def",
"_default_comparer",
"(",
"protval",
",",
"flatval",
")",
":",
"if",
"only_inherit",
... | [
286,
0
] | [
341,
48
] | python | en | ['en', 'error', 'th'] | False |
_default_parse | (raw_inp, choices, *args) |
Helper to parse default input to a node decorated with the node_list decorator on
the form l1, l 2, look 1, etc. Spaces are ignored, as is case.
Args:
raw_inp (str): Input from the user.
choices (list): List of available options on the node listing (list of strings).
args (tuples):... |
Helper to parse default input to a node decorated with the node_list decorator on
the form l1, l 2, look 1, etc. Spaces are ignored, as is case. | def _default_parse(raw_inp, choices, *args):
"""
Helper to parse default input to a node decorated with the node_list decorator on
the form l1, l 2, look 1, etc. Spaces are ignored, as is case.
Args:
raw_inp (str): Input from the user.
choices (list): List of available options on the no... | [
"def",
"_default_parse",
"(",
"raw_inp",
",",
"choices",
",",
"*",
"args",
")",
":",
"raw_inp",
"=",
"raw_inp",
".",
"lower",
"(",
")",
".",
"strip",
"(",
")",
"mapping",
"=",
"{",
"t",
".",
"lower",
"(",
")",
":",
"tup",
"[",
"0",
"]",
"for",
... | [
344,
0
] | [
367,
21
] | python | en | ['en', 'error', 'th'] | False |
node_validate_prototype | (caller, raw_string, **kwargs) | General node to view and validate a protototype | General node to view and validate a protototype | def node_validate_prototype(caller, raw_string, **kwargs):
"""General node to view and validate a protototype"""
prototype = _get_flat_menu_prototype(caller, refresh=True, validate=False)
prev_node = kwargs.get("back", "index")
_, text = _validate_prototype(prototype)
helptext = """
The valida... | [
"def",
"node_validate_prototype",
"(",
"caller",
",",
"raw_string",
",",
"*",
"*",
"kwargs",
")",
":",
"prototype",
"=",
"_get_flat_menu_prototype",
"(",
"caller",
",",
"refresh",
"=",
"True",
",",
"validate",
"=",
"False",
")",
"prev_node",
"=",
"kwargs",
"... | [
376,
0
] | [
395,
24
] | python | en | ['en', 'en', 'en'] | True |
node_examine_entity | (caller, raw_string, **kwargs) |
General node to view a text and then return to previous node. Kwargs should contain "text" for
the text to show and 'back" pointing to the node to return to.
|
General node to view a text and then return to previous node. Kwargs should contain "text" for
the text to show and 'back" pointing to the node to return to.
| def node_examine_entity(caller, raw_string, **kwargs):
"""
General node to view a text and then return to previous node. Kwargs should contain "text" for
the text to show and 'back" pointing to the node to return to.
"""
text = kwargs.get("text", "Nothing was found here.")
helptext = "Use |wbac... | [
"def",
"node_examine_entity",
"(",
"caller",
",",
"raw_string",
",",
"*",
"*",
"kwargs",
")",
":",
"text",
"=",
"kwargs",
".",
"get",
"(",
"\"text\"",
",",
"\"Nothing was found here.\"",
")",
"helptext",
"=",
"\"Use |wback|n to return to the previous node.\"",
"prev... | [
400,
0
] | [
415,
24
] | python | en | ['en', 'error', 'th'] | False |
_search_object | (caller) | update search term based on query stored on menu; store match too | update search term based on query stored on menu; store match too | def _search_object(caller):
"update search term based on query stored on menu; store match too"
try:
searchstring = caller.ndb._menutree.olc_search_object_term.strip()
caller.ndb._menutree.olc_search_object_matches = []
except AttributeError:
return []
if not searchstring:
... | [
"def",
"_search_object",
"(",
"caller",
")",
":",
"try",
":",
"searchstring",
"=",
"caller",
".",
"ndb",
".",
"_menutree",
".",
"olc_search_object_term",
".",
"strip",
"(",
")",
"caller",
".",
"ndb",
".",
"_menutree",
".",
"olc_search_object_matches",
"=",
"... | [
420,
0
] | [
452,
65
] | python | en | ['en', 'en', 'en'] | True |
_object_search_actions | (caller, raw_inp, **kwargs) | All this does is to queue a search query | All this does is to queue a search query | def _object_search_actions(caller, raw_inp, **kwargs):
"All this does is to queue a search query"
choices = kwargs['available_choices']
obj_entry, action = _default_parse(
raw_inp, choices, ("examine", "e"), ("create prototype from object", "create", "c"))
raw_inp = raw_inp.strip()
if obj_... | [
"def",
"_object_search_actions",
"(",
"caller",
",",
"raw_inp",
",",
"*",
"*",
"kwargs",
")",
":",
"choices",
"=",
"kwargs",
"[",
"'available_choices'",
"]",
"obj_entry",
",",
"action",
"=",
"_default_parse",
"(",
"raw_inp",
",",
"choices",
",",
"(",
"\"exam... | [
471,
0
] | [
512,
24
] | python | en | ['en', 'en', 'en'] | True |
node_search_object | (caller, raw_inp, **kwargs) |
Node for searching for an existing object.
|
Node for searching for an existing object.
| def node_search_object(caller, raw_inp, **kwargs):
"""
Node for searching for an existing object.
"""
try:
matches = caller.ndb._menutree.olc_search_object_matches
except AttributeError:
matches = []
nmatches = len(matches)
prev_node = kwargs.get("back", "index")
if matc... | [
"def",
"node_search_object",
"(",
"caller",
",",
"raw_inp",
",",
"*",
"*",
"kwargs",
")",
":",
"try",
":",
"matches",
"=",
"caller",
".",
"ndb",
".",
"_menutree",
".",
"olc_search_object_matches",
"except",
"AttributeError",
":",
"matches",
"=",
"[",
"]",
... | [
516,
0
] | [
554,
24
] | python | en | ['en', 'error', 'th'] | False |
_all_prototype_parents | (caller) | Return prototype_key of all available prototypes for listing in menu | Return prototype_key of all available prototypes for listing in menu | def _all_prototype_parents(caller):
"""Return prototype_key of all available prototypes for listing in menu"""
return [prototype["prototype_key"]
for prototype in protlib.search_prototype() if "prototype_key" in prototype] | [
"def",
"_all_prototype_parents",
"(",
"caller",
")",
":",
"return",
"[",
"prototype",
"[",
"\"prototype_key\"",
"]",
"for",
"prototype",
"in",
"protlib",
".",
"search_prototype",
"(",
")",
"if",
"\"prototype_key\"",
"in",
"prototype",
"]"
] | [
707,
0
] | [
710,
88
] | python | en | ['en', 'en', 'en'] | True |
_prototype_parent_actions | (caller, raw_inp, **kwargs) | Parse the default Convert prototype to a string representation for closer inspection | Parse the default Convert prototype to a string representation for closer inspection | def _prototype_parent_actions(caller, raw_inp, **kwargs):
"""Parse the default Convert prototype to a string representation for closer inspection"""
choices = kwargs.get("available_choices", [])
prototype_parent, action = _default_parse(
raw_inp, choices, ("examine", "e", "l"), ("add", "a"), ("remov... | [
"def",
"_prototype_parent_actions",
"(",
"caller",
",",
"raw_inp",
",",
"*",
"*",
"kwargs",
")",
":",
"choices",
"=",
"kwargs",
".",
"get",
"(",
"\"available_choices\"",
",",
"[",
"]",
")",
"prototype_parent",
",",
"action",
"=",
"_default_parse",
"(",
"raw_... | [
713,
0
] | [
770,
38
] | python | en | ['en', 'en', 'en'] | True |
_all_typeclasses | (caller) | Get name of available typeclasses. | Get name of available typeclasses. | def _all_typeclasses(caller):
"""Get name of available typeclasses."""
return list(name for name in
sorted(utils.get_all_typeclasses("evennia.objects.models.ObjectDB").keys())
if name != "evennia.objects.models.ObjectDB") | [
"def",
"_all_typeclasses",
"(",
"caller",
")",
":",
"return",
"list",
"(",
"name",
"for",
"name",
"in",
"sorted",
"(",
"utils",
".",
"get_all_typeclasses",
"(",
"\"evennia.objects.models.ObjectDB\"",
")",
".",
"keys",
"(",
")",
")",
"if",
"name",
"!=",
"\"ev... | [
846,
0
] | [
850,
61
] | python | en | ['en', 'en', 'en'] | True |
_typeclass_actions | (caller, raw_inp, **kwargs) | Parse actions for typeclass listing | Parse actions for typeclass listing | def _typeclass_actions(caller, raw_inp, **kwargs):
"""Parse actions for typeclass listing"""
choices = kwargs.get("available_choices", [])
typeclass_path, action = _default_parse(
raw_inp, choices, ("examine", "e", "l"), ("remove", "r", "delete", "d"))
if typeclass_path:
if action == '... | [
"def",
"_typeclass_actions",
"(",
"caller",
",",
"raw_inp",
",",
"*",
"*",
"kwargs",
")",
":",
"choices",
"=",
"kwargs",
".",
"get",
"(",
"\"available_choices\"",
",",
"[",
"]",
")",
"typeclass_path",
",",
"action",
"=",
"_default_parse",
"(",
"raw_inp",
"... | [
853,
0
] | [
885,
31
] | python | en | ['en', 'en', 'en'] | True |
_typeclass_select | (caller, typeclass) | Select typeclass from list and add it to prototype. Return next node to go to. | Select typeclass from list and add it to prototype. Return next node to go to. | def _typeclass_select(caller, typeclass):
"""Select typeclass from list and add it to prototype. Return next node to go to."""
ret = _set_property(caller, typeclass, prop='typeclass', processor=str)
caller.msg("Selected typeclass |c{}|n.".format(typeclass))
return ret | [
"def",
"_typeclass_select",
"(",
"caller",
",",
"typeclass",
")",
":",
"ret",
"=",
"_set_property",
"(",
"caller",
",",
"typeclass",
",",
"prop",
"=",
"'typeclass'",
",",
"processor",
"=",
"str",
")",
"caller",
".",
"msg",
"(",
"\"Selected typeclass |c{}|n.\""... | [
888,
0
] | [
892,
14
] | python | en | ['en', 'en', 'en'] | True |
_all_aliases | (caller) | Get aliases in prototype | Get aliases in prototype | def _all_aliases(caller):
"Get aliases in prototype"
prototype = _get_menu_prototype(caller)
return prototype.get("aliases", []) | [
"def",
"_all_aliases",
"(",
"caller",
")",
":",
"prototype",
"=",
"_get_menu_prototype",
"(",
"caller",
")",
"return",
"prototype",
".",
"get",
"(",
"\"aliases\"",
",",
"[",
"]",
")"
] | [
956,
0
] | [
959,
39
] | python | en | ['en', 'sr', 'en'] | True |
_aliases_select | (caller, alias) | Add numbers as aliases | Add numbers as aliases | def _aliases_select(caller, alias):
"Add numbers as aliases"
aliases = _all_aliases(caller)
try:
ind = str(aliases.index(alias) + 1)
if ind not in aliases:
aliases.append(ind)
_set_prototype_value(caller, "aliases", aliases)
caller.msg("Added alias '{}'.".... | [
"def",
"_aliases_select",
"(",
"caller",
",",
"alias",
")",
":",
"aliases",
"=",
"_all_aliases",
"(",
"caller",
")",
"try",
":",
"ind",
"=",
"str",
"(",
"aliases",
".",
"index",
"(",
"alias",
")",
"+",
"1",
")",
"if",
"ind",
"not",
"in",
"aliases",
... | [
962,
0
] | [
974,
25
] | python | en | ['en', 'en', 'en'] | True |
_aliases_actions | (caller, raw_inp, **kwargs) | Parse actions for aliases listing | Parse actions for aliases listing | def _aliases_actions(caller, raw_inp, **kwargs):
"""Parse actions for aliases listing"""
choices = kwargs.get("available_choices", [])
alias, action = _default_parse(
raw_inp, choices, ("remove", "r", "delete", "d"))
aliases = _all_aliases(caller)
if alias and action == 'remove':
tr... | [
"def",
"_aliases_actions",
"(",
"caller",
",",
"raw_inp",
",",
"*",
"*",
"kwargs",
")",
":",
"choices",
"=",
"kwargs",
".",
"get",
"(",
"\"available_choices\"",
",",
"[",
"]",
")",
"alias",
",",
"action",
"=",
"_default_parse",
"(",
"raw_inp",
",",
"choi... | [
977,
0
] | [
1000,
25
] | python | en | ['en', 'en', 'en'] | True |
_display_attribute | (attr_tuple) | Pretty-print attribute tuple | Pretty-print attribute tuple | def _display_attribute(attr_tuple):
"""Pretty-print attribute tuple"""
attrkey, value, category, locks = attr_tuple
value = protlib.protfunc_parser(value)
typ = type(value)
out = ("{attrkey} |c=|n {value} |W({typ}{category}{locks})|n".format(
attrkey=attrkey,
value=value,
... | [
"def",
"_display_attribute",
"(",
"attr_tuple",
")",
":",
"attrkey",
",",
"value",
",",
"category",
",",
"locks",
"=",
"attr_tuple",
"value",
"=",
"protlib",
".",
"protfunc_parser",
"(",
"value",
")",
"typ",
"=",
"type",
"(",
"value",
")",
"out",
"=",
"(... | [
1056,
0
] | [
1068,
14
] | python | en | ['en', 'it', 'en'] | True |
_add_attr | (caller, attr_string, **kwargs) |
Add new attribute, parsing input.
Args:
caller (Object): Caller of menu.
attr_string (str): Input from user
attr is entered on these forms
attr = value
attr;category = value
attr;category;lockstring = value
Kwargs:
delete ... |
Add new attribute, parsing input. | def _add_attr(caller, attr_string, **kwargs):
"""
Add new attribute, parsing input.
Args:
caller (Object): Caller of menu.
attr_string (str): Input from user
attr is entered on these forms
attr = value
attr;category = value
attr;ca... | [
"def",
"_add_attr",
"(",
"caller",
",",
"attr_string",
",",
"*",
"*",
"kwargs",
")",
":",
"attrname",
"=",
"''",
"value",
"=",
"''",
"category",
"=",
"None",
"locks",
"=",
"''",
"if",
"'delete'",
"in",
"kwargs",
":",
"attrname",
"=",
"attr_string",
"."... | [
1071,
0
] | [
1133,
15
] | python | en | ['en', 'error', 'th'] | False |
_attrs_actions | (caller, raw_inp, **kwargs) | Parse actions for attribute listing | Parse actions for attribute listing | def _attrs_actions(caller, raw_inp, **kwargs):
"""Parse actions for attribute listing"""
choices = kwargs.get("available_choices", [])
attrstr, action = _default_parse(
raw_inp, choices, ('examine', 'e'), ('remove', 'r', 'delete', 'd'))
if attrstr is None:
attrstr = raw_inp
try:
... | [
"def",
"_attrs_actions",
"(",
"caller",
",",
"raw_inp",
",",
"*",
"*",
"kwargs",
")",
":",
"choices",
"=",
"kwargs",
".",
"get",
"(",
"\"available_choices\"",
",",
"[",
"]",
")",
"attrstr",
",",
"action",
"=",
"_default_parse",
"(",
"raw_inp",
",",
"choi... | [
1149,
0
] | [
1175,
23
] | python | en | ['en', 'en', 'en'] | True |
_display_tag | (tag_tuple) | Pretty-print tag tuple | Pretty-print tag tuple | def _display_tag(tag_tuple):
"""Pretty-print tag tuple"""
tagkey, category, data = tag_tuple
out = ("Tag: '{tagkey}' (category: {category}{dat})".format(
tagkey=tagkey, category=category, dat=", data: {}".format(data) if data else ""))
return out | [
"def",
"_display_tag",
"(",
"tag_tuple",
")",
":",
"tagkey",
",",
"category",
",",
"data",
"=",
"tag_tuple",
"out",
"=",
"(",
"\"Tag: '{tagkey}' (category: {category}{dat})\"",
".",
"format",
"(",
"tagkey",
"=",
"tagkey",
",",
"category",
"=",
"category",
",",
... | [
1244,
0
] | [
1249,
14
] | python | en | ['en', 'hmn', 'en'] | True |
_add_tag | (caller, tag_string, **kwargs) |
Add tags to the system, parsing input
Args:
caller (Object): Caller of menu.
tag_string (str): Input from user on one of these forms
tagname
tagname;category
tagname;category;data
Kwargs:
delete (str): If this is set, tag_string is considered
... |
Add tags to the system, parsing input | def _add_tag(caller, tag_string, **kwargs):
"""
Add tags to the system, parsing input
Args:
caller (Object): Caller of menu.
tag_string (str): Input from user on one of these forms
tagname
tagname;category
tagname;category;data
Kwargs:
delete... | [
"def",
"_add_tag",
"(",
"caller",
",",
"tag_string",
",",
"*",
"*",
"kwargs",
")",
":",
"tag",
"=",
"tag_string",
".",
"strip",
"(",
")",
".",
"lower",
"(",
")",
"category",
"=",
"None",
"data",
"=",
"\"\"",
"if",
"'delete'",
"in",
"kwargs",
":",
"... | [
1252,
0
] | [
1314,
15
] | python | en | ['en', 'error', 'th'] | False |
_tags_actions | (caller, raw_inp, **kwargs) | Parse actions for tags listing | Parse actions for tags listing | def _tags_actions(caller, raw_inp, **kwargs):
"""Parse actions for tags listing"""
choices = kwargs.get("available_choices", [])
tagname, action = _default_parse(
raw_inp, choices, ('examine', 'e'), ('remove', 'r', 'delete', 'd'))
if tagname is None:
tagname = raw_inp.lower().strip(... | [
"def",
"_tags_actions",
"(",
"caller",
",",
"raw_inp",
",",
"*",
"*",
"kwargs",
")",
":",
"choices",
"=",
"kwargs",
".",
"get",
"(",
"\"available_choices\"",
",",
"[",
"]",
")",
"tagname",
",",
"action",
"=",
"_default_parse",
"(",
"raw_inp",
",",
"choic... | [
1327,
0
] | [
1348,
22
] | python | en | ['en', 'en', 'en'] | True |
_permissions_actions | (caller, raw_inp, **kwargs) | Parse actions for permission listing | Parse actions for permission listing | def _permissions_actions(caller, raw_inp, **kwargs):
"""Parse actions for permission listing"""
choices = kwargs.get("available_choices", [])
perm, action = _default_parse(
raw_inp, choices, ('examine', 'e'), ('remove', 'r', 'delete', 'd'))
if perm:
if action == 'examine':
... | [
"def",
"_permissions_actions",
"(",
"caller",
",",
"raw_inp",
",",
"*",
"*",
"kwargs",
")",
":",
"choices",
"=",
"kwargs",
".",
"get",
"(",
"\"available_choices\"",
",",
"[",
"]",
")",
"perm",
",",
"action",
"=",
"_default_parse",
"(",
"raw_inp",
",",
"c... | [
1556,
0
] | [
1572,
29
] | python | en | ['en', 'en', 'en'] | True |
_add_prototype_tag | (caller, tag_string, **kwargs) |
Add prototype_tags to the system. We only support straight tags, no
categories (category is assigned automatically).
Args:
caller (Object): Caller of menu.
tag_string (str): Input from user - only tagname
Kwargs:
delete (str): If this is set, tag_string is considered
... |
Add prototype_tags to the system. We only support straight tags, no
categories (category is assigned automatically). | def _add_prototype_tag(caller, tag_string, **kwargs):
"""
Add prototype_tags to the system. We only support straight tags, no
categories (category is assigned automatically).
Args:
caller (Object): Caller of menu.
tag_string (str): Input from user - only tagname
Kwargs:
del... | [
"def",
"_add_prototype_tag",
"(",
"caller",
",",
"tag_string",
",",
"*",
"*",
"kwargs",
")",
":",
"tag",
"=",
"tag_string",
".",
"strip",
"(",
")",
".",
"lower",
"(",
")",
"if",
"tag",
":",
"prot",
"=",
"_get_menu_prototype",
"(",
"caller",
")",
"tags"... | [
1750,
0
] | [
1791,
15
] | python | en | ['en', 'error', 'th'] | False |
_prototype_tags_actions | (caller, raw_inp, **kwargs) | Parse actions for tags listing | Parse actions for tags listing | def _prototype_tags_actions(caller, raw_inp, **kwargs):
"""Parse actions for tags listing"""
choices = kwargs.get("available_choices", [])
tagname, action = _default_parse(
raw_inp, choices, ('remove', 'r', 'delete', 'd'))
if tagname:
if action == 'remove':
res = _add_pr... | [
"def",
"_prototype_tags_actions",
"(",
"caller",
",",
"raw_inp",
",",
"*",
"*",
"kwargs",
")",
":",
"choices",
"=",
"kwargs",
".",
"get",
"(",
"\"available_choices\"",
",",
"[",
"]",
")",
"tagname",
",",
"action",
"=",
"_default_parse",
"(",
"raw_inp",
","... | [
1799,
0
] | [
1812,
32
] | python | en | ['en', 'en', 'en'] | True |
_apply_diff | (caller, **kwargs) | update existing objects | update existing objects | def _apply_diff(caller, **kwargs):
"""update existing objects"""
prototype = kwargs['prototype']
objects = kwargs['objects']
back_node = kwargs['back_node']
diff = kwargs.get('diff', None)
num_changed = spawner.batch_update_objects_with_prototype(prototype, diff=diff, objects=objects)
caller... | [
"def",
"_apply_diff",
"(",
"caller",
",",
"*",
"*",
"kwargs",
")",
":",
"prototype",
"=",
"kwargs",
"[",
"'prototype'",
"]",
"objects",
"=",
"kwargs",
"[",
"'objects'",
"]",
"back_node",
"=",
"kwargs",
"[",
"'back_node'",
"]",
"diff",
"=",
"kwargs",
".",... | [
1946,
0
] | [
1954,
20
] | python | en | ['es', 'en', 'en'] | True |
_keep_diff | (caller, **kwargs) | Change to KEEP setting for a given section of a diff | Change to KEEP setting for a given section of a diff | def _keep_diff(caller, **kwargs):
"""Change to KEEP setting for a given section of a diff"""
# from evennia import set_trace;set_trace(term_size=(182, 50))
path = kwargs['path']
diff = kwargs['diff']
tmp = diff
for key in path[:-1]:
tmp = tmp[key]
tmp[path[-1]] = tuple(list(tmp[path[... | [
"def",
"_keep_diff",
"(",
"caller",
",",
"*",
"*",
"kwargs",
")",
":",
"# from evennia import set_trace;set_trace(term_size=(182, 50))",
"path",
"=",
"kwargs",
"[",
"'path'",
"]",
"diff",
"=",
"kwargs",
"[",
"'diff'",
"]",
"tmp",
"=",
"diff",
"for",
"key",
"in... | [
1957,
0
] | [
1965,
62
] | python | en | ['en', 'en', 'en'] | True |
_format_diff_text_and_options | (diff, **kwargs) |
Reformat the diff in a way suitable for the olc menu.
Args:
diff (dict): A diff as produced by `prototype_diff`.
Kwargs:
any (any): Forwarded into the generated options as arguments to the callable.
Returns:
texts (list): List of texts.
options (list): List of options... |
Reformat the diff in a way suitable for the olc menu. | def _format_diff_text_and_options(diff, **kwargs):
"""
Reformat the diff in a way suitable for the olc menu.
Args:
diff (dict): A diff as produced by `prototype_diff`.
Kwargs:
any (any): Forwarded into the generated options as arguments to the callable.
Returns:
texts (lis... | [
"def",
"_format_diff_text_and_options",
"(",
"diff",
",",
"*",
"*",
"kwargs",
")",
":",
"valid_instructions",
"=",
"(",
"'KEEP'",
",",
"'REMOVE'",
",",
"'ADD'",
",",
"'UPDATE'",
")",
"def",
"_visualize",
"(",
"obj",
",",
"rootname",
",",
"get_name",
"=",
"... | [
1968,
0
] | [
2045,
25
] | python | en | ['en', 'error', 'th'] | False |
node_apply_diff | (caller, **kwargs) | Offer options for updating objects | Offer options for updating objects | def node_apply_diff(caller, **kwargs):
"""Offer options for updating objects"""
def _keep_option(keyname, prototype, base_obj, obj_prototype, diff, objects, back_node):
"""helper returning an option dict"""
options = {"desc": "Keep {} as-is".format(keyname),
"goto": (_keep_di... | [
"def",
"node_apply_diff",
"(",
"caller",
",",
"*",
"*",
"kwargs",
")",
":",
"def",
"_keep_option",
"(",
"keyname",
",",
"prototype",
",",
"base_obj",
",",
"obj_prototype",
",",
"diff",
",",
"objects",
",",
"back_node",
")",
":",
"\"\"\"helper returning an opti... | [
2048,
0
] | [
2123,
24
] | python | en | ['en', 'en', 'en'] | True |
node_prototype_save | (caller, **kwargs) | Save prototype to disk | Save prototype to disk | def node_prototype_save(caller, **kwargs):
"""Save prototype to disk """
# these are only set if we selected 'yes' to save on a previous pass
prototype = kwargs.get("prototype", None)
# set to True/False if answered, None if first pass
accept_save = kwargs.get("accept_save", None)
if accept_sav... | [
"def",
"node_prototype_save",
"(",
"caller",
",",
"*",
"*",
"kwargs",
")",
":",
"# these are only set if we selected 'yes' to save on a previous pass",
"prototype",
"=",
"kwargs",
".",
"get",
"(",
"\"prototype\"",
",",
"None",
")",
"# set to True/False if answered, None if ... | [
2129,
0
] | [
2227,
25
] | python | en | ['en', 'en', 'en'] | True |
_spawn | (caller, **kwargs) | Spawn prototype | Spawn prototype | def _spawn(caller, **kwargs):
"""Spawn prototype"""
prototype = kwargs["prototype"].copy()
new_location = kwargs.get('location', None)
if new_location:
prototype['location'] = new_location
if not prototype.get('location'):
prototype['location'] = caller
obj = spawner.spawn(proto... | [
"def",
"_spawn",
"(",
"caller",
",",
"*",
"*",
"kwargs",
")",
":",
"prototype",
"=",
"kwargs",
"[",
"\"prototype\"",
"]",
".",
"copy",
"(",
")",
"new_location",
"=",
"kwargs",
".",
"get",
"(",
"'location'",
",",
"None",
")",
"if",
"new_location",
":",
... | [
2233,
0
] | [
2249,
75
] | python | en | ['en', 'sr', 'en'] | False |
node_prototype_spawn | (caller, **kwargs) | Submenu for spawning the prototype | Submenu for spawning the prototype | def node_prototype_spawn(caller, **kwargs):
"""Submenu for spawning the prototype"""
prototype = _get_menu_prototype(caller)
already_validated = kwargs.get("already_validated", False)
if already_validated:
error, text = None, []
else:
error, text = _validate_prototype(prototype)
... | [
"def",
"node_prototype_spawn",
"(",
"caller",
",",
"*",
"*",
"kwargs",
")",
":",
"prototype",
"=",
"_get_menu_prototype",
"(",
"caller",
")",
"already_validated",
"=",
"kwargs",
".",
"get",
"(",
"\"already_validated\"",
",",
"False",
")",
"if",
"already_validate... | [
2252,
0
] | [
2317,
24
] | python | en | ['en', 'en', 'en'] | True |
_prototype_load_actions | (caller, raw_inp, **kwargs) | Parse the default Convert prototype to a string representation for closer inspection | Parse the default Convert prototype to a string representation for closer inspection | def _prototype_load_actions(caller, raw_inp, **kwargs):
"""Parse the default Convert prototype to a string representation for closer inspection"""
choices = kwargs.get("available_choices", [])
prototype, action = _default_parse(
raw_inp, choices, ("examine", "e", "l"), ("delete", "del", "d"))
i... | [
"def",
"_prototype_load_actions",
"(",
"caller",
",",
"raw_inp",
",",
"*",
"*",
"kwargs",
")",
":",
"choices",
"=",
"kwargs",
".",
"get",
"(",
"\"available_choices\"",
",",
"[",
"]",
")",
"prototype",
",",
"action",
"=",
"_default_parse",
"(",
"raw_inp",
"... | [
2336,
0
] | [
2360,
32
] | python | en | ['en', 'en', 'en'] | True |
node_prototype_load | (caller, **kwargs) | Load prototype | Load prototype | def node_prototype_load(caller, **kwargs):
"""Load prototype"""
text = """
Select a prototype to load. This will replace any prototype currently being edited!
"""
_set_actioninfo(caller, _format_list_actions("examine", "delete"))
helptext = """
Loading a prototype will load it and ... | [
"def",
"node_prototype_load",
"(",
"caller",
",",
"*",
"*",
"kwargs",
")",
":",
"text",
"=",
"\"\"\"\n Select a prototype to load. This will replace any prototype currently being edited!\n \"\"\"",
"_set_actioninfo",
"(",
"caller",
",",
"_format_list_actions",
"(",
"\... | [
2364,
0
] | [
2383,
24
] | python | en | ['en', 'sr', 'en'] | False |
start_olc | (caller, session=None, prototype=None) |
Start menu-driven olc system for prototypes.
Args:
caller (Object or Account): The entity starting the menu.
session (Session, optional): The individual session to get data.
prototype (dict, optional): Given when editing an existing
prototype rather than creating a new one.... |
Start menu-driven olc system for prototypes. | def start_olc(caller, session=None, prototype=None):
"""
Start menu-driven olc system for prototypes.
Args:
caller (Object or Account): The entity starting the menu.
session (Session, optional): The individual session to get data.
prototype (dict, optional): Given when editing an ex... | [
"def",
"start_olc",
"(",
"caller",
",",
"session",
"=",
"None",
",",
"prototype",
"=",
"None",
")",
":",
"menudata",
"=",
"{",
"\"node_index\"",
":",
"node_index",
",",
"\"node_validate_prototype\"",
":",
"node_validate_prototype",
",",
"\"node_examine_entity\"",
... | [
2437,
0
] | [
2473,
48
] | python | en | ['en', 'error', 'th'] | False |
OLCMenu.nodetext_formatter | (self, nodetext) |
Format the node text itself.
|
Format the node text itself. | def nodetext_formatter(self, nodetext):
"""
Format the node text itself.
"""
return super(OLCMenu, self).nodetext_formatter(nodetext) | [
"def",
"nodetext_formatter",
"(",
"self",
",",
"nodetext",
")",
":",
"return",
"super",
"(",
"OLCMenu",
",",
"self",
")",
".",
"nodetext_formatter",
"(",
"nodetext",
")"
] | [
2394,
4
] | [
2399,
64
] | python | en | ['en', 'error', 'th'] | False |
OLCMenu.options_formatter | (self, optionlist) |
Split the options into two blocks - olc options and normal options
|
Split the options into two blocks - olc options and normal options | def options_formatter(self, optionlist):
"""
Split the options into two blocks - olc options and normal options
"""
olc_keys = ("index", "forward", "back", "previous", "next", "validate prototype",
"save prototype", "load prototype", "spawn prototype", "search object... | [
"def",
"options_formatter",
"(",
"self",
",",
"optionlist",
")",
":",
"olc_keys",
"=",
"(",
"\"index\"",
",",
"\"forward\"",
",",
"\"back\"",
",",
"\"previous\"",
",",
"\"next\"",
",",
"\"validate prototype\"",
",",
"\"save prototype\"",
",",
"\"load prototype\"",
... | [
2401,
4
] | [
2425,
63
] | python | en | ['en', 'error', 'th'] | False |
OLCMenu.helptext_formatter | (self, helptext) |
Show help text
|
Show help text
| def helptext_formatter(self, helptext):
"""
Show help text
"""
return "|c --- Help ---|n\n" + utils.dedent(helptext) | [
"def",
"helptext_formatter",
"(",
"self",
",",
"helptext",
")",
":",
"return",
"\"|c --- Help ---|n\\n\"",
"+",
"utils",
".",
"dedent",
"(",
"helptext",
")"
] | [
2427,
4
] | [
2431,
61
] | python | en | ['en', 'error', 'th'] | False |
Tickfont.color | (self) |
The 'color' property is a color and may be specified as:
- A hex string (e.g. '#ff0000')
- An rgb/rgba string (e.g. 'rgb(255,0,0)')
- An hsl/hsla string (e.g. 'hsl(0,100%,50%)')
- An hsv/hsva string (e.g. 'hsv(0,100%,100%)')
- A named CSS color:
... |
The 'color' property is a color and may be specified as:
- A hex string (e.g. '#ff0000')
- An rgb/rgba string (e.g. 'rgb(255,0,0)')
- An hsl/hsla string (e.g. 'hsl(0,100%,50%)')
- An hsv/hsva string (e.g. 'hsv(0,100%,100%)')
- A named CSS color:
... | def color(self):
"""
The 'color' property is a color and may be specified as:
- A hex string (e.g. '#ff0000')
- An rgb/rgba string (e.g. 'rgb(255,0,0)')
- An hsl/hsla string (e.g. 'hsl(0,100%,50%)')
- An hsv/hsva string (e.g. 'hsv(0,100%,100%)')
- A name... | [
"def",
"color",
"(",
"self",
")",
":",
"return",
"self",
"[",
"\"color\"",
"]"
] | [
15,
4
] | [
63,
28
] | python | en | ['en', 'error', 'th'] | False |
Tickfont.family | (self) |
HTML font family - the typeface that will be applied by the web
browser. The web browser will only be able to apply a font if
it is available on the system which it operates. Provide
multiple font families, separated by commas, to indicate the
preference in which to apply fonts ... |
HTML font family - the typeface that will be applied by the web
browser. The web browser will only be able to apply a font if
it is available on the system which it operates. Provide
multiple font families, separated by commas, to indicate the
preference in which to apply fonts ... | def family(self):
"""
HTML font family - the typeface that will be applied by the web
browser. The web browser will only be able to apply a font if
it is available on the system which it operates. Provide
multiple font families, separated by commas, to indicate the
prefer... | [
"def",
"family",
"(",
"self",
")",
":",
"return",
"self",
"[",
"\"family\"",
"]"
] | [
72,
4
] | [
94,
29
] | python | en | ['en', 'error', 'th'] | False |
Tickfont.size | (self) |
The 'size' property is a number and may be specified as:
- An int or float in the interval [1, inf]
Returns
-------
int|float
|
The 'size' property is a number and may be specified as:
- An int or float in the interval [1, inf] | def size(self):
"""
The 'size' property is a number and may be specified as:
- An int or float in the interval [1, inf]
Returns
-------
int|float
"""
return self["size"] | [
"def",
"size",
"(",
"self",
")",
":",
"return",
"self",
"[",
"\"size\"",
"]"
] | [
103,
4
] | [
112,
27
] | python | en | ['en', 'error', 'th'] | False |
Tickfont.__init__ | (self, arg=None, color=None, family=None, size=None, **kwargs) |
Construct a new Tickfont object
Sets the color bar's tick label font
Parameters
----------
arg
dict of properties compatible with this constructor or
an instance of :class:`plotly.graph_objs.contourcarpet.
colorbar.Tickfont`
... |
Construct a new Tickfont object
Sets the color bar's tick label font | def __init__(self, arg=None, color=None, family=None, size=None, **kwargs):
"""
Construct a new Tickfont object
Sets the color bar's tick label font
Parameters
----------
arg
dict of properties compatible with this constructor or
an insta... | [
"def",
"__init__",
"(",
"self",
",",
"arg",
"=",
"None",
",",
"color",
"=",
"None",
",",
"family",
"=",
"None",
",",
"size",
"=",
"None",
",",
"*",
"*",
"kwargs",
")",
":",
"super",
"(",
"Tickfont",
",",
"self",
")",
".",
"__init__",
"(",
"\"tick... | [
143,
4
] | [
226,
34
] | python | en | ['en', 'error', 'th'] | False |
Tickformatstop.dtickrange | (self) |
range [*min*, *max*], where "min", "max" - dtick values which
describe some zoom level, it is possible to omit "min" or "max"
value by passing "null"
The 'dtickrange' property is an info array that may be specified as:
* a list or tuple of 2 elements where:
(0) The... |
range [*min*, *max*], where "min", "max" - dtick values which
describe some zoom level, it is possible to omit "min" or "max"
value by passing "null"
The 'dtickrange' property is an info array that may be specified as:
* a list or tuple of 2 elements where:
(0) The... | def dtickrange(self):
"""
range [*min*, *max*], where "min", "max" - dtick values which
describe some zoom level, it is possible to omit "min" or "max"
value by passing "null"
The 'dtickrange' property is an info array that may be specified as:
* a list or tuple... | [
"def",
"dtickrange",
"(",
"self",
")",
":",
"return",
"self",
"[",
"\"dtickrange\"",
"]"
] | [
15,
4
] | [
31,
33
] | python | en | ['en', 'error', 'th'] | False |
Tickformatstop.enabled | (self) |
Determines whether or not this stop is used. If `false`, this
stop is ignored even within its `dtickrange`.
The 'enabled' property must be specified as a bool
(either True, or False)
Returns
-------
bool
|
Determines whether or not this stop is used. If `false`, this
stop is ignored even within its `dtickrange`.
The 'enabled' property must be specified as a bool
(either True, or False) | def enabled(self):
"""
Determines whether or not this stop is used. If `false`, this
stop is ignored even within its `dtickrange`.
The 'enabled' property must be specified as a bool
(either True, or False)
Returns
-------
bool
"""
ret... | [
"def",
"enabled",
"(",
"self",
")",
":",
"return",
"self",
"[",
"\"enabled\"",
"]"
] | [
40,
4
] | [
52,
30
] | python | en | ['en', 'error', 'th'] | False |
Tickformatstop.name | (self) |
When used in a template, named items are created in the output
figure in addition to any items the figure already has in this
array. You can modify these items in the output figure by
making your own item with `templateitemname` matching this
`name` alongside your modifications ... |
When used in a template, named items are created in the output
figure in addition to any items the figure already has in this
array. You can modify these items in the output figure by
making your own item with `templateitemname` matching this
`name` alongside your modifications ... | def name(self):
"""
When used in a template, named items are created in the output
figure in addition to any items the figure already has in this
array. You can modify these items in the output figure by
making your own item with `templateitemname` matching this
`name` al... | [
"def",
"name",
"(",
"self",
")",
":",
"return",
"self",
"[",
"\"name\"",
"]"
] | [
61,
4
] | [
79,
27
] | python | en | ['en', 'error', 'th'] | False |
Tickformatstop.templateitemname | (self) |
Used to refer to a named item in this array in the template.
Named items from the template will be created even without a
matching item in the input figure, but you can modify one by
making an item with `templateitemname` matching its `name`,
alongside your modifications (includ... |
Used to refer to a named item in this array in the template.
Named items from the template will be created even without a
matching item in the input figure, but you can modify one by
making an item with `templateitemname` matching its `name`,
alongside your modifications (includ... | def templateitemname(self):
"""
Used to refer to a named item in this array in the template.
Named items from the template will be created even without a
matching item in the input figure, but you can modify one by
making an item with `templateitemname` matching its `name`,
... | [
"def",
"templateitemname",
"(",
"self",
")",
":",
"return",
"self",
"[",
"\"templateitemname\"",
"]"
] | [
88,
4
] | [
107,
39
] | python | en | ['en', 'error', 'th'] | False |
Tickformatstop.value | (self) |
string - dtickformat for described zoom level, the same as
"tickformat"
The 'value' property is a string and must be specified as:
- A string
- A number that will be converted to a string
Returns
-------
str
|
string - dtickformat for described zoom level, the same as
"tickformat"
The 'value' property is a string and must be specified as:
- A string
- A number that will be converted to a string | def value(self):
"""
string - dtickformat for described zoom level, the same as
"tickformat"
The 'value' property is a string and must be specified as:
- A string
- A number that will be converted to a string
Returns
-------
str
"... | [
"def",
"value",
"(",
"self",
")",
":",
"return",
"self",
"[",
"\"value\"",
"]"
] | [
116,
4
] | [
129,
28
] | python | en | ['en', 'error', 'th'] | False |
Tickformatstop.__init__ | (
self,
arg=None,
dtickrange=None,
enabled=None,
name=None,
templateitemname=None,
value=None,
**kwargs
) |
Construct a new Tickformatstop object
Parameters
----------
arg
dict of properties compatible with this constructor or
an instance of :class:`plotly.graph_objs.indicator.gaug
e.axis.Tickformatstop`
dtickrange
range [*min*,... |
Construct a new Tickformatstop object
Parameters
----------
arg
dict of properties compatible with this constructor or
an instance of :class:`plotly.graph_objs.indicator.gaug
e.axis.Tickformatstop`
dtickrange
range [*min*,... | def __init__(
self,
arg=None,
dtickrange=None,
enabled=None,
name=None,
templateitemname=None,
value=None,
**kwargs
):
"""
Construct a new Tickformatstop object
Parameters
----------
arg
dict... | [
"def",
"__init__",
"(",
"self",
",",
"arg",
"=",
"None",
",",
"dtickrange",
"=",
"None",
",",
"enabled",
"=",
"None",
",",
"name",
"=",
"None",
",",
"templateitemname",
"=",
"None",
",",
"value",
"=",
"None",
",",
"*",
"*",
"kwargs",
")",
":",
"sup... | [
172,
4
] | [
282,
34
] | python | en | ['en', 'error', 'th'] | False |
TypeclassBase.__new__ | (cls, name, bases, attrs) |
We must define our Typeclasses as proxies. We also store the
path directly on the class, this is required by managers.
|
We must define our Typeclasses as proxies. We also store the
path directly on the class, this is required by managers.
| def __new__(cls, name, bases, attrs):
"""
We must define our Typeclasses as proxies. We also store the
path directly on the class, this is required by managers.
"""
# storage of stats
attrs["typename"] = name
attrs["path"] = "%s.%s" % (attrs["__module__"], name)
... | [
"def",
"__new__",
"(",
"cls",
",",
"name",
",",
"bases",
",",
"attrs",
")",
":",
"# storage of stats",
"attrs",
"[",
"\"typename\"",
"]",
"=",
"name",
"attrs",
"[",
"\"path\"",
"]",
"=",
"\"%s.%s\"",
"%",
"(",
"attrs",
"[",
"\"__module__\"",
"]",
",",
... | [
78,
4
] | [
101,
24
] | python | en | ['en', 'error', 'th'] | False |
TypedObject.__init__ | (self, *args, **kwargs) |
The `__init__` method of typeclasses is the core operational
code of the typeclass system, where it dynamically re-applies
a class based on the db_typeclass_path database field rather
than use the one in the model.
Args:
Passed through to parent.
Kwargs:
... |
The `__init__` method of typeclasses is the core operational
code of the typeclass system, where it dynamically re-applies
a class based on the db_typeclass_path database field rather
than use the one in the model. | def __init__(self, *args, **kwargs):
"""
The `__init__` method of typeclasses is the core operational
code of the typeclass system, where it dynamically re-applies
a class based on the db_typeclass_path database field rather
than use the one in the model.
Args:
... | [
"def",
"__init__",
"(",
"self",
",",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"typeclass_path",
"=",
"kwargs",
".",
"pop",
"(",
"\"typeclass\"",
",",
"None",
")",
"super",
"(",
"TypedObject",
",",
"self",
")",
".",
"__init__",
"(",
"*",
"args"... | [
226,
4
] | [
259,
68
] | python | en | ['en', 'error', 'th'] | False |
TypedObject.__dbid_get | (self) |
Caches and returns the unique id of the object.
Use this instead of self.id, which is not cached.
|
Caches and returns the unique id of the object.
Use this instead of self.id, which is not cached.
| def __dbid_get(self):
"""
Caches and returns the unique id of the object.
Use this instead of self.id, which is not cached.
"""
return self.id | [
"def",
"__dbid_get",
"(",
"self",
")",
":",
"return",
"self",
".",
"id"
] | [
345,
4
] | [
350,
22
] | python | en | ['en', 'error', 'th'] | False |
TypedObject.__dbref_get | (self) |
Returns the object's dbref on the form #NN.
|
Returns the object's dbref on the form #NN.
| def __dbref_get(self):
"""
Returns the object's dbref on the form #NN.
"""
return "#%s" % self.id | [
"def",
"__dbref_get",
"(",
"self",
")",
":",
"return",
"\"#%s\"",
"%",
"self",
".",
"id"
] | [
360,
4
] | [
364,
30
] | python | en | ['en', 'error', 'th'] | False |
TypedObject.at_idmapper_flush | (self) |
This is called when the idmapper cache is flushed and
allows customized actions when this happens.
Returns:
do_flush (bool): If True, flush this object as normal. If
False, don't flush and expect this object to handle
the flushing on its own.
... |
This is called when the idmapper cache is flushed and
allows customized actions when this happens. | def at_idmapper_flush(self):
"""
This is called when the idmapper cache is flushed and
allows customized actions when this happens.
Returns:
do_flush (bool): If True, flush this object as normal. If
False, don't flush and expect this object to handle
... | [
"def",
"at_idmapper_flush",
"(",
"self",
")",
":",
"if",
"self",
".",
"nattributes",
".",
"all",
"(",
")",
":",
"# we can't flush this object if we have non-persistent",
"# attributes stored - those would get lost! Nevertheless",
"# we try to flush as many references as we can.",
... | [
373,
4
] | [
406,
19
] | python | en | ['en', 'error', 'th'] | False |
TypedObject.is_typeclass | (self, typeclass, exact=True) |
Returns true if this object has this type OR has a typeclass
which is an subclass of the given typeclass. This operates on
the actually loaded typeclass (this is important since a
failing typeclass may instead have its default currently
loaded) typeclass - can be a class object ... |
Returns true if this object has this type OR has a typeclass
which is an subclass of the given typeclass. This operates on
the actually loaded typeclass (this is important since a
failing typeclass may instead have its default currently
loaded) typeclass - can be a class object ... | def is_typeclass(self, typeclass, exact=True):
"""
Returns true if this object has this type OR has a typeclass
which is an subclass of the given typeclass. This operates on
the actually loaded typeclass (this is important since a
failing typeclass may instead have its default cu... | [
"def",
"is_typeclass",
"(",
"self",
",",
"typeclass",
",",
"exact",
"=",
"True",
")",
":",
"if",
"isinstance",
"(",
"typeclass",
",",
"basestring",
")",
":",
"typeclass",
"=",
"[",
"typeclass",
"]",
"+",
"[",
"\"%s.%s\"",
"%",
"(",
"prefix",
",",
"type... | [
412,
4
] | [
443,
102
] | python | en | ['en', 'error', 'th'] | False |
TypedObject.swap_typeclass | (self, new_typeclass, clean_attributes=False,
run_start_hooks="all", no_default=True, clean_cmdsets=False) |
This performs an in-situ swap of the typeclass. This means
that in-game, this object will suddenly be something else.
Account will not be affected. To 'move' an account to a different
object entirely (while retaining this object's type), use
self.account.swap_object().
... |
This performs an in-situ swap of the typeclass. This means
that in-game, this object will suddenly be something else.
Account will not be affected. To 'move' an account to a different
object entirely (while retaining this object's type), use
self.account.swap_object(). | def swap_typeclass(self, new_typeclass, clean_attributes=False,
run_start_hooks="all", no_default=True, clean_cmdsets=False):
"""
This performs an in-situ swap of the typeclass. This means
that in-game, this object will suddenly be something else.
Account will not ... | [
"def",
"swap_typeclass",
"(",
"self",
",",
"new_typeclass",
",",
"clean_attributes",
"=",
"False",
",",
"run_start_hooks",
"=",
"\"all\"",
",",
"no_default",
"=",
"True",
",",
"clean_cmdsets",
"=",
"False",
")",
":",
"if",
"not",
"callable",
"(",
"new_typeclas... | [
445,
4
] | [
519,
44
] | python | en | ['en', 'error', 'th'] | False |
TypedObject.access | (self, accessing_obj, access_type='read', default=False, no_superuser_bypass=False, **kwargs) |
Determines if another object has permission to access this one.
Args:
accessing_obj (str): Object trying to access this one.
access_type (str, optional): Type of access sought.
default (bool, optional): What to return if no lock of
access_type was fo... |
Determines if another object has permission to access this one. | def access(self, accessing_obj, access_type='read', default=False, no_superuser_bypass=False, **kwargs):
"""
Determines if another object has permission to access this one.
Args:
accessing_obj (str): Object trying to access this one.
access_type (str, optional): Type of ... | [
"def",
"access",
"(",
"self",
",",
"accessing_obj",
",",
"access_type",
"=",
"'read'",
",",
"default",
"=",
"False",
",",
"no_superuser_bypass",
"=",
"False",
",",
"*",
"*",
"kwargs",
")",
":",
"return",
"self",
".",
"locks",
".",
"check",
"(",
"accessin... | [
525,
4
] | [
544,
72
] | python | en | ['en', 'error', 'th'] | False |
TypedObject.check_permstring | (self, permstring) |
This explicitly checks if we hold particular permission
without involving any locks.
Args:
permstring (str): The permission string to check against.
Returns:
result (bool): If the permstring is passed or not.
|
This explicitly checks if we hold particular permission
without involving any locks. | def check_permstring(self, permstring):
"""
This explicitly checks if we hold particular permission
without involving any locks.
Args:
permstring (str): The permission string to check against.
Returns:
result (bool): If the permstring is passed or not.
... | [
"def",
"check_permstring",
"(",
"self",
",",
"permstring",
")",
":",
"if",
"hasattr",
"(",
"self",
",",
"\"account\"",
")",
":",
"if",
"self",
".",
"account",
"and",
"self",
".",
"account",
".",
"is_superuser",
"and",
"not",
"self",
".",
"account",
".",
... | [
546,
4
] | [
581,
20
] | python | en | ['en', 'error', 'th'] | False |
TypedObject._deleted | (self, *args, **kwargs) |
Scrambling method for already deleted objects
|
Scrambling method for already deleted objects
| def _deleted(self, *args, **kwargs):
"""
Scrambling method for already deleted objects
"""
raise ObjectDoesNotExist("This object was already deleted!") | [
"def",
"_deleted",
"(",
"self",
",",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"raise",
"ObjectDoesNotExist",
"(",
"\"This object was already deleted!\"",
")"
] | [
587,
4
] | [
591,
68
] | python | en | ['en', 'error', 'th'] | False |
TypedObject.delete | (self) |
Cleaning up handlers on the typeclass level
|
Cleaning up handlers on the typeclass level | def delete(self):
"""
Cleaning up handlers on the typeclass level
"""
global TICKER_HANDLER
self.permissions.clear()
self.attributes.clear()
self.aliases.clear()
if hasattr(self, "nicks"):
self.nicks.clear()
# scrambling properties
... | [
"def",
"delete",
"(",
"self",
")",
":",
"global",
"TICKER_HANDLER",
"self",
".",
"permissions",
".",
"clear",
"(",
")",
"self",
".",
"attributes",
".",
"clear",
"(",
")",
"self",
".",
"aliases",
".",
"clear",
"(",
")",
"if",
"hasattr",
"(",
"self",
"... | [
593,
4
] | [
606,
41
] | python | en | ['en', 'error', 'th'] | False |
TypedObject.__db_get | (self) |
Attribute handler wrapper. Allows for the syntax
obj.db.attrname = value
and
value = obj.db.attrname
and
del obj.db.attrname
and
all_attr = obj.db.all() (unless there is an attribute
named 'all', in which c... |
Attribute handler wrapper. Allows for the syntax
obj.db.attrname = value
and
value = obj.db.attrname
and
del obj.db.attrname
and
all_attr = obj.db.all() (unless there is an attribute
named 'all', in which c... | def __db_get(self):
"""
Attribute handler wrapper. Allows for the syntax
obj.db.attrname = value
and
value = obj.db.attrname
and
del obj.db.attrname
and
all_attr = obj.db.all() (unless there is an attribute
... | [
"def",
"__db_get",
"(",
"self",
")",
":",
"try",
":",
"return",
"self",
".",
"_db_holder",
"except",
"AttributeError",
":",
"self",
".",
"_db_holder",
"=",
"DbHolder",
"(",
"self",
",",
"'attributes'",
")",
"return",
"self",
".",
"_db_holder"
] | [
613,
4
] | [
629,
34
] | python | en | ['en', 'error', 'th'] | False |
TypedObject.__db_set | (self, value) | Stop accidentally replacing the db object | Stop accidentally replacing the db object | def __db_set(self, value):
"Stop accidentally replacing the db object"
string = "Cannot assign directly to db object! "
string += "Use db.attr=value instead."
raise Exception(string) | [
"def",
"__db_set",
"(",
"self",
",",
"value",
")",
":",
"string",
"=",
"\"Cannot assign directly to db object! \"",
"string",
"+=",
"\"Use db.attr=value instead.\"",
"raise",
"Exception",
"(",
"string",
")"
] | [
632,
4
] | [
636,
31
] | python | en | ['en', 'en', 'en'] | True |
TypedObject.__db_del | (self) | Stop accidental deletion. | Stop accidental deletion. | def __db_del(self):
"Stop accidental deletion."
raise Exception("Cannot delete the db object!") | [
"def",
"__db_del",
"(",
"self",
")",
":",
"raise",
"Exception",
"(",
"\"Cannot delete the db object!\"",
")"
] | [
639,
4
] | [
641,
55
] | python | en | ['es', 'en', 'en'] | True |
TypedObject.__ndb_get | (self) |
A non-attr_obj store (ndb: NonDataBase). Everything stored
to this is guaranteed to be cleared when a server is shutdown.
Syntax is same as for the _get_db_holder() method and
property, e.g. obj.ndb.attr = value etc.
|
A non-attr_obj store (ndb: NonDataBase). Everything stored
to this is guaranteed to be cleared when a server is shutdown.
Syntax is same as for the _get_db_holder() method and
property, e.g. obj.ndb.attr = value etc.
| def __ndb_get(self):
"""
A non-attr_obj store (ndb: NonDataBase). Everything stored
to this is guaranteed to be cleared when a server is shutdown.
Syntax is same as for the _get_db_holder() method and
property, e.g. obj.ndb.attr = value etc.
"""
try:
r... | [
"def",
"__ndb_get",
"(",
"self",
")",
":",
"try",
":",
"return",
"self",
".",
"_ndb_holder",
"except",
"AttributeError",
":",
"self",
".",
"_ndb_holder",
"=",
"DbHolder",
"(",
"self",
",",
"\"nattrhandler\"",
",",
"manager_name",
"=",
"'nattributes'",
")",
"... | [
649,
4
] | [
660,
35
] | python | en | ['en', 'error', 'th'] | False |
TypedObject.__ndb_set | (self, value) | Stop accidentally replacing the ndb object | Stop accidentally replacing the ndb object | def __ndb_set(self, value):
"Stop accidentally replacing the ndb object"
string = "Cannot assign directly to ndb object! "
string += "Use ndb.attr=value instead."
raise Exception(string) | [
"def",
"__ndb_set",
"(",
"self",
",",
"value",
")",
":",
"string",
"=",
"\"Cannot assign directly to ndb object! \"",
"string",
"+=",
"\"Use ndb.attr=value instead.\"",
"raise",
"Exception",
"(",
"string",
")"
] | [
663,
4
] | [
667,
31
] | python | en | ['en', 'en', 'en'] | True |
TypedObject.__ndb_del | (self) | Stop accidental deletion. | Stop accidental deletion. | def __ndb_del(self):
"Stop accidental deletion."
raise Exception("Cannot delete the ndb object!") | [
"def",
"__ndb_del",
"(",
"self",
")",
":",
"raise",
"Exception",
"(",
"\"Cannot delete the ndb object!\"",
")"
] | [
670,
4
] | [
672,
56
] | python | en | ['es', 'en', 'en'] | True |
TypedObject.get_display_name | (self, looker, **kwargs) |
Displays the name of the object in a viewer-aware manner.
Args:
looker (TypedObject, optional): The object or account that is looking
at/getting inforamtion for this object. If not given, some
'safe' minimum level should be returned.
Returns:
... |
Displays the name of the object in a viewer-aware manner. | def get_display_name(self, looker, **kwargs):
"""
Displays the name of the object in a viewer-aware manner.
Args:
looker (TypedObject, optional): The object or account that is looking
at/getting inforamtion for this object. If not given, some
'safe' m... | [
"def",
"get_display_name",
"(",
"self",
",",
"looker",
",",
"*",
"*",
"kwargs",
")",
":",
"if",
"self",
".",
"access",
"(",
"looker",
",",
"access_type",
"=",
"'controls'",
")",
":",
"return",
"\"{}(#{})\"",
".",
"format",
"(",
"self",
".",
"name",
","... | [
675,
4
] | [
699,
24
] | python | en | ['en', 'error', 'th'] | False |
TypedObject.get_extra_info | (self, looker, **kwargs) |
Used when an object is in a list of ambiguous objects as an
additional information tag.
For instance, if you had potions which could have varying
levels of liquid left in them, you might want to display how
many drinks are left in each when selecting which to drop, but
... |
Used when an object is in a list of ambiguous objects as an
additional information tag. | def get_extra_info(self, looker, **kwargs):
"""
Used when an object is in a list of ambiguous objects as an
additional information tag.
For instance, if you had potions which could have varying
levels of liquid left in them, you might want to display how
many drinks are ... | [
"def",
"get_extra_info",
"(",
"self",
",",
"looker",
",",
"*",
"*",
"kwargs",
")",
":",
"if",
"self",
".",
"location",
"==",
"looker",
":",
"return",
"\" (carried)\"",
"return",
"\"\""
] | [
701,
4
] | [
723,
17
] | python | en | ['en', 'error', 'th'] | False |
TypedObject.at_rename | (self, oldname, newname) |
This Hook is called by @name on a successful rename.
Args:
oldname (str): The instance's original name.
newname (str): The new name for the instance.
|
This Hook is called by @name on a successful rename. | def at_rename(self, oldname, newname):
"""
This Hook is called by @name on a successful rename.
Args:
oldname (str): The instance's original name.
newname (str): The new name for the instance.
"""
pass | [
"def",
"at_rename",
"(",
"self",
",",
"oldname",
",",
"newname",
")",
":",
"pass"
] | [
725,
4
] | [
734,
12
] | python | en | ['en', 'error', 'th'] | False |
dataHex | (data, prefix="") | Converts binary string data to display representation form | Converts binary string data to display representation form | def dataHex(data, prefix=""):
"""Converts binary string data to display representation form"""
res = ""
for i in range(0, (len(data)+15)/16):
res += "%s0x%02X | " % (prefix, i*16)
d = map(lambda x:ord(x), data[i*16:i*16+17])
for ch in d:
res += "%02X " % ch
for i ... | [
"def",
"dataHex",
"(",
"data",
",",
"prefix",
"=",
"\"\"",
")",
":",
"res",
"=",
"\"\"",
"for",
"i",
"in",
"range",
"(",
"0",
",",
"(",
"len",
"(",
"data",
")",
"+",
"15",
")",
"/",
"16",
")",
":",
"res",
"+=",
"\"%s0x%02X | \"",
"%",
"(",
"p... | [
37,
0
] | [
54,
14
] | python | en | ['en', 'en', 'en'] | True |
logDnsMsg | (qstate) | Logs response | Logs response | def logDnsMsg(qstate):
"""Logs response"""
r = qstate.return_msg.rep
q = qstate.return_msg.qinfo
print "-"*100
print("Query: %s, type: %s (%d), class: %s (%d) " % (
qstate.qinfo.qname_str, qstate.qinfo.qtype_str, qstate.qinfo.qtype,
qstate.qinfo.qclass_str, qstate.qinfo.q... | [
"def",
"logDnsMsg",
"(",
"qstate",
")",
":",
"r",
"=",
"qstate",
".",
"return_msg",
".",
"rep",
"q",
"=",
"qstate",
".",
"return_msg",
".",
"qinfo",
"print",
"\"-\"",
"*",
"100",
"print",
"(",
"\"Query: %s, type: %s (%d), class: %s (%d) \"",
"%",
"(",
"qstat... | [
56,
0
] | [
86,
17
] | python | en | ['en', 'jv', 'en'] | False |
AgentMessage.__init__ | (self, _id: str = None, _decorators: BaseDecoratorSet = None) |
Initialize base agent message object.
Args:
_id: Agent message id
_decorators: Message decorators
Raises:
TypeError: If message type is missing on subclass Meta class
|
Initialize base agent message object. | def __init__(self, _id: str = None, _decorators: BaseDecoratorSet = None):
"""
Initialize base agent message object.
Args:
_id: Agent message id
_decorators: Message decorators
Raises:
TypeError: If message type is missing on subclass Meta class
... | [
"def",
"__init__",
"(",
"self",
",",
"_id",
":",
"str",
"=",
"None",
",",
"_decorators",
":",
"BaseDecoratorSet",
"=",
"None",
")",
":",
"super",
"(",
"AgentMessage",
",",
"self",
")",
".",
"__init__",
"(",
")",
"if",
"_id",
":",
"self",
".",
"_messa... | [
45,
4
] | [
72,
13
] | python | en | ['en', 'error', 'th'] | False |
AgentMessage._get_handler_class | (cls) |
Get handler class.
Returns:
The resolved class defined on `Meta.handler_class`
|
Get handler class. | def _get_handler_class(cls):
"""
Get handler class.
Returns:
The resolved class defined on `Meta.handler_class`
"""
return resolve_class(cls.Meta.handler_class, cls) | [
"def",
"_get_handler_class",
"(",
"cls",
")",
":",
"return",
"resolve_class",
"(",
"cls",
".",
"Meta",
".",
"handler_class",
",",
"cls",
")"
] | [
80,
4
] | [
88,
57
] | python | en | ['en', 'error', 'th'] | False |
AgentMessage.Handler | (self) |
Accessor for the agent message's handler class.
Returns:
Handler class
|
Accessor for the agent message's handler class. | def Handler(self) -> type:
"""
Accessor for the agent message's handler class.
Returns:
Handler class
"""
return self._get_handler_class() | [
"def",
"Handler",
"(",
"self",
")",
"->",
"type",
":",
"return",
"self",
".",
"_get_handler_class",
"(",
")"
] | [
91,
4
] | [
99,
40
] | python | en | ['en', 'error', 'th'] | False |
AgentMessage._type | (self) |
Accessor for the message type identifier.
Returns:
Message type defined on `Meta.message_type`
|
Accessor for the message type identifier. | def _type(self) -> str:
"""
Accessor for the message type identifier.
Returns:
Message type defined on `Meta.message_type`
"""
return self.Meta.message_type | [
"def",
"_type",
"(",
"self",
")",
"->",
"str",
":",
"return",
"self",
".",
"Meta",
".",
"message_type"
] | [
102,
4
] | [
110,
37
] | python | en | ['en', 'error', 'th'] | False |
AgentMessage._id | (self) |
Accessor for the unique message identifier.
Returns:
The id of this message
|
Accessor for the unique message identifier. | def _id(self) -> str:
"""
Accessor for the unique message identifier.
Returns:
The id of this message
"""
return self._message_id | [
"def",
"_id",
"(",
"self",
")",
"->",
"str",
":",
"return",
"self",
".",
"_message_id"
] | [
113,
4
] | [
121,
31
] | python | en | ['en', 'error', 'th'] | False |
AgentMessage._id | (self, val: str) | Set the unique message identifier. | Set the unique message identifier. | def _id(self, val: str):
"""Set the unique message identifier."""
self._message_id = val | [
"def",
"_id",
"(",
"self",
",",
"val",
":",
"str",
")",
":",
"self",
".",
"_message_id",
"=",
"val"
] | [
124,
4
] | [
126,
30
] | python | en | ['en', 'fr', 'en'] | True |
AgentMessage._decorators | (self) | Fetch the message's decorator set. | Fetch the message's decorator set. | def _decorators(self) -> BaseDecoratorSet:
"""Fetch the message's decorator set."""
return self._message_decorators | [
"def",
"_decorators",
"(",
"self",
")",
"->",
"BaseDecoratorSet",
":",
"return",
"self",
".",
"_message_decorators"
] | [
129,
4
] | [
131,
39
] | python | en | ['en', 'fr', 'en'] | True |
AgentMessage._decorators | (self, value: BaseDecoratorSet) | Fetch the message's decorator set. | Fetch the message's decorator set. | def _decorators(self, value: BaseDecoratorSet):
"""Fetch the message's decorator set."""
self._message_decorators = value | [
"def",
"_decorators",
"(",
"self",
",",
"value",
":",
"BaseDecoratorSet",
")",
":",
"self",
".",
"_message_decorators",
"=",
"value"
] | [
134,
4
] | [
136,
40
] | python | en | ['en', 'fr', 'en'] | True |
AgentMessage.get_signature | (self, field_name: str) |
Get the signature for a named field.
Args:
field_name: Field name to get the signature for
Returns:
A SignatureDecorator for the requested field name
|
Get the signature for a named field. | def get_signature(self, field_name: str) -> SignatureDecorator:
"""
Get the signature for a named field.
Args:
field_name: Field name to get the signature for
Returns:
A SignatureDecorator for the requested field name
"""
return self._decorators... | [
"def",
"get_signature",
"(",
"self",
",",
"field_name",
":",
"str",
")",
"->",
"SignatureDecorator",
":",
"return",
"self",
".",
"_decorators",
".",
"field",
"(",
"field_name",
")",
".",
"get",
"(",
"\"sig\"",
")"
] | [
138,
4
] | [
149,
60
] | python | en | ['en', 'error', 'th'] | False |
AgentMessage.set_signature | (self, field_name: str, signature: SignatureDecorator) |
Add or replace the signature for a named field.
Args:
field_name: Field to set signature on
signature: Signature for the field
|
Add or replace the signature for a named field. | def set_signature(self, field_name: str, signature: SignatureDecorator):
"""
Add or replace the signature for a named field.
Args:
field_name: Field to set signature on
signature: Signature for the field
"""
self._decorators.field(field_name)["sig"] = si... | [
"def",
"set_signature",
"(",
"self",
",",
"field_name",
":",
"str",
",",
"signature",
":",
"SignatureDecorator",
")",
":",
"self",
".",
"_decorators",
".",
"field",
"(",
"field_name",
")",
"[",
"\"sig\"",
"]",
"=",
"signature"
] | [
151,
4
] | [
160,
61
] | python | en | ['en', 'error', 'th'] | False |
AgentMessage.sign_field | (
self, field_name: str, signer_verkey: str, wallet: BaseWallet, timestamp=None
) |
Create and store a signature for a named field.
Args:
field_name: Field to sign
signer_verkey: Verkey of signer
wallet: Wallet to use for signature
timestamp: Optional timestamp for signature
Returns:
A SignatureDecorator for newly c... |
Create and store a signature for a named field. | async def sign_field(
self, field_name: str, signer_verkey: str, wallet: BaseWallet, timestamp=None
) -> SignatureDecorator:
"""
Create and store a signature for a named field.
Args:
field_name: Field to sign
signer_verkey: Verkey of signer
wallet... | [
"async",
"def",
"sign_field",
"(",
"self",
",",
"field_name",
":",
"str",
",",
"signer_verkey",
":",
"str",
",",
"wallet",
":",
"BaseWallet",
",",
"timestamp",
"=",
"None",
")",
"->",
"SignatureDecorator",
":",
"value",
"=",
"getattr",
"(",
"self",
",",
... | [
162,
4
] | [
190,
18
] | python | en | ['en', 'error', 'th'] | False |
AgentMessage.verify_signed_field | (
self, field_name: str, wallet: BaseWallet, signer_verkey: str = None
) |
Verify a specific field signature.
Args:
field_name: The field name to verify
wallet: Wallet to use for the verification
signer_verkey: Verkey of signer to use
Returns:
The verkey of the signer
Raises:
ValueError: If field_n... |
Verify a specific field signature. | async def verify_signed_field(
self, field_name: str, wallet: BaseWallet, signer_verkey: str = None
) -> str:
"""
Verify a specific field signature.
Args:
field_name: The field name to verify
wallet: Wallet to use for the verification
signer_verke... | [
"async",
"def",
"verify_signed_field",
"(",
"self",
",",
"field_name",
":",
"str",
",",
"wallet",
":",
"BaseWallet",
",",
"signer_verkey",
":",
"str",
"=",
"None",
")",
"->",
"str",
":",
"sig",
"=",
"self",
".",
"get_signature",
"(",
"field_name",
")",
"... | [
192,
4
] | [
224,
25
] | python | en | ['en', 'error', 'th'] | False |
AgentMessage.verify_signatures | (self, wallet: BaseWallet) |
Verify all associated field signatures.
Args:
wallet: Wallet to use in verification
Returns:
True if all signatures verify, else false
|
Verify all associated field signatures. | async def verify_signatures(self, wallet: BaseWallet) -> bool:
"""
Verify all associated field signatures.
Args:
wallet: Wallet to use in verification
Returns:
True if all signatures verify, else false
"""
for field in self._decorators.fields.va... | [
"async",
"def",
"verify_signatures",
"(",
"self",
",",
"wallet",
":",
"BaseWallet",
")",
"->",
"bool",
":",
"for",
"field",
"in",
"self",
".",
"_decorators",
".",
"fields",
".",
"values",
"(",
")",
":",
"if",
"\"sig\"",
"in",
"field",
"and",
"not",
"aw... | [
226,
4
] | [
240,
19
] | python | en | ['en', 'error', 'th'] | False |
AgentMessage._thread | (self) |
Accessor for the message's thread decorator.
Returns:
The ThreadDecorator for this message
|
Accessor for the message's thread decorator. | def _thread(self) -> ThreadDecorator:
"""
Accessor for the message's thread decorator.
Returns:
The ThreadDecorator for this message
"""
return self._decorators.get("thread") | [
"def",
"_thread",
"(",
"self",
")",
"->",
"ThreadDecorator",
":",
"return",
"self",
".",
"_decorators",
".",
"get",
"(",
"\"thread\"",
")"
] | [
243,
4
] | [
251,
45
] | python | en | ['en', 'error', 'th'] | False |
AgentMessage._thread | (self, val: Union[ThreadDecorator, dict]) |
Setter for the message's thread decorator.
Args:
val: ThreadDecorator or dict to set as the thread
|
Setter for the message's thread decorator. | def _thread(self, val: Union[ThreadDecorator, dict]):
"""
Setter for the message's thread decorator.
Args:
val: ThreadDecorator or dict to set as the thread
"""
self._decorators["thread"] = val | [
"def",
"_thread",
"(",
"self",
",",
"val",
":",
"Union",
"[",
"ThreadDecorator",
",",
"dict",
"]",
")",
":",
"self",
".",
"_decorators",
"[",
"\"thread\"",
"]",
"=",
"val"
] | [
254,
4
] | [
261,
40
] | python | en | ['en', 'error', 'th'] | False |
AgentMessage._thread_id | (self) | Accessor for the ID associated with this message. | Accessor for the ID associated with this message. | def _thread_id(self) -> str:
"""Accessor for the ID associated with this message."""
if self._thread and self._thread.thid:
return self._thread.thid
return self._message_id | [
"def",
"_thread_id",
"(",
"self",
")",
"->",
"str",
":",
"if",
"self",
".",
"_thread",
"and",
"self",
".",
"_thread",
".",
"thid",
":",
"return",
"self",
".",
"_thread",
".",
"thid",
"return",
"self",
".",
"_message_id"
] | [
264,
4
] | [
268,
31
] | python | en | ['en', 'en', 'en'] | True |
AgentMessage.assign_thread_from | (self, msg: "AgentMessage") |
Copy thread information from a previous message.
Args:
msg: The received message containing optional thread information
|
Copy thread information from a previous message. | def assign_thread_from(self, msg: "AgentMessage"):
"""
Copy thread information from a previous message.
Args:
msg: The received message containing optional thread information
"""
if msg:
thread = msg._thread
thid = thread and thread.thid or ms... | [
"def",
"assign_thread_from",
"(",
"self",
",",
"msg",
":",
"\"AgentMessage\"",
")",
":",
"if",
"msg",
":",
"thread",
"=",
"msg",
".",
"_thread",
"thid",
"=",
"thread",
"and",
"thread",
".",
"thid",
"or",
"msg",
".",
"_message_id",
"pthid",
"=",
"thread",... | [
270,
4
] | [
281,
46
] | python | en | ['en', 'error', 'th'] | False |
AgentMessage.assign_thread_id | (self, thid: str, pthid: str = None) |
Assign a specific thread ID.
Args:
thid: The thread identifier
pthid: The parent thread identifier
|
Assign a specific thread ID. | def assign_thread_id(self, thid: str, pthid: str = None):
"""
Assign a specific thread ID.
Args:
thid: The thread identifier
pthid: The parent thread identifier
"""
self._thread = ThreadDecorator(thid=thid, pthid=pthid) | [
"def",
"assign_thread_id",
"(",
"self",
",",
"thid",
":",
"str",
",",
"pthid",
":",
"str",
"=",
"None",
")",
":",
"self",
".",
"_thread",
"=",
"ThreadDecorator",
"(",
"thid",
"=",
"thid",
",",
"pthid",
"=",
"pthid",
")"
] | [
283,
4
] | [
291,
62
] | python | en | ['en', 'error', 'th'] | False |
AgentMessageSchema.__init__ | (self, *args, **kwargs) |
Initialize an instance of AgentMessageSchema.
Raises:
TypeError: If Meta.model_class has not been set
|
Initialize an instance of AgentMessageSchema. | def __init__(self, *args, **kwargs):
"""
Initialize an instance of AgentMessageSchema.
Raises:
TypeError: If Meta.model_class has not been set
"""
super(AgentMessageSchema, self).__init__(*args, **kwargs)
if not self.Meta.model_class:
raise TypeE... | [
"def",
"__init__",
"(",
"self",
",",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"super",
"(",
"AgentMessageSchema",
",",
"self",
")",
".",
"__init__",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
"if",
"not",
"self",
".",
"Meta",
".",
"mo... | [
318,
4
] | [
335,
29
] | python | en | ['en', 'error', 'th'] | False |
AgentMessageSchema.extract_decorators | (self, data, **kwargs) |
Pre-load hook to extract the decorators and check the signed fields.
Args:
data: Incoming data to parse
Returns:
Parsed and modified data
Raises:
ValidationError: If a field signature does not correlate
to a field in the message
... |
Pre-load hook to extract the decorators and check the signed fields. | def extract_decorators(self, data, **kwargs):
"""
Pre-load hook to extract the decorators and check the signed fields.
Args:
data: Incoming data to parse
Returns:
Parsed and modified data
Raises:
ValidationError: If a field signature does no... | [
"def",
"extract_decorators",
"(",
"self",
",",
"data",
",",
"*",
"*",
"kwargs",
")",
":",
"processed",
"=",
"self",
".",
"_decorators",
".",
"extract_decorators",
"(",
"data",
",",
"self",
".",
"__class__",
")",
"expect_fields",
"=",
"resolve_meta_property",
... | [
338,
4
] | [
375,
24
] | python | en | ['en', 'error', 'th'] | False |
AgentMessageSchema.populate_decorators | (self, obj, **kwargs) |
Post-load hook to populate decorators on the message.
Args:
obj: The AgentMessage object
Returns:
The AgentMessage object with populated decorators
|
Post-load hook to populate decorators on the message. | def populate_decorators(self, obj, **kwargs):
"""
Post-load hook to populate decorators on the message.
Args:
obj: The AgentMessage object
Returns:
The AgentMessage object with populated decorators
"""
obj._decorators = self._decorators
... | [
"def",
"populate_decorators",
"(",
"self",
",",
"obj",
",",
"*",
"*",
"kwargs",
")",
":",
"obj",
".",
"_decorators",
"=",
"self",
".",
"_decorators",
"return",
"obj"
] | [
378,
4
] | [
390,
18
] | python | en | ['en', 'error', 'th'] | False |
AgentMessageSchema.check_dump_decorators | (self, obj, **kwargs) |
Pre-dump hook to validate and load the message decorators.
Args:
obj: The AgentMessage object
Raises:
BaseModelError: If a decorator does not validate
|
Pre-dump hook to validate and load the message decorators. | def check_dump_decorators(self, obj, **kwargs):
"""
Pre-dump hook to validate and load the message decorators.
Args:
obj: The AgentMessage object
Raises:
BaseModelError: If a decorator does not validate
"""
decorators = obj._decorators.copy()
... | [
"def",
"check_dump_decorators",
"(",
"self",
",",
"obj",
",",
"*",
"*",
"kwargs",
")",
":",
"decorators",
"=",
"obj",
".",
"_decorators",
".",
"copy",
"(",
")",
"signatures",
"=",
"OrderedDict",
"(",
")",
"for",
"name",
",",
"field",
"in",
"decorators",
... | [
393,
4
] | [
421,
18
] | python | en | ['en', 'error', 'th'] | False |
AgentMessageSchema.dump_decorators | (self, data, **kwargs) |
Post-dump hook to write the decorators to the serialized output.
Args:
obj: The serialized data
Returns:
The modified data
|
Post-dump hook to write the decorators to the serialized output. | def dump_decorators(self, data, **kwargs):
"""
Post-dump hook to write the decorators to the serialized output.
Args:
obj: The serialized data
Returns:
The modified data
"""
result = OrderedDict()
for key in ("@type", "@id"):
... | [
"def",
"dump_decorators",
"(",
"self",
",",
"data",
",",
"*",
"*",
"kwargs",
")",
":",
"result",
"=",
"OrderedDict",
"(",
")",
"for",
"key",
"in",
"(",
"\"@type\"",
",",
"\"@id\"",
")",
":",
"if",
"key",
"in",
"data",
":",
"result",
"[",
"key",
"]"... | [
424,
4
] | [
441,
21
] | python | en | ['en', 'error', 'th'] | False |
AgentMessageSchema.replace_signatures | (self, data, **kwargs) |
Post-dump hook to write the signatures to the serialized output.
Args:
obj: The serialized data
Returns:
The modified data
|
Post-dump hook to write the signatures to the serialized output. | def replace_signatures(self, data, **kwargs):
"""
Post-dump hook to write the signatures to the serialized output.
Args:
obj: The serialized data
Returns:
The modified data
"""
for field_name, sig in self._signatures.items():
del dat... | [
"def",
"replace_signatures",
"(",
"self",
",",
"data",
",",
"*",
"*",
"kwargs",
")",
":",
"for",
"field_name",
",",
"sig",
"in",
"self",
".",
"_signatures",
".",
"items",
"(",
")",
":",
"del",
"data",
"[",
"field_name",
"]",
"data",
"[",
"\"{}~sig\"",
... | [
444,
4
] | [
458,
19
] | python | en | ['en', 'error', 'th'] | False |
BaseSettings.get_value | (self, *var_names, default=None) | Fetch a setting.
Args:
var_names: A list of variable name alternatives
default: The default value to return if none are defined
Returns:
The setting value, if defined, otherwise the default value
| Fetch a setting. | def get_value(self, *var_names, default=None):
"""Fetch a setting.
Args:
var_names: A list of variable name alternatives
default: The default value to return if none are defined
Returns:
The setting value, if defined, otherwise the default value
""" | [
"def",
"get_value",
"(",
"self",
",",
"*",
"var_names",
",",
"default",
"=",
"None",
")",
":"
] | [
20,
4
] | [
30,
11
] | python | en | ['en', 'cy', 'en'] | True |
BaseSettings.get_bool | (self, *var_names, default=None) | Fetch a setting as a boolean value.
Args:
var_names: A list of variable name alternatives
default: The default value to return if none are defined
| Fetch a setting as a boolean value. | def get_bool(self, *var_names, default=None) -> bool:
"""Fetch a setting as a boolean value.
Args:
var_names: A list of variable name alternatives
default: The default value to return if none are defined
"""
value = self.get_value(*var_names, default)
if ... | [
"def",
"get_bool",
"(",
"self",
",",
"*",
"var_names",
",",
"default",
"=",
"None",
")",
"->",
"bool",
":",
"value",
"=",
"self",
".",
"get_value",
"(",
"*",
"var_names",
",",
"default",
")",
"if",
"value",
"is",
"not",
"None",
":",
"value",
"=",
"... | [
32,
4
] | [
42,
20
] | python | en | ['en', 'gd', 'en'] | True |
BaseSettings.get_int | (self, *var_names, default=None) | Fetch a setting as an integer value.
Args:
var_names: A list of variable name alternatives
default: The default value to return if none are defined
| Fetch a setting as an integer value. | def get_int(self, *var_names, default=None) -> int:
"""Fetch a setting as an integer value.
Args:
var_names: A list of variable name alternatives
default: The default value to return if none are defined
"""
value = self.get_value(*var_names, default)
if v... | [
"def",
"get_int",
"(",
"self",
",",
"*",
"var_names",
",",
"default",
"=",
"None",
")",
"->",
"int",
":",
"value",
"=",
"self",
".",
"get_value",
"(",
"*",
"var_names",
",",
"default",
")",
"if",
"value",
"is",
"not",
"None",
":",
"value",
"=",
"in... | [
44,
4
] | [
54,
20
] | python | en | ['en', 'en', 'en'] | True |
BaseSettings.get_str | (self, *var_names, default=None) | Fetch a setting as a string value.
Args:
var_names: A list of variable name alternatives
default: The default value to return if none are defined
| Fetch a setting as a string value. | def get_str(self, *var_names, default=None) -> str:
"""Fetch a setting as a string value.
Args:
var_names: A list of variable name alternatives
default: The default value to return if none are defined
"""
value = self.get_value(*var_names, default=default)
... | [
"def",
"get_str",
"(",
"self",
",",
"*",
"var_names",
",",
"default",
"=",
"None",
")",
"->",
"str",
":",
"value",
"=",
"self",
".",
"get_value",
"(",
"*",
"var_names",
",",
"default",
"=",
"default",
")",
"if",
"value",
"is",
"not",
"None",
":",
"... | [
56,
4
] | [
66,
20
] | python | en | ['en', 'en', 'en'] | True |
BaseSettings.__iter__ | (self) | Iterate settings keys. | Iterate settings keys. | def __iter__(self):
"""Iterate settings keys.""" | [
"def",
"__iter__",
"(",
"self",
")",
":"
] | [
69,
4
] | [
70,
36
] | python | en | ['en', 'ms', 'en'] | True |
BaseSettings.__getitem__ | (self, index) | Fetch as an array index. | Fetch as an array index. | def __getitem__(self, index):
"""Fetch as an array index."""
if not isinstance(index, str):
raise TypeError("Index must be a string")
missing = object()
result = self.get_value(index, default=missing)
if result is missing:
raise KeyError("Undefined index: ... | [
"def",
"__getitem__",
"(",
"self",
",",
"index",
")",
":",
"if",
"not",
"isinstance",
"(",
"index",
",",
"str",
")",
":",
"raise",
"TypeError",
"(",
"\"Index must be a string\"",
")",
"missing",
"=",
"object",
"(",
")",
"result",
"=",
"self",
".",
"get_v... | [
72,
4
] | [
80,
36
] | python | en | ['en', 'hu', 'en'] | True |
BaseSettings.__len__ | (self) | Fetch the length of the mapping. | Fetch the length of the mapping. | def __len__(self):
"""Fetch the length of the mapping.""" | [
"def",
"__len__",
"(",
"self",
")",
":"
] | [
83,
4
] | [
84,
46
] | 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.