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_bot_worker | (opt: Dict[str, Any], model_name: str) |
Return a bot agent.
Agent behaves like a crowdsource worker but actually wraps around a dialogue model.
|
Return a bot agent. | def get_bot_worker(opt: Dict[str, Any], model_name: str) -> TurkLikeAgent:
"""
Return a bot agent.
Agent behaves like a crowdsource worker but actually wraps around a dialogue model.
"""
semaphore = opt['semaphore']
shared_bot_agents = opt['shared_bot_agents']
num_turns = opt['num_turns']
... | [
"def",
"get_bot_worker",
"(",
"opt",
":",
"Dict",
"[",
"str",
",",
"Any",
"]",
",",
"model_name",
":",
"str",
")",
"->",
"TurkLikeAgent",
":",
"semaphore",
"=",
"opt",
"[",
"'semaphore'",
"]",
"shared_bot_agents",
"=",
"opt",
"[",
"'shared_bot_agents'",
"]... | [
618,
0
] | [
635,
21
] | python | en | ['en', 'error', 'th'] | False |
ModelChatOnboardWorld.check_onboarding_answers | (self, worker_answers) |
Calculate how many correct answers the user gave.
`worker_answers` is a list of dicts containing mappings between an annotation
value and whether it was selected for each bucket. We return a boolean as to
whether the worker passed or failed the task.
|
Calculate how many correct answers the user gave. | def check_onboarding_answers(self, worker_answers) -> bool:
"""
Calculate how many correct answers the user gave.
`worker_answers` is a list of dicts containing mappings between an annotation
value and whether it was selected for each bucket. We return a boolean as to
whether th... | [
"def",
"check_onboarding_answers",
"(",
"self",
",",
"worker_answers",
")",
"->",
"bool",
":",
"given_turns",
"=",
"self",
".",
"onboard_task_data",
"[",
"'dialog'",
"]",
"correct_answers",
"=",
"[",
"t",
"[",
"1",
"]",
"[",
"'answers'",
"]",
"for",
"t",
"... | [
73,
4
] | [
102,
20
] | python | en | ['en', 'error', 'th'] | False |
BaseModelChatWorld.__add_problem_data_to_utterance | (self, p, turn_idx: int) |
Attach problem data to the bot's prior utterance, given by turn_idx.
|
Attach problem data to the bot's prior utterance, given by turn_idx.
| def __add_problem_data_to_utterance(self, p, turn_idx: int):
"""
Attach problem data to the bot's prior utterance, given by turn_idx.
"""
print(p)
assert (
self.dialog[turn_idx]['agent_idx'] == 1
), 'Problem data must be attached to a bot utterance.'
a... | [
"def",
"__add_problem_data_to_utterance",
"(",
"self",
",",
"p",
",",
"turn_idx",
":",
"int",
")",
":",
"print",
"(",
"p",
")",
"assert",
"(",
"self",
".",
"dialog",
"[",
"turn_idx",
"]",
"[",
"'agent_idx'",
"]",
"==",
"1",
")",
",",
"'Problem data must ... | [
195,
4
] | [
206,
49
] | python | en | ['en', 'error', 'th'] | False |
BaseModelChatWorld.parley | (self) | Otherwise, we proceed accordingly | Otherwise, we proceed accordingly | def parley(self):
print(
f'{self.__class__.__name__}:{self.tag}: is at turn {self.task_turn_idx}, with {self.num_turns} pairs of turns needed...'
)
if self.task_turn_idx == 0:
self._run_initial_turn()
self.task_turn_idx += 1
return
"""Oth... | [
"def",
"parley",
"(",
"self",
")",
":",
"print",
"(",
"f'{self.__class__.__name__}:{self.tag}: is at turn {self.task_turn_idx}, with {self.num_turns} pairs of turns needed...'",
")",
"if",
"self",
".",
"task_turn_idx",
"==",
"0",
":",
"self",
".",
"_run_initial_turn",
"(",
... | [
208,
4
] | [
322,
39
] | python | en | ['en', 'xh', 'en'] | True |
BaseModelChatWorld._run_initial_turn | (self) |
Runs logic for the first turn of the human and the bot.
|
Runs logic for the first turn of the human and the bot.
| def _run_initial_turn(self) -> None:
"""
Runs logic for the first turn of the human and the bot.
""" | [
"def",
"_run_initial_turn",
"(",
"self",
")",
"->",
"None",
":"
] | [
325,
4
] | [
328,
11
] | python | en | ['en', 'error', 'th'] | False |
BaseModelChatWorld._postprocess_acts | (self, acts: List[dict], agent_idx: int) |
Optionally perform further processing of the acts.
Useful for subclasses. Will be executed after saving act data to self.dialog but
before showing the act to the other agent.
|
Optionally perform further processing of the acts. | def _postprocess_acts(self, acts: List[dict], agent_idx: int):
"""
Optionally perform further processing of the acts.
Useful for subclasses. Will be executed after saving act data to self.dialog but
before showing the act to the other agent.
""" | [
"def",
"_postprocess_acts",
"(",
"self",
",",
"acts",
":",
"List",
"[",
"dict",
"]",
",",
"agent_idx",
":",
"int",
")",
":"
] | [
330,
4
] | [
336,
11
] | python | en | ['en', 'error', 'th'] | False |
BaseModelChatWorld.get_final_chat_data | (self) |
Return specific info about the conversation, the context, acceptability, etc.
|
Return specific info about the conversation, the context, acceptability, etc.
| def get_final_chat_data(self) -> Dict[str, Any]:
"""
Return specific info about the conversation, the context, acceptability, etc.
"""
if self.check_acceptability:
human_messages, violation_types = self._prepare_acceptability_checking()
violations_string = self.a... | [
"def",
"get_final_chat_data",
"(",
"self",
")",
"->",
"Dict",
"[",
"str",
",",
"Any",
"]",
":",
"if",
"self",
".",
"check_acceptability",
":",
"human_messages",
",",
"violation_types",
"=",
"self",
".",
"_prepare_acceptability_checking",
"(",
")",
"violations_st... | [
355,
4
] | [
392,
19
] | python | en | ['en', 'error', 'th'] | False |
BaseModelChatWorld._prepare_acceptability_checking | (self) |
Return the list of human messages and the list of acceptability types to check.
|
Return the list of human messages and the list of acceptability types to check.
| def _prepare_acceptability_checking(self) -> Tuple[List[str], List[str]]:
"""
Return the list of human messages and the list of acceptability types to check.
"""
human_messages = [
message['text'] for message in self.dialog if message['agent_idx'] == 0
]
viola... | [
"def",
"_prepare_acceptability_checking",
"(",
"self",
")",
"->",
"Tuple",
"[",
"List",
"[",
"str",
"]",
",",
"List",
"[",
"str",
"]",
"]",
":",
"human_messages",
"=",
"[",
"message",
"[",
"'text'",
"]",
"for",
"message",
"in",
"self",
".",
"dialog",
"... | [
394,
4
] | [
402,
46
] | python | en | ['en', 'error', 'th'] | False |
ModelChatWorld._run_initial_turn | (self) |
Run the initial turn for both the human and the bot.
Optionally show the bot its persona. If we are in BST conversation mode, show 2
previous BST utterances to both the human and the bot; if we are in Meena-like
conversation mode, show "Hi!" to the human and the bot and let the bot res... |
Run the initial turn for both the human and the bot. | def _run_initial_turn(self) -> None:
"""
Run the initial turn for both the human and the bot.
Optionally show the bot its persona. If we are in BST conversation mode, show 2
previous BST utterances to both the human and the bot; if we are in Meena-like
conversation mode, show "H... | [
"def",
"_run_initial_turn",
"(",
"self",
")",
"->",
"None",
":",
"control_msg",
"=",
"{",
"\"episode_done\"",
":",
"False",
"}",
"if",
"self",
".",
"opt",
"[",
"'include_persona'",
"]",
":",
"# The Bot agent",
"# We add the personas and 1/3 of the time WoW topic as th... | [
426,
4
] | [
516,
13
] | python | en | ['en', 'error', 'th'] | False |
ModelChatWorld.get_final_chat_data | (self) |
Add non-image-chat-specific fields to the final chat data.
|
Add non-image-chat-specific fields to the final chat data.
| def get_final_chat_data(self) -> Dict[str, Any]:
"""
Add non-image-chat-specific fields to the final chat data.
"""
data = super().get_final_chat_data()
context_data = {
'personas': self.personas,
'context_dataset': self.context_info.get('context_dataset')... | [
"def",
"get_final_chat_data",
"(",
"self",
")",
"->",
"Dict",
"[",
"str",
",",
"Any",
"]",
":",
"data",
"=",
"super",
"(",
")",
".",
"get_final_chat_data",
"(",
")",
"context_data",
"=",
"{",
"'personas'",
":",
"self",
".",
"personas",
",",
"'context_dat... | [
566,
4
] | [
579,
19
] | python | en | ['en', 'error', 'th'] | False |
ModelChatWorld._prepare_acceptability_checking | (self) |
Apply acceptability checking params specific to BST-style conversation.
The BST mode starts the conversation with two previous utterances, so there
should be no new greeting. Also, the first human response is one of the previous
utterances, so it shouldn't get checked.
|
Apply acceptability checking params specific to BST-style conversation. | def _prepare_acceptability_checking(self) -> Tuple[List[str], List[str]]:
"""
Apply acceptability checking params specific to BST-style conversation.
The BST mode starts the conversation with two previous utterances, so there
should be no new greeting. Also, the first human response is ... | [
"def",
"_prepare_acceptability_checking",
"(",
"self",
")",
"->",
"Tuple",
"[",
"List",
"[",
"str",
"]",
",",
"List",
"[",
"str",
"]",
"]",
":",
"human_messages",
",",
"violation_types",
"=",
"super",
"(",
")",
".",
"_prepare_acceptability_checking",
"(",
")... | [
581,
4
] | [
593,
46
] | python | en | ['en', 'error', 'th'] | False |
Fill.color | (self) |
Sets the cell fill color. It accepts either a specific color or
an array of colors or a 2D array of colors.
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... |
Sets the cell fill color. It accepts either a specific color or
an array of colors or a 2D array of colors.
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... | def color(self):
"""
Sets the cell fill color. It accepts either a specific color or
an array of colors or a 2D array of colors.
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)')
... | [
"def",
"color",
"(",
"self",
")",
":",
"return",
"self",
"[",
"\"color\"",
"]"
] | [
15,
4
] | [
67,
28
] | python | en | ['en', 'error', 'th'] | False |
Fill.colorsrc | (self) |
Sets the source reference on Chart Studio Cloud for color .
The 'colorsrc' property must be specified as a string or
as a plotly.grid_objs.Column object
Returns
-------
str
|
Sets the source reference on Chart Studio Cloud for color .
The 'colorsrc' property must be specified as a string or
as a plotly.grid_objs.Column object | def colorsrc(self):
"""
Sets the source reference on Chart Studio Cloud for color .
The 'colorsrc' property must be specified as a string or
as a plotly.grid_objs.Column object
Returns
-------
str
"""
return self["colorsrc"] | [
"def",
"colorsrc",
"(",
"self",
")",
":",
"return",
"self",
"[",
"\"colorsrc\"",
"]"
] | [
76,
4
] | [
87,
31
] | python | en | ['en', 'error', 'th'] | False |
Fill.__init__ | (self, arg=None, color=None, colorsrc=None, **kwargs) |
Construct a new Fill object
Parameters
----------
arg
dict of properties compatible with this constructor or
an instance of
:class:`plotly.graph_objs.table.cells.Fill`
color
Sets the cell fill color. It accepts either a sp... |
Construct a new Fill object
Parameters
----------
arg
dict of properties compatible with this constructor or
an instance of
:class:`plotly.graph_objs.table.cells.Fill`
color
Sets the cell fill color. It accepts either a sp... | def __init__(self, arg=None, color=None, colorsrc=None, **kwargs):
"""
Construct a new Fill object
Parameters
----------
arg
dict of properties compatible with this constructor or
an instance of
:class:`plotly.graph_objs.table.cells.Fi... | [
"def",
"__init__",
"(",
"self",
",",
"arg",
"=",
"None",
",",
"color",
"=",
"None",
",",
"colorsrc",
"=",
"None",
",",
"*",
"*",
"kwargs",
")",
":",
"super",
"(",
"Fill",
",",
"self",
")",
".",
"__init__",
"(",
"\"fill\"",
")",
"if",
"\"_parent\"",... | [
106,
4
] | [
171,
34
] | python | en | ['en', 'error', 'th'] | False |
CommandTest.call | (self, cmdobj, args, msg=None, cmdset=None, noansi=True, caller=None,
receiver=None, cmdstring=None, obj=None, inputs=None) |
Test a command by assigning all the needed
properties to cmdobj and running
cmdobj.at_pre_cmd()
cmdobj.parse()
cmdobj.func()
cmdobj.at_post_cmd()
The msgreturn value is compared to eventual
output sent to caller.msg in the game
R... |
Test a command by assigning all the needed
properties to cmdobj and running
cmdobj.at_pre_cmd()
cmdobj.parse()
cmdobj.func()
cmdobj.at_post_cmd()
The msgreturn value is compared to eventual
output sent to caller.msg in the game | def call(self, cmdobj, args, msg=None, cmdset=None, noansi=True, caller=None,
receiver=None, cmdstring=None, obj=None, inputs=None):
"""
Test a command by assigning all the needed
properties to cmdobj and running
cmdobj.at_pre_cmd()
cmdobj.parse()
... | [
"def",
"call",
"(",
"self",
",",
"cmdobj",
",",
"args",
",",
"msg",
"=",
"None",
",",
"cmdset",
"=",
"None",
",",
"noansi",
"=",
"True",
",",
"caller",
"=",
"None",
",",
"receiver",
"=",
"None",
",",
"cmdstring",
"=",
"None",
",",
"obj",
"=",
"No... | [
47,
4
] | [
130,
27
] | python | en | ['en', 'error', 'th'] | False |
TestBuilding.test_empty_desc | (self) |
empty desc sets desc as ''
|
empty desc sets desc as ''
| def test_empty_desc(self):
"""
empty desc sets desc as ''
"""
o2d = self.obj2.db.desc
r1d = self.room1.db.desc
self.call(building.CmdDesc(), "Obj2=", "The description was set on Obj2(#5).")
assert self.obj2.db.desc == '' and self.obj2.db.desc != o2d
assert... | [
"def",
"test_empty_desc",
"(",
"self",
")",
":",
"o2d",
"=",
"self",
".",
"obj2",
".",
"db",
".",
"desc",
"r1d",
"=",
"self",
".",
"room1",
".",
"db",
".",
"desc",
"self",
".",
"call",
"(",
"building",
".",
"CmdDesc",
"(",
")",
",",
"\"Obj2=\"",
... | [
317,
4
] | [
325,
40
] | python | en | ['en', 'error', 'th'] | False |
TestBuilding.test_desc_default_to_room | (self) | no rhs changes room's desc | no rhs changes room's desc | def test_desc_default_to_room(self):
"""no rhs changes room's desc"""
o2d = self.obj2.db.desc
r1d = self.room1.db.desc
self.call(building.CmdDesc(), "Obj2", "The description was set on Room(#1).")
assert self.obj2.db.desc == o2d
assert self.room1.db.desc == 'Obj2' and sel... | [
"def",
"test_desc_default_to_room",
"(",
"self",
")",
":",
"o2d",
"=",
"self",
".",
"obj2",
".",
"db",
".",
"desc",
"r1d",
"=",
"self",
".",
"room1",
".",
"db",
".",
"desc",
"self",
".",
"call",
"(",
"building",
".",
"CmdDesc",
"(",
")",
",",
"\"Ob... | [
327,
4
] | [
333,
73
] | python | da | ['es', 'da', 'en'] | False |
ServerConfig.__key_get | (self) | Getter. Allows for value = self.key | Getter. Allows for value = self.key | def __key_get(self):
"Getter. Allows for value = self.key"
return self.db_key | [
"def",
"__key_get",
"(",
"self",
")",
":",
"return",
"self",
".",
"db_key"
] | [
65,
4
] | [
67,
26
] | python | en | ['en', 'en', 'en'] | True |
ServerConfig.__key_set | (self, value) | Setter. Allows for self.key = value | Setter. Allows for self.key = value | def __key_set(self, value):
"Setter. Allows for self.key = value"
self.db_key = value
self.save() | [
"def",
"__key_set",
"(",
"self",
",",
"value",
")",
":",
"self",
".",
"db_key",
"=",
"value",
"self",
".",
"save",
"(",
")"
] | [
70,
4
] | [
73,
19
] | python | en | ['en', 'no', 'en'] | True |
ServerConfig.__key_del | (self) | Deleter. Allows for del self.key. Deletes entry. | Deleter. Allows for del self.key. Deletes entry. | def __key_del(self):
"Deleter. Allows for del self.key. Deletes entry."
self.delete() | [
"def",
"__key_del",
"(",
"self",
")",
":",
"self",
".",
"delete",
"(",
")"
] | [
76,
4
] | [
78,
21
] | python | ca | ['ca', 'en', 'it'] | False |
ServerConfig.__value_get | (self) | Getter. Allows for value = self.value | Getter. Allows for value = self.value | def __value_get(self):
"Getter. Allows for value = self.value"
return pickle.loads(str(self.db_value)) | [
"def",
"__value_get",
"(",
"self",
")",
":",
"return",
"pickle",
".",
"loads",
"(",
"str",
"(",
"self",
".",
"db_value",
")",
")"
] | [
83,
4
] | [
85,
47
] | python | en | ['en', 'en', 'en'] | True |
ServerConfig.__value_set | (self, value) | Setter. Allows for self.value = value | Setter. Allows for self.value = value | def __value_set(self, value):
"Setter. Allows for self.value = value"
if utils.has_parent('django.db.models.base.Model', value):
# we have to protect against storing db objects.
logger.log_err("ServerConfig cannot store db objects! (%s)" % value)
return
self.d... | [
"def",
"__value_set",
"(",
"self",
",",
"value",
")",
":",
"if",
"utils",
".",
"has_parent",
"(",
"'django.db.models.base.Model'",
",",
"value",
")",
":",
"# we have to protect against storing db objects.",
"logger",
".",
"log_err",
"(",
"\"ServerConfig cannot store db ... | [
88,
4
] | [
95,
19
] | python | en | ['en', 'no', 'en'] | True |
ServerConfig.__value_del | (self) | Deleter. Allows for del self.value. Deletes entry. | Deleter. Allows for del self.value. Deletes entry. | def __value_del(self):
"Deleter. Allows for del self.value. Deletes entry."
self.delete() | [
"def",
"__value_del",
"(",
"self",
")",
":",
"self",
".",
"delete",
"(",
")"
] | [
98,
4
] | [
100,
21
] | python | ca | ['ca', 'en', 'it'] | False |
ServerConfig.store | (self, key, value) |
Wrap the storage.
Args:
key (str): The name of this store.
value (str): The data to store with this `key`.
|
Wrap the storage. | def store(self, key, value):
"""
Wrap the storage.
Args:
key (str): The name of this store.
value (str): The data to store with this `key`.
"""
self.key = key
self.value = value | [
"def",
"store",
"(",
"self",
",",
"key",
",",
"value",
")",
":",
"self",
".",
"key",
"=",
"key",
"self",
".",
"value",
"=",
"value"
] | [
115,
4
] | [
125,
26
] | python | en | ['en', 'error', 'th'] | False |
TorchImageAgent.add_cmdline_args | (
cls, parser: ParlaiParser, partial_opt: Optional[Opt] = None
) |
Add command-line arguments specifically for this agent.
|
Add command-line arguments specifically for this agent.
| def add_cmdline_args(
cls, parser: ParlaiParser, partial_opt: Optional[Opt] = None
) -> ParlaiParser:
"""
Add command-line arguments specifically for this agent.
"""
super().add_cmdline_args(parser, partial_opt=partial_opt)
agent = parser.add_argument_group('Image arg... | [
"def",
"add_cmdline_args",
"(",
"cls",
",",
"parser",
":",
"ParlaiParser",
",",
"partial_opt",
":",
"Optional",
"[",
"Opt",
"]",
"=",
"None",
")",
"->",
"ParlaiParser",
":",
"super",
"(",
")",
".",
"add_cmdline_args",
"(",
"parser",
",",
"partial_opt",
"="... | [
29,
4
] | [
68,
20
] | python | en | ['en', 'error', 'th'] | False |
TorchImageAgent.batchify | (self, obs_batch: List[Message], sort: bool = False) |
Override to handle image features.
|
Override to handle image features.
| def batchify(self, obs_batch: List[Message], sort: bool = False) -> Batch:
"""
Override to handle image features.
"""
batch = super().batchify(obs_batch, sort)
batch = self.batchify_image_features(batch)
return batch | [
"def",
"batchify",
"(",
"self",
",",
"obs_batch",
":",
"List",
"[",
"Message",
"]",
",",
"sort",
":",
"bool",
"=",
"False",
")",
"->",
"Batch",
":",
"batch",
"=",
"super",
"(",
")",
".",
"batchify",
"(",
"obs_batch",
",",
"sort",
")",
"batch",
"=",... | [
77,
4
] | [
83,
20
] | python | en | ['en', 'error', 'th'] | False |
TorchImageAgent.batchify_image_features | (self, batch: Batch) |
Put this batch of images into the correct format for this agent.
self._process_image_features() will likely be useful for this.
|
Put this batch of images into the correct format for this agent. | def batchify_image_features(self, batch: Batch) -> Batch:
"""
Put this batch of images into the correct format for this agent.
self._process_image_features() will likely be useful for this.
"""
raise NotImplementedError(
'Subclasses must implement method for batching... | [
"def",
"batchify_image_features",
"(",
"self",
",",
"batch",
":",
"Batch",
")",
"->",
"Batch",
":",
"raise",
"NotImplementedError",
"(",
"'Subclasses must implement method for batching images!'",
")"
] | [
86,
4
] | [
94,
9
] | python | en | ['en', 'error', 'th'] | False |
TorchImageAgent._process_image_features | (self, features: torch.Tensor) |
Format shape and type of input image-feature tensor.
|
Format shape and type of input image-feature tensor.
| def _process_image_features(self, features: torch.Tensor) -> torch.Tensor:
"""
Format shape and type of input image-feature tensor.
"""
if features.dim() == 4:
features = features[0, :, 0, 0]
assert features.size() == (self.image_features_dim,)
if self.use_cud... | [
"def",
"_process_image_features",
"(",
"self",
",",
"features",
":",
"torch",
".",
"Tensor",
")",
"->",
"torch",
".",
"Tensor",
":",
"if",
"features",
".",
"dim",
"(",
")",
"==",
"4",
":",
"features",
"=",
"features",
"[",
"0",
",",
":",
",",
"0",
... | [
96,
4
] | [
112,
23
] | python | en | ['en', 'error', 'th'] | False |
Font.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 |
Font.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 |
Font.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 |
Font.__init__ | (self, arg=None, color=None, family=None, size=None, **kwargs) |
Construct a new Font object
Sets this color bar's title font. Note that the title's font
used to be set by the now deprecated `titlefont` attribute.
Parameters
----------
arg
dict of properties compatible with this constructor or
an inst... |
Construct a new Font object
Sets this color bar's title font. Note that the title's font
used to be set by the now deprecated `titlefont` attribute. | def __init__(self, arg=None, color=None, family=None, size=None, **kwargs):
"""
Construct a new Font object
Sets this color bar's title font. Note that the title's font
used to be set by the now deprecated `titlefont` attribute.
Parameters
----------
arg... | [
"def",
"__init__",
"(",
"self",
",",
"arg",
"=",
"None",
",",
"color",
"=",
"None",
",",
"family",
"=",
"None",
",",
"size",
"=",
"None",
",",
"*",
"*",
"kwargs",
")",
":",
"super",
"(",
"Font",
",",
"self",
")",
".",
"__init__",
"(",
"\"font\"",... | [
143,
4
] | [
227,
34
] | python | en | ['en', 'error', 'th'] | False |
mpl_to_plotly | (fig, resize=False, strip_style=False, verbose=False) | Convert a matplotlib figure to plotly dictionary and send.
All available information about matplotlib visualizations are stored
within a matplotlib.figure.Figure object. You can create a plot in python
using matplotlib, store the figure object, and then pass this object to
the fig_to_plotly function. I... | Convert a matplotlib figure to plotly dictionary and send. | def mpl_to_plotly(fig, resize=False, strip_style=False, verbose=False):
"""Convert a matplotlib figure to plotly dictionary and send.
All available information about matplotlib visualizations are stored
within a matplotlib.figure.Figure object. You can create a plot in python
using matplotlib, store th... | [
"def",
"mpl_to_plotly",
"(",
"fig",
",",
"resize",
"=",
"False",
",",
"strip_style",
"=",
"False",
",",
"verbose",
"=",
"False",
")",
":",
"matplotlylib",
"=",
"optional_imports",
".",
"get_module",
"(",
"\"plotly.matplotlylib\"",
")",
"if",
"matplotlylib",
":... | [
74,
0
] | [
125,
9
] | python | en | ['en', 'en', 'en'] | True |
get_subplots | (rows=1, columns=1, print_grid=False, **kwargs) | Return a dictionary instance with the subplots set in 'layout'.
Example 1:
# stack two subplots vertically
fig = tools.get_subplots(rows=2)
fig['data'] += [Scatter(x=[1,2,3], y=[2,1,2], xaxis='x1', yaxis='y1')]
fig['data'] += [Scatter(x=[1,2,3], y=[2,1,2], xaxis='x2', yaxis='y2')]
Example 2:
... | Return a dictionary instance with the subplots set in 'layout'. | def get_subplots(rows=1, columns=1, print_grid=False, **kwargs):
"""Return a dictionary instance with the subplots set in 'layout'.
Example 1:
# stack two subplots vertically
fig = tools.get_subplots(rows=2)
fig['data'] += [Scatter(x=[1,2,3], y=[2,1,2], xaxis='x1', yaxis='y1')]
fig['data'] += [... | [
"def",
"get_subplots",
"(",
"rows",
"=",
"1",
",",
"columns",
"=",
"1",
",",
"print_grid",
"=",
"False",
",",
"*",
"*",
"kwargs",
")",
":",
"# TODO: protected until #282",
"from",
"plotly",
".",
"graph_objs",
"import",
"graph_objs",
"warnings",
".",
"warn",
... | [
131,
0
] | [
234,
33
] | python | en | ['en', 'en', 'en'] | True |
make_subplots | (
rows=1,
cols=1,
shared_xaxes=False,
shared_yaxes=False,
start_cell="top-left",
print_grid=None,
**kwargs
) | Return an instance of plotly.graph_objs.Figure
with the subplots domain set in 'layout'.
Example 1:
# stack two subplots vertically
fig = tools.make_subplots(rows=2)
This is the format of your plot grid:
[ (1,1) x1,y1 ]
[ (2,1) x2,y2 ]
fig['data'] += [Scatter(x=[1,2,3], y=[2,1,2])]
... | Return an instance of plotly.graph_objs.Figure
with the subplots domain set in 'layout'. | def make_subplots(
rows=1,
cols=1,
shared_xaxes=False,
shared_yaxes=False,
start_cell="top-left",
print_grid=None,
**kwargs
):
"""Return an instance of plotly.graph_objs.Figure
with the subplots domain set in 'layout'.
Example 1:
# stack two subplots vertically
fig = too... | [
"def",
"make_subplots",
"(",
"rows",
"=",
"1",
",",
"cols",
"=",
"1",
",",
"shared_xaxes",
"=",
"False",
",",
"shared_yaxes",
"=",
"False",
",",
"start_cell",
"=",
"\"top-left\"",
",",
"print_grid",
"=",
"None",
",",
"*",
"*",
"kwargs",
")",
":",
"impo... | [
237,
0
] | [
475,
5
] | python | en | ['en', 'en', 'en'] | True |
get_graph_obj | (obj, obj_type=None) | Returns a new graph object.
OLD FUNCTION: this will *silently* strip out invalid pieces of the object.
NEW FUNCTION: no striping of invalid pieces anymore - only raises error
on unrecognized graph_objs
| Returns a new graph object. | def get_graph_obj(obj, obj_type=None):
"""Returns a new graph object.
OLD FUNCTION: this will *silently* strip out invalid pieces of the object.
NEW FUNCTION: no striping of invalid pieces anymore - only raises error
on unrecognized graph_objs
"""
# TODO: Deprecate or move. #283
from pl... | [
"def",
"get_graph_obj",
"(",
"obj",
",",
"obj_type",
"=",
"None",
")",
":",
"# TODO: Deprecate or move. #283",
"from",
"plotly",
".",
"graph_objs",
"import",
"graph_objs",
"try",
":",
"cls",
"=",
"getattr",
"(",
"graph_objs",
",",
"obj_type",
")",
"except",
"(... | [
483,
0
] | [
499,
19
] | python | en | ['en', 'en', 'en'] | True |
_replace_newline | (obj) | Replaces '\n' with '<br>' for all strings in a collection. | Replaces '\n' with '<br>' for all strings in a collection. | def _replace_newline(obj):
"""Replaces '\n' with '<br>' for all strings in a collection."""
if isinstance(obj, dict):
d = dict()
for key, val in list(obj.items()):
d[key] = _replace_newline(val)
return d
elif isinstance(obj, list):
l = list()
for index, en... | [
"def",
"_replace_newline",
"(",
"obj",
")",
":",
"if",
"isinstance",
"(",
"obj",
",",
"dict",
")",
":",
"d",
"=",
"dict",
"(",
")",
"for",
"key",
",",
"val",
"in",
"list",
"(",
"obj",
".",
"items",
"(",
")",
")",
":",
"d",
"[",
"key",
"]",
"=... | [
502,
0
] | [
527,
18
] | python | en | ['en', 'en', 'en'] | True |
get_config_plotly_server_url | () |
Function to get the .config file's 'plotly_domain' without importing
the chart_studio package. This property is needed to compute the default
value of the plotly.js config plotlyServerURL, so it is independent of
the chart_studio integration and still needs to live in
Returns
-------
str
... |
Function to get the .config file's 'plotly_domain' without importing
the chart_studio package. This property is needed to compute the default
value of the plotly.js config plotlyServerURL, so it is independent of
the chart_studio integration and still needs to live in | def get_config_plotly_server_url():
"""
Function to get the .config file's 'plotly_domain' without importing
the chart_studio package. This property is needed to compute the default
value of the plotly.js config plotlyServerURL, so it is independent of
the chart_studio integration and still needs t... | [
"def",
"get_config_plotly_server_url",
"(",
")",
":",
"config_file",
"=",
"os",
".",
"path",
".",
"join",
"(",
"PLOTLY_DIR",
",",
"\".config\"",
")",
"default_server_url",
"=",
"\"https://plot.ly\"",
"if",
"not",
"os",
".",
"path",
".",
"exists",
"(",
"config_... | [
693,
0
] | [
717,
63
] | python | en | ['en', 'error', 'th'] | False |
collect_env | () | Collect the information of the running environments. | Collect the information of the running environments. | def collect_env():
"""Collect the information of the running environments."""
env_info = {}
env_info['sys.platform'] = sys.platform
env_info['Python'] = sys.version.replace('\n', '')
cuda_available = torch.cuda.is_available()
env_info['CUDA available'] = cuda_available
if cuda_available:
... | [
"def",
"collect_env",
"(",
")",
":",
"env_info",
"=",
"{",
"}",
"env_info",
"[",
"'sys.platform'",
"]",
"=",
"sys",
".",
"platform",
"env_info",
"[",
"'Python'",
"]",
"=",
"sys",
".",
"version",
".",
"replace",
"(",
"'\\n'",
",",
"''",
")",
"cuda_avail... | [
13,
0
] | [
58,
19
] | python | en | ['en', 'en', 'en'] | True |
roll_init | (character) |
Rolls a number between 1-1000 to determine initiative.
Args:
character (obj): The character to determine initiative for
Returns:
initiative (int): The character's place in initiative - higher
numbers go first.
Notes:
By default, does not reference the character and si... |
Rolls a number between 1-1000 to determine initiative. | def roll_init(character):
"""
Rolls a number between 1-1000 to determine initiative.
Args:
character (obj): The character to determine initiative for
Returns:
initiative (int): The character's place in initiative - higher
numbers go first.
Notes:
By default, does n... | [
"def",
"roll_init",
"(",
"character",
")",
":",
"return",
"randint",
"(",
"1",
",",
"1000",
")"
] | [
82,
0
] | [
106,
27
] | python | en | ['en', 'error', 'th'] | False |
get_attack | (attacker, defender) |
Returns a value for an attack roll.
Args:
attacker (obj): Character doing the attacking
defender (obj): Character being attacked
Returns:
attack_value (int): Attack roll value, compared against a defense value
to determine whether an attack hits or misses.
Notes:
... |
Returns a value for an attack roll. | def get_attack(attacker, defender):
"""
Returns a value for an attack roll.
Args:
attacker (obj): Character doing the attacking
defender (obj): Character being attacked
Returns:
attack_value (int): Attack roll value, compared against a defense value
to determine whe... | [
"def",
"get_attack",
"(",
"attacker",
",",
"defender",
")",
":",
"# For this example, just return a random integer up to 100.",
"attack_value",
"=",
"randint",
"(",
"1",
",",
"100",
")",
"return",
"attack_value"
] | [
109,
0
] | [
131,
23
] | python | en | ['en', 'error', 'th'] | False |
get_defense | (attacker, defender) |
Returns a value for defense, which an attack roll must equal or exceed in order
for an attack to hit.
Args:
attacker (obj): Character doing the attacking
defender (obj): Character being attacked
Returns:
defense_value (int): Defense value, compared against an attack roll
... |
Returns a value for defense, which an attack roll must equal or exceed in order
for an attack to hit. | def get_defense(attacker, defender):
"""
Returns a value for defense, which an attack roll must equal or exceed in order
for an attack to hit.
Args:
attacker (obj): Character doing the attacking
defender (obj): Character being attacked
Returns:
defense_value (int): Defense ... | [
"def",
"get_defense",
"(",
"attacker",
",",
"defender",
")",
":",
"# For this example, just return 50, for about a 50/50 chance of hit.",
"defense_value",
"=",
"50",
"return",
"defense_value"
] | [
134,
0
] | [
155,
24
] | python | en | ['en', 'error', 'th'] | False |
get_damage | (attacker, defender) |
Returns a value for damage to be deducted from the defender's HP after abilities
successful hit.
Args:
attacker (obj): Character doing the attacking
defender (obj): Character being damaged
Returns:
damage_value (int): Damage value, which is to be deducted from the defending
... |
Returns a value for damage to be deducted from the defender's HP after abilities
successful hit. | def get_damage(attacker, defender):
"""
Returns a value for damage to be deducted from the defender's HP after abilities
successful hit.
Args:
attacker (obj): Character doing the attacking
defender (obj): Character being damaged
Returns:
damage_value (int): Damage value, wh... | [
"def",
"get_damage",
"(",
"attacker",
",",
"defender",
")",
":",
"# For this example, just generate a number between 15 and 25.",
"damage_value",
"=",
"randint",
"(",
"15",
",",
"25",
")",
"return",
"damage_value"
] | [
158,
0
] | [
179,
23
] | python | en | ['en', 'error', 'th'] | False |
apply_damage | (defender, damage) |
Applies damage to a target, reducing their HP by the damage amount to a
minimum of 0.
Args:
defender (obj): Character taking damage
damage (int): Amount of damage being taken
|
Applies damage to a target, reducing their HP by the damage amount to a
minimum of 0. | def apply_damage(defender, damage):
"""
Applies damage to a target, reducing their HP by the damage amount to a
minimum of 0.
Args:
defender (obj): Character taking damage
damage (int): Amount of damage being taken
"""
defender.db.hp -= damage # Reduce defender's HP by the dama... | [
"def",
"apply_damage",
"(",
"defender",
",",
"damage",
")",
":",
"defender",
".",
"db",
".",
"hp",
"-=",
"damage",
"# Reduce defender's HP by the damage dealt.",
"# If this reduces it to 0 or less, set HP to 0.",
"if",
"defender",
".",
"db",
".",
"hp",
"<=",
"0",
":... | [
182,
0
] | [
194,
26
] | python | en | ['en', 'error', 'th'] | False |
at_defeat | (defeated) |
Announces the defeat of a fighter in combat.
Args:
defeated (obj): Fighter that's been defeated.
Notes:
All this does is announce a defeat message by default, but if you
want anything else to happen to defeated fighters (like putting them
into a dying state or some... |
Announces the defeat of a fighter in combat.
Args:
defeated (obj): Fighter that's been defeated.
Notes:
All this does is announce a defeat message by default, but if you
want anything else to happen to defeated fighters (like putting them
into a dying state or some... | def at_defeat(defeated):
"""
Announces the defeat of a fighter in combat.
Args:
defeated (obj): Fighter that's been defeated.
Notes:
All this does is announce a defeat message by default, but if you
want anything else to happen to defeated fighters (like putting them
... | [
"def",
"at_defeat",
"(",
"defeated",
")",
":",
"defeated",
".",
"location",
".",
"msg_contents",
"(",
"\"%s has been defeated!\"",
"%",
"defeated",
")"
] | [
196,
0
] | [
209,
70
] | python | en | ['en', 'error', 'th'] | False |
resolve_attack | (attacker, defender, attack_value=None, defense_value=None) |
Resolves an attack and outputs the result.
Args:
attacker (obj): Character doing the attacking
defender (obj): Character being attacked
Notes:
Even though the attack and defense values are calculated
extremely simply, they are separated out into their own functions
... |
Resolves an attack and outputs the result. | def resolve_attack(attacker, defender, attack_value=None, defense_value=None):
"""
Resolves an attack and outputs the result.
Args:
attacker (obj): Character doing the attacking
defender (obj): Character being attacked
Notes:
Even though the attack and defense values are calcul... | [
"def",
"resolve_attack",
"(",
"attacker",
",",
"defender",
",",
"attack_value",
"=",
"None",
",",
"defense_value",
"=",
"None",
")",
":",
"# Get an attack roll from the attacker.",
"if",
"not",
"attack_value",
":",
"attack_value",
"=",
"get_attack",
"(",
"attacker",... | [
211,
0
] | [
240,
31
] | python | en | ['en', 'error', 'th'] | False |
combat_cleanup | (character) |
Cleans up all the temporary combat-related attributes on a character.
Args:
character (obj): Character to have their combat attributes removed
Notes:
Any attribute whose key begins with 'combat_' is temporary and no
longer needed once a fight ends.
|
Cleans up all the temporary combat-related attributes on a character. | def combat_cleanup(character):
"""
Cleans up all the temporary combat-related attributes on a character.
Args:
character (obj): Character to have their combat attributes removed
Notes:
Any attribute whose key begins with 'combat_' is temporary and no
longer needed once a fight ... | [
"def",
"combat_cleanup",
"(",
"character",
")",
":",
"for",
"attr",
"in",
"character",
".",
"attributes",
".",
"all",
"(",
")",
":",
"if",
"attr",
".",
"key",
"[",
":",
"7",
"]",
"==",
"\"combat_\"",
":",
"# If the attribute name starts with 'combat_'...",
"... | [
242,
0
] | [
255,
53
] | python | en | ['en', 'error', 'th'] | False |
is_in_combat | (character) |
Returns true if the given character is in combat.
Args:
character (obj): Character to determine if is in combat or not
Returns:
(bool): True if in combat or False if not in combat
|
Returns true if the given character is in combat. | def is_in_combat(character):
"""
Returns true if the given character is in combat.
Args:
character (obj): Character to determine if is in combat or not
Returns:
(bool): True if in combat or False if not in combat
"""
return bool(character.db.combat_turnhandler) | [
"def",
"is_in_combat",
"(",
"character",
")",
":",
"return",
"bool",
"(",
"character",
".",
"db",
".",
"combat_turnhandler",
")"
] | [
258,
0
] | [
268,
48
] | python | en | ['en', 'error', 'th'] | False |
is_turn | (character) |
Returns true if it's currently the given character's turn in combat.
Args:
character (obj): Character to determine if it is their turn or not
Returns:
(bool): True if it is their turn or False otherwise
|
Returns true if it's currently the given character's turn in combat. | def is_turn(character):
"""
Returns true if it's currently the given character's turn in combat.
Args:
character (obj): Character to determine if it is their turn or not
Returns:
(bool): True if it is their turn or False otherwise
"""
turnhandler = character.db.combat_turnhandl... | [
"def",
"is_turn",
"(",
"character",
")",
":",
"turnhandler",
"=",
"character",
".",
"db",
".",
"combat_turnhandler",
"currentchar",
"=",
"turnhandler",
".",
"db",
".",
"fighters",
"[",
"turnhandler",
".",
"db",
".",
"turn",
"]",
"return",
"bool",
"(",
"cha... | [
271,
0
] | [
283,
41
] | python | en | ['en', 'error', 'th'] | False |
spend_action | (character, actions, action_name=None) |
Spends a character's available combat actions and checks for end of turn.
Args:
character (obj): Character spending the action
actions (int) or 'all': Number of actions to spend, or 'all' to spend all actions
Kwargs:
action_name (str or None): If a string is given, sets character'... |
Spends a character's available combat actions and checks for end of turn. | def spend_action(character, actions, action_name=None):
"""
Spends a character's available combat actions and checks for end of turn.
Args:
character (obj): Character spending the action
actions (int) or 'all': Number of actions to spend, or 'all' to spend all actions
Kwargs:
a... | [
"def",
"spend_action",
"(",
"character",
",",
"actions",
",",
"action_name",
"=",
"None",
")",
":",
"if",
"not",
"is_in_combat",
"(",
"character",
")",
":",
"return",
"if",
"action_name",
":",
"character",
".",
"db",
".",
"combat_lastaction",
"=",
"action_na... | [
286,
0
] | [
308,
61
] | python | en | ['en', 'error', 'th'] | False |
spell_healing | (caster, spell_name, targets, cost, **kwargs) |
Spell that restores HP to a target or targets.
kwargs:
healing_range (tuple): Minimum and maximum amount healed to
each target. (20, 40) by default.
|
Spell that restores HP to a target or targets.
kwargs:
healing_range (tuple): Minimum and maximum amount healed to
each target. (20, 40) by default.
| def spell_healing(caster, spell_name, targets, cost, **kwargs):
"""
Spell that restores HP to a target or targets.
kwargs:
healing_range (tuple): Minimum and maximum amount healed to
each target. (20, 40) by default.
"""
spell_msg = "%s casts %s!" % (caster, spell_name)
... | [
"def",
"spell_healing",
"(",
"caster",
",",
"spell_name",
",",
"targets",
",",
"cost",
",",
"*",
"*",
"kwargs",
")",
":",
"spell_msg",
"=",
"\"%s casts %s!\"",
"%",
"(",
"caster",
",",
"spell_name",
")",
"min_healing",
"=",
"20",
"max_healing",
"=",
"40",
... | [
1074,
0
] | [
1104,
51
] | python | en | ['en', 'error', 'th'] | False |
spell_attack | (caster, spell_name, targets, cost, **kwargs) |
Spell that deals damage in combat. Similar to resolve_attack.
kwargs:
attack_name (tuple): Single and plural describing the sort of
attack or projectile that strikes each enemy.
damage_range (tuple): Minimum and maximum damage dealt by the
spell. (10, 20) by default... |
Spell that deals damage in combat. Similar to resolve_attack.
kwargs:
attack_name (tuple): Single and plural describing the sort of
attack or projectile that strikes each enemy.
damage_range (tuple): Minimum and maximum damage dealt by the
spell. (10, 20) by default... | def spell_attack(caster, spell_name, targets, cost, **kwargs):
"""
Spell that deals damage in combat. Similar to resolve_attack.
kwargs:
attack_name (tuple): Single and plural describing the sort of
attack or projectile that strikes each enemy.
damage_range (tuple): Minimum ... | [
"def",
"spell_attack",
"(",
"caster",
",",
"spell_name",
",",
"targets",
",",
"cost",
",",
"*",
"*",
"kwargs",
")",
":",
"spell_msg",
"=",
"\"%s casts %s!\"",
"%",
"(",
"caster",
",",
"spell_name",
")",
"atkname_single",
"=",
"\"The spell\"",
"atkname_plural",... | [
1106,
0
] | [
1194,
51
] | python | en | ['en', 'error', 'th'] | False |
spell_conjure | (caster, spell_name, targets, cost, **kwargs) |
Spell that creates an object.
kwargs:
obj_key (str): Key of the created object.
obj_desc (str): Desc of the created object.
obj_typeclass (str): Typeclass path of the object.
If you want to make more use of this particular spell funciton,
you may want to modify it to u... |
Spell that creates an object.
kwargs:
obj_key (str): Key of the created object.
obj_desc (str): Desc of the created object.
obj_typeclass (str): Typeclass path of the object.
If you want to make more use of this particular spell funciton,
you may want to modify it to u... | def spell_conjure(caster, spell_name, targets, cost, **kwargs):
"""
Spell that creates an object.
kwargs:
obj_key (str): Key of the created object.
obj_desc (str): Desc of the created object.
obj_typeclass (str): Typeclass path of the object.
If you want to make more us... | [
"def",
"spell_conjure",
"(",
"caster",
",",
"spell_name",
",",
"targets",
",",
"cost",
",",
"*",
"*",
"kwargs",
")",
":",
"obj_key",
"=",
"\"a nondescript object\"",
"obj_desc",
"=",
"\"A perfectly generic object.\"",
"obj_typeclass",
"=",
"\"evennia.objects.objects.D... | [
1196,
0
] | [
1228,
101
] | python | en | ['en', 'error', 'th'] | False |
TBMagicCharacter.at_object_creation | (self) |
Called once, when this object is first created. This is the
normal hook to overload for most object types.
Adds attributes for a character's current and maximum HP.
We're just going to set this value at '100' by default.
You may want to expand this to include various '... |
Called once, when this object is first created. This is the
normal hook to overload for most object types.
Adds attributes for a character's current and maximum HP.
We're just going to set this value at '100' by default. | def at_object_creation(self):
"""
Called once, when this object is first created. This is the
normal hook to overload for most object types.
Adds attributes for a character's current and maximum HP.
We're just going to set this value at '100' by default.
You may... | [
"def",
"at_object_creation",
"(",
"self",
")",
":",
"self",
".",
"db",
".",
"max_hp",
"=",
"100",
"# Set maximum HP to 100",
"self",
".",
"db",
".",
"hp",
"=",
"self",
".",
"db",
".",
"max_hp",
"# Set current HP to maximum",
"self",
".",
"db",
".",
"spells... | [
324,
4
] | [
339,
35
] | python | en | ['en', 'error', 'th'] | False |
TBMagicCharacter.at_before_move | (self, destination) |
Called just before starting to move this object to
destination.
Args:
destination (Object): The object we are moving to
Returns:
shouldmove (bool): If we should move or not.
Notes:
If this method returns False/None, the move is cancelled
... |
Called just before starting to move this object to
destination. | def at_before_move(self, destination):
"""
Called just before starting to move this object to
destination.
Args:
destination (Object): The object we are moving to
Returns:
shouldmove (bool): If we should move or not.
Notes:
If this m... | [
"def",
"at_before_move",
"(",
"self",
",",
"destination",
")",
":",
"# Keep the character from moving if at 0 HP or in combat.",
"if",
"is_in_combat",
"(",
"self",
")",
":",
"self",
".",
"msg",
"(",
"\"You can't exit a room while in combat!\"",
")",
"return",
"False",
"... | [
342,
4
] | [
365,
19
] | python | en | ['en', 'error', 'th'] | False |
TBMagicTurnHandler.at_script_creation | (self) |
Called once, when the script is created.
|
Called once, when the script is created.
| def at_script_creation(self):
"""
Called once, when the script is created.
"""
self.key = "Combat Turn Handler"
self.interval = 5 # Once every 5 seconds
self.persistent = True
self.db.fighters = []
# Add all fighters in the room with at least 1 HP to the... | [
"def",
"at_script_creation",
"(",
"self",
")",
":",
"self",
".",
"key",
"=",
"\"Combat Turn Handler\"",
"self",
".",
"interval",
"=",
"5",
"# Once every 5 seconds",
"self",
".",
"persistent",
"=",
"True",
"self",
".",
"db",
".",
"fighters",
"=",
"[",
"]",
... | [
386,
4
] | [
420,
36
] | python | en | ['en', 'error', 'th'] | False |
TBMagicTurnHandler.at_stop | (self) |
Called at script termination.
|
Called at script termination.
| def at_stop(self):
"""
Called at script termination.
"""
for fighter in self.db.fighters:
combat_cleanup(fighter) # Clean up the combat attributes for every fighter.
self.obj.db.combat_turnhandler = None | [
"def",
"at_stop",
"(",
"self",
")",
":",
"for",
"fighter",
"in",
"self",
".",
"db",
".",
"fighters",
":",
"combat_cleanup",
"(",
"fighter",
")",
"# Clean up the combat attributes for every fighter.",
"self",
".",
"obj",
".",
"db",
".",
"combat_turnhandler",
"=",... | [
422,
4
] | [
428,
45
] | python | en | ['en', 'error', 'th'] | False |
TBMagicTurnHandler.at_repeat | (self) |
Called once every self.interval seconds.
|
Called once every self.interval seconds.
| def at_repeat(self):
"""
Called once every self.interval seconds.
"""
currentchar = self.db.fighters[self.db.turn] # Note the current character in the turn order.
self.db.timer -= self.interval # Count down the timer.
if self.db.timer <= 0:
# Force current ... | [
"def",
"at_repeat",
"(",
"self",
")",
":",
"currentchar",
"=",
"self",
".",
"db",
".",
"fighters",
"[",
"self",
".",
"db",
".",
"turn",
"]",
"# Note the current character in the turn order.",
"self",
".",
"db",
".",
"timer",
"-=",
"self",
".",
"interval",
... | [
430,
4
] | [
445,
48
] | python | en | ['en', 'error', 'th'] | False |
TBMagicTurnHandler.initialize_for_combat | (self, character) |
Prepares a character for combat when starting or entering a fight.
Args:
character (obj): Character to initialize for combat.
|
Prepares a character for combat when starting or entering a fight. | def initialize_for_combat(self, character):
"""
Prepares a character for combat when starting or entering a fight.
Args:
character (obj): Character to initialize for combat.
"""
combat_cleanup(character) # Clean up leftover combat attributes beforehand, just in case... | [
"def",
"initialize_for_combat",
"(",
"self",
",",
"character",
")",
":",
"combat_cleanup",
"(",
"character",
")",
"# Clean up leftover combat attributes beforehand, just in case.",
"character",
".",
"db",
".",
"combat_actionsleft",
"=",
"0",
"# Actions remaining - start of tu... | [
447,
4
] | [
457,
47
] | python | en | ['en', 'error', 'th'] | False |
TBMagicTurnHandler.start_turn | (self, character) |
Readies a character for the start of their turn by replenishing their
available actions and notifying them that their turn has come up.
Args:
character (obj): Character to be readied.
Notes:
Here, you only get one action per turn, but you might want to allow mo... |
Readies a character for the start of their turn by replenishing their
available actions and notifying them that their turn has come up. | def start_turn(self, character):
"""
Readies a character for the start of their turn by replenishing their
available actions and notifying them that their turn has come up.
Args:
character (obj): Character to be readied.
Notes:
Here, you only get one act... | [
"def",
"start_turn",
"(",
"self",
",",
"character",
")",
":",
"character",
".",
"db",
".",
"combat_actionsleft",
"=",
"ACTIONS_PER_TURN",
"# Replenish actions",
"# Prompt the character for their turn and give some information.",
"character",
".",
"msg",
"(",
"\"|wIt's your ... | [
459,
4
] | [
476,
88
] | python | en | ['en', 'error', 'th'] | False |
TBMagicTurnHandler.next_turn | (self) |
Advances to the next character in the turn order.
|
Advances to the next character in the turn order.
| def next_turn(self):
"""
Advances to the next character in the turn order.
"""
# Check to see if every character disengaged as their last action. If so, end combat.
disengage_check = True
for fighter in self.db.fighters:
if fighter.db.combat_lastaction != "di... | [
"def",
"next_turn",
"(",
"self",
")",
":",
"# Check to see if every character disengaged as their last action. If so, end combat.",
"disengage_check",
"=",
"True",
"for",
"fighter",
"in",
"self",
".",
"db",
".",
"fighters",
":",
"if",
"fighter",
".",
"db",
".",
"comba... | [
478,
4
] | [
515,
32
] | python | en | ['en', 'error', 'th'] | False |
TBMagicTurnHandler.turn_end_check | (self, character) |
Tests to see if a character's turn is over, and cycles to the next turn if it is.
Args:
character (obj): Character to test for end of turn
|
Tests to see if a character's turn is over, and cycles to the next turn if it is. | def turn_end_check(self, character):
"""
Tests to see if a character's turn is over, and cycles to the next turn if it is.
Args:
character (obj): Character to test for end of turn
"""
if not character.db.combat_actionsleft: # Character has no actions remaining
... | [
"def",
"turn_end_check",
"(",
"self",
",",
"character",
")",
":",
"if",
"not",
"character",
".",
"db",
".",
"combat_actionsleft",
":",
"# Character has no actions remaining",
"self",
".",
"next_turn",
"(",
")",
"return"
] | [
517,
4
] | [
526,
18
] | python | en | ['en', 'error', 'th'] | False |
TBMagicTurnHandler.join_fight | (self, character) |
Adds a new character to a fight already in progress.
Args:
character (obj): Character to be added to the fight.
|
Adds a new character to a fight already in progress. | def join_fight(self, character):
"""
Adds a new character to a fight already in progress.
Args:
character (obj): Character to be added to the fight.
"""
# Inserts the fighter to the turn order, right behind whoever's turn it currently is.
self.db.fighters.ins... | [
"def",
"join_fight",
"(",
"self",
",",
"character",
")",
":",
"# Inserts the fighter to the turn order, right behind whoever's turn it currently is.",
"self",
".",
"db",
".",
"fighters",
".",
"insert",
"(",
"self",
".",
"db",
".",
"turn",
",",
"character",
")",
"# T... | [
528,
4
] | [
540,
45
] | python | en | ['en', 'error', 'th'] | False |
CmdFight.func | (self) |
This performs the actual command.
|
This performs the actual command.
| def func(self):
"""
This performs the actual command.
"""
here = self.caller.location
fighters = []
if not self.caller.db.hp: # If you don't have any hp
self.caller.msg("You can't start a fight if you've been defeated!")
return
if is_in_c... | [
"def",
"func",
"(",
"self",
")",
":",
"here",
"=",
"self",
".",
"caller",
".",
"location",
"fighters",
"=",
"[",
"]",
"if",
"not",
"self",
".",
"caller",
".",
"db",
".",
"hp",
":",
"# If you don't have any hp",
"self",
".",
"caller",
".",
"msg",
"(",... | [
564,
4
] | [
589,
74
] | python | en | ['en', 'error', 'th'] | False |
CmdAttack.func | (self) | This performs the actual command. | This performs the actual command. | def func(self):
"This performs the actual command."
"Set the attacker to the caller and the defender to the target."
if not is_in_combat(self.caller): # If not in combat, can't attack.
self.caller.msg("You can only do that in combat. (see: help fight)")
return
... | [
"def",
"func",
"(",
"self",
")",
":",
"\"Set the attacker to the caller and the defender to the target.\"",
"if",
"not",
"is_in_combat",
"(",
"self",
".",
"caller",
")",
":",
"# If not in combat, can't attack.",
"self",
".",
"caller",
".",
"msg",
"(",
"\"You can only do... | [
607,
4
] | [
639,
58
] | python | en | ['en', 'en', 'en'] | True |
CmdPass.func | (self) |
This performs the actual command.
|
This performs the actual command.
| def func(self):
"""
This performs the actual command.
"""
if not is_in_combat(self.caller): # Can only pass a turn in combat.
self.caller.msg("You can only do that in combat. (see: help fight)")
return
if not is_turn(self.caller): # Can only pass if it'... | [
"def",
"func",
"(",
"self",
")",
":",
"if",
"not",
"is_in_combat",
"(",
"self",
".",
"caller",
")",
":",
"# Can only pass a turn in combat.",
"self",
".",
"caller",
".",
"msg",
"(",
"\"You can only do that in combat. (see: help fight)\"",
")",
"return",
"if",
"not... | [
657,
4
] | [
670,
60
] | python | en | ['en', 'error', 'th'] | False |
CmdDisengage.func | (self) |
This performs the actual command.
|
This performs the actual command.
| def func(self):
"""
This performs the actual command.
"""
if not is_in_combat(self.caller): # If you're not in combat
self.caller.msg("You can only do that in combat. (see: help fight)")
return
if not is_turn(self.caller): # If it's not your turn
... | [
"def",
"func",
"(",
"self",
")",
":",
"if",
"not",
"is_in_combat",
"(",
"self",
".",
"caller",
")",
":",
"# If you're not in combat",
"self",
".",
"caller",
".",
"msg",
"(",
"\"You can only do that in combat. (see: help fight)\"",
")",
"return",
"if",
"not",
"is... | [
689,
4
] | [
706,
11
] | python | en | ['en', 'error', 'th'] | False |
CmdLearnSpell.func | (self) |
This performs the actual command.
|
This performs the actual command.
| def func(self):
"""
This performs the actual command.
"""
spell_list = sorted(SPELLS.keys())
args = self.args.lower()
args = args.strip(" ")
caller = self.caller
spell_to_learn = []
if not args or len(args) < 3: # No spell given
... | [
"def",
"func",
"(",
"self",
")",
":",
"spell_list",
"=",
"sorted",
"(",
"SPELLS",
".",
"keys",
"(",
")",
")",
"args",
"=",
"self",
".",
"args",
".",
"lower",
"(",
")",
"args",
"=",
"args",
".",
"strip",
"(",
"\" \"",
")",
"caller",
"=",
"self",
... | [
737,
4
] | [
776,
11
] | python | en | ['en', 'error', 'th'] | False |
CmdCast.func | (self) |
This performs the actual command.
Note: This is a quite long command, since it has to cope with all
the different circumstances in which you may or may not be able
to cast a spell. None of the spell's effects are handled by the
command - all the command does is verify t... |
This performs the actual command.
Note: This is a quite long command, since it has to cope with all
the different circumstances in which you may or may not be able
to cast a spell. None of the spell's effects are handled by the
command - all the command does is verify t... | def func(self):
"""
This performs the actual command.
Note: This is a quite long command, since it has to cope with all
the different circumstances in which you may or may not be able
to cast a spell. None of the spell's effects are handled by the
command - all t... | [
"def",
"func",
"(",
"self",
")",
":",
"caller",
"=",
"self",
".",
"caller",
"if",
"not",
"self",
".",
"lhs",
"or",
"len",
"(",
"self",
".",
"lhs",
")",
"<",
"3",
":",
"# No spell name given",
"caller",
".",
"msg",
"(",
"\"Usage: cast <spell name> = <targ... | [
794,
4
] | [
953,
73
] | python | en | ['en', 'error', 'th'] | False |
CmdRest.func | (self) | This performs the actual command. | This performs the actual command. | def func(self):
"This performs the actual command."
if is_in_combat(self.caller): # If you're in combat
self.caller.msg("You can't rest while you're in combat.")
return
self.caller.db.hp = self.caller.db.max_hp # Set current HP to maximum
self.caller.db.mp = s... | [
"def",
"func",
"(",
"self",
")",
":",
"if",
"is_in_combat",
"(",
"self",
".",
"caller",
")",
":",
"# If you're in combat",
"self",
".",
"caller",
".",
"msg",
"(",
"\"You can't rest while you're in combat.\"",
")",
"return",
"self",
".",
"caller",
".",
"db",
... | [
970,
4
] | [
979,
89
] | python | en | ['en', 'en', 'en'] | True |
CmdStatus.func | (self) | This performs the actual command. | This performs the actual command. | def func(self):
"This performs the actual command."
char = self.caller
if not char.db.max_hp: # Character not initialized, IE in unit tests
char.db.hp = 100
char.db.max_hp = 100
char.db.spells_known = []
char.db.max_mp = 20
cha... | [
"def",
"func",
"(",
"self",
")",
":",
"char",
"=",
"self",
".",
"caller",
"if",
"not",
"char",
".",
"db",
".",
"max_hp",
":",
"# Character not initialized, IE in unit tests",
"char",
".",
"db",
".",
"hp",
"=",
"100",
"char",
".",
"db",
".",
"max_hp",
"... | [
996,
4
] | [
1007,
114
] | python | en | ['en', 'en', 'en'] | True |
BattleCmdSet.at_cmdset_creation | (self) |
Populates the cmdset
|
Populates the cmdset
| def at_cmdset_creation(self):
"""
Populates the cmdset
"""
self.add(CmdFight())
self.add(CmdAttack())
self.add(CmdRest())
self.add(CmdPass())
self.add(CmdDisengage())
self.add(CmdCombatHelp())
self.add(CmdLearnSpell())
self.add(CmdC... | [
"def",
"at_cmdset_creation",
"(",
"self",
")",
":",
"self",
".",
"add",
"(",
"CmdFight",
"(",
")",
")",
"self",
".",
"add",
"(",
"CmdAttack",
"(",
")",
")",
"self",
".",
"add",
"(",
"CmdRest",
"(",
")",
")",
"self",
".",
"add",
"(",
"CmdPass",
"(... | [
1040,
4
] | [
1052,
29
] | python | en | ['en', 'error', 'th'] | False |
Decreasing.marker | (self) |
The 'marker' property is an instance of Marker
that may be specified as:
- An instance of :class:`plotly.graph_objs.waterfall.decreasing.Marker`
- A dict of string/value properties that will be passed
to the Marker constructor
Supported dict properties:
... |
The 'marker' property is an instance of Marker
that may be specified as:
- An instance of :class:`plotly.graph_objs.waterfall.decreasing.Marker`
- A dict of string/value properties that will be passed
to the Marker constructor
Supported dict properties:
... | def marker(self):
"""
The 'marker' property is an instance of Marker
that may be specified as:
- An instance of :class:`plotly.graph_objs.waterfall.decreasing.Marker`
- A dict of string/value properties that will be passed
to the Marker constructor
... | [
"def",
"marker",
"(",
"self",
")",
":",
"return",
"self",
"[",
"\"marker\"",
"]"
] | [
15,
4
] | [
36,
29
] | python | en | ['en', 'error', 'th'] | False |
Decreasing.__init__ | (self, arg=None, marker=None, **kwargs) |
Construct a new Decreasing object
Parameters
----------
arg
dict of properties compatible with this constructor or
an instance of
:class:`plotly.graph_objs.waterfall.Decreasing`
marker
:class:`plotly.graph_objects.waterfal... |
Construct a new Decreasing object
Parameters
----------
arg
dict of properties compatible with this constructor or
an instance of
:class:`plotly.graph_objs.waterfall.Decreasing`
marker
:class:`plotly.graph_objects.waterfal... | def __init__(self, arg=None, marker=None, **kwargs):
"""
Construct a new Decreasing object
Parameters
----------
arg
dict of properties compatible with this constructor or
an instance of
:class:`plotly.graph_objs.waterfall.Decreasing`
... | [
"def",
"__init__",
"(",
"self",
",",
"arg",
"=",
"None",
",",
"marker",
"=",
"None",
",",
"*",
"*",
"kwargs",
")",
":",
"super",
"(",
"Decreasing",
",",
"self",
")",
".",
"__init__",
"(",
"\"decreasing\"",
")",
"if",
"\"_parent\"",
"in",
"kwargs",
":... | [
52,
4
] | [
110,
34
] | python | en | ['en', 'error', 'th'] | False |
Hoverlabel.align | (self) |
Sets the horizontal alignment of the text content within hover
label box. Has an effect only if the hover label text spans
more two or more lines
The 'align' property is an enumeration that may be specified as:
- One of the following enumeration values:
['... |
Sets the horizontal alignment of the text content within hover
label box. Has an effect only if the hover label text spans
more two or more lines
The 'align' property is an enumeration that may be specified as:
- One of the following enumeration values:
['... | def align(self):
"""
Sets the horizontal alignment of the text content within hover
label box. Has an effect only if the hover label text spans
more two or more lines
The 'align' property is an enumeration that may be specified as:
- One of the following enumeratio... | [
"def",
"align",
"(",
"self",
")",
":",
"return",
"self",
"[",
"\"align\"",
"]"
] | [
25,
4
] | [
40,
28
] | python | en | ['en', 'error', 'th'] | False |
Hoverlabel.alignsrc | (self) |
Sets the source reference on Chart Studio Cloud for align .
The 'alignsrc' property must be specified as a string or
as a plotly.grid_objs.Column object
Returns
-------
str
|
Sets the source reference on Chart Studio Cloud for align .
The 'alignsrc' property must be specified as a string or
as a plotly.grid_objs.Column object | def alignsrc(self):
"""
Sets the source reference on Chart Studio Cloud for align .
The 'alignsrc' property must be specified as a string or
as a plotly.grid_objs.Column object
Returns
-------
str
"""
return self["alignsrc"] | [
"def",
"alignsrc",
"(",
"self",
")",
":",
"return",
"self",
"[",
"\"alignsrc\"",
"]"
] | [
49,
4
] | [
60,
31
] | python | en | ['en', 'error', 'th'] | False |
Hoverlabel.bgcolor | (self) |
Sets the background color of the hover labels for this trace
The 'bgcolor' 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 str... |
Sets the background color of the hover labels for this trace
The 'bgcolor' 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 str... | def bgcolor(self):
"""
Sets the background color of the hover labels for this trace
The 'bgcolor' 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%)... | [
"def",
"bgcolor",
"(",
"self",
")",
":",
"return",
"self",
"[",
"\"bgcolor\"",
"]"
] | [
69,
4
] | [
120,
30
] | python | en | ['en', 'error', 'th'] | False |
Hoverlabel.bgcolorsrc | (self) |
Sets the source reference on Chart Studio Cloud for bgcolor .
The 'bgcolorsrc' property must be specified as a string or
as a plotly.grid_objs.Column object
Returns
-------
str
|
Sets the source reference on Chart Studio Cloud for bgcolor .
The 'bgcolorsrc' property must be specified as a string or
as a plotly.grid_objs.Column object | def bgcolorsrc(self):
"""
Sets the source reference on Chart Studio Cloud for bgcolor .
The 'bgcolorsrc' property must be specified as a string or
as a plotly.grid_objs.Column object
Returns
-------
str
"""
return self["bgcolorsrc"] | [
"def",
"bgcolorsrc",
"(",
"self",
")",
":",
"return",
"self",
"[",
"\"bgcolorsrc\"",
"]"
] | [
129,
4
] | [
140,
33
] | python | en | ['en', 'error', 'th'] | False |
Hoverlabel.bordercolor | (self) |
Sets the border color of the hover labels for this trace.
The 'bordercolor' 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 st... |
Sets the border color of the hover labels for this trace.
The 'bordercolor' 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 st... | def bordercolor(self):
"""
Sets the border color of the hover labels for this trace.
The 'bordercolor' 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%... | [
"def",
"bordercolor",
"(",
"self",
")",
":",
"return",
"self",
"[",
"\"bordercolor\"",
"]"
] | [
149,
4
] | [
200,
34
] | python | en | ['en', 'error', 'th'] | False |
Hoverlabel.bordercolorsrc | (self) |
Sets the source reference on Chart Studio Cloud for
bordercolor .
The 'bordercolorsrc' property must be specified as a string or
as a plotly.grid_objs.Column object
Returns
-------
str
|
Sets the source reference on Chart Studio Cloud for
bordercolor .
The 'bordercolorsrc' property must be specified as a string or
as a plotly.grid_objs.Column object | def bordercolorsrc(self):
"""
Sets the source reference on Chart Studio Cloud for
bordercolor .
The 'bordercolorsrc' property must be specified as a string or
as a plotly.grid_objs.Column object
Returns
-------
str
"""
return self["bo... | [
"def",
"bordercolorsrc",
"(",
"self",
")",
":",
"return",
"self",
"[",
"\"bordercolorsrc\"",
"]"
] | [
209,
4
] | [
221,
37
] | python | en | ['en', 'error', 'th'] | False |
Hoverlabel.font | (self) |
Sets the font used in hover labels.
The 'font' property is an instance of Font
that may be specified as:
- An instance of :class:`plotly.graph_objs.scatterternary.hoverlabel.Font`
- A dict of string/value properties that will be passed
to the Font constructo... |
Sets the font used in hover labels.
The 'font' property is an instance of Font
that may be specified as:
- An instance of :class:`plotly.graph_objs.scatterternary.hoverlabel.Font`
- A dict of string/value properties that will be passed
to the Font constructo... | def font(self):
"""
Sets the font used in hover labels.
The 'font' property is an instance of Font
that may be specified as:
- An instance of :class:`plotly.graph_objs.scatterternary.hoverlabel.Font`
- A dict of string/value properties that will be passed
... | [
"def",
"font",
"(",
"self",
")",
":",
"return",
"self",
"[",
"\"font\"",
"]"
] | [
230,
4
] | [
277,
27
] | python | en | ['en', 'error', 'th'] | False |
Hoverlabel.namelength | (self) |
Sets the default length (in number of characters) of the trace
name in the hover labels for all traces. -1 shows the whole
name regardless of length. 0-3 shows the first 0-3 characters,
and an integer >3 will show the whole name if it is less than
that many characters, but if it... |
Sets the default length (in number of characters) of the trace
name in the hover labels for all traces. -1 shows the whole
name regardless of length. 0-3 shows the first 0-3 characters,
and an integer >3 will show the whole name if it is less than
that many characters, but if it... | def namelength(self):
"""
Sets the default length (in number of characters) of the trace
name in the hover labels for all traces. -1 shows the whole
name regardless of length. 0-3 shows the first 0-3 characters,
and an integer >3 will show the whole name if it is less than
... | [
"def",
"namelength",
"(",
"self",
")",
":",
"return",
"self",
"[",
"\"namelength\"",
"]"
] | [
286,
4
] | [
304,
33
] | python | en | ['en', 'error', 'th'] | False |
Hoverlabel.namelengthsrc | (self) |
Sets the source reference on Chart Studio Cloud for namelength
.
The 'namelengthsrc' property must be specified as a string or
as a plotly.grid_objs.Column object
Returns
-------
str
|
Sets the source reference on Chart Studio Cloud for namelength
.
The 'namelengthsrc' property must be specified as a string or
as a plotly.grid_objs.Column object | def namelengthsrc(self):
"""
Sets the source reference on Chart Studio Cloud for namelength
.
The 'namelengthsrc' property must be specified as a string or
as a plotly.grid_objs.Column object
Returns
-------
str
"""
return self["name... | [
"def",
"namelengthsrc",
"(",
"self",
")",
":",
"return",
"self",
"[",
"\"namelengthsrc\"",
"]"
] | [
313,
4
] | [
325,
36
] | python | en | ['en', 'error', 'th'] | False |
Hoverlabel.__init__ | (
self,
arg=None,
align=None,
alignsrc=None,
bgcolor=None,
bgcolorsrc=None,
bordercolor=None,
bordercolorsrc=None,
font=None,
namelength=None,
namelengthsrc=None,
**kwargs
) |
Construct a new Hoverlabel object
Parameters
----------
arg
dict of properties compatible with this constructor or
an instance of
:class:`plotly.graph_objs.scatterternary.Hoverlabel`
align
Sets the horizontal alignment of ... |
Construct a new Hoverlabel object
Parameters
----------
arg
dict of properties compatible with this constructor or
an instance of
:class:`plotly.graph_objs.scatterternary.Hoverlabel`
align
Sets the horizontal alignment of ... | def __init__(
self,
arg=None,
align=None,
alignsrc=None,
bgcolor=None,
bgcolorsrc=None,
bordercolor=None,
bordercolorsrc=None,
font=None,
namelength=None,
namelengthsrc=None,
**kwargs
):
"""
Construct a n... | [
"def",
"__init__",
"(",
"self",
",",
"arg",
"=",
"None",
",",
"align",
"=",
"None",
",",
"alignsrc",
"=",
"None",
",",
"bgcolor",
"=",
"None",
",",
"bgcolorsrc",
"=",
"None",
",",
"bordercolor",
"=",
"None",
",",
"bordercolorsrc",
"=",
"None",
",",
"... | [
370,
4
] | [
502,
34
] | python | en | ['en', 'error', 'th'] | False |
Font.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 |
Font.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 |
Font.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 |
Font.__init__ | (self, arg=None, color=None, family=None, size=None, **kwargs) |
Construct a new Font object
The default font used for axis & tick labels on this carpet
Parameters
----------
arg
dict of properties compatible with this constructor or
an instance of :class:`plotly.graph_objs.carpet.Font`
color
... |
Construct a new Font object
The default font used for axis & tick labels on this carpet | def __init__(self, arg=None, color=None, family=None, size=None, **kwargs):
"""
Construct a new Font object
The default font used for axis & tick labels on this carpet
Parameters
----------
arg
dict of properties compatible with this constructor or
... | [
"def",
"__init__",
"(",
"self",
",",
"arg",
"=",
"None",
",",
"color",
"=",
"None",
",",
"family",
"=",
"None",
",",
"size",
"=",
"None",
",",
"*",
"*",
"kwargs",
")",
":",
"super",
"(",
"Font",
",",
"self",
")",
".",
"__init__",
"(",
"\"font\"",... | [
143,
4
] | [
225,
34
] | python | en | ['en', 'error', 'th'] | False |
_swatches | (module_names, module_contents, template=None) |
Parameters
----------
template : str or dict or plotly.graph_objects.layout.Template instance
The figure template name or definition.
Returns
-------
fig : graph_objects.Figure containing the displayed image
A `Figure` object. This figure demonstrates the color scales and
... |
Parameters
----------
template : str or dict or plotly.graph_objects.layout.Template instance
The figure template name or definition. | def _swatches(module_names, module_contents, template=None):
"""
Parameters
----------
template : str or dict or plotly.graph_objects.layout.Template instance
The figure template name or definition.
Returns
-------
fig : graph_objects.Figure containing the displayed image
A ... | [
"def",
"_swatches",
"(",
"module_names",
",",
"module_contents",
",",
"template",
"=",
"None",
")",
":",
"import",
"plotly",
".",
"graph_objs",
"as",
"go",
"from",
"plotly",
".",
"express",
".",
"_core",
"import",
"apply_default_cascade",
"args",
"=",
"dict",
... | [
0,
0
] | [
48,
5
] | python | en | ['en', 'error', 'th'] | False |
Font.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 |
Font.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 |
Font.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 |
Font.__init__ | (self, arg=None, color=None, family=None, size=None, **kwargs) |
Construct a new Font object
Sets this color bar's title font. Note that the title's font
used to be set by the now deprecated `titlefont` attribute.
Parameters
----------
arg
dict of properties compatible with this constructor or
an inst... |
Construct a new Font object
Sets this color bar's title font. Note that the title's font
used to be set by the now deprecated `titlefont` attribute. | def __init__(self, arg=None, color=None, family=None, size=None, **kwargs):
"""
Construct a new Font object
Sets this color bar's title font. Note that the title's font
used to be set by the now deprecated `titlefont` attribute.
Parameters
----------
arg... | [
"def",
"__init__",
"(",
"self",
",",
"arg",
"=",
"None",
",",
"color",
"=",
"None",
",",
"family",
"=",
"None",
",",
"size",
"=",
"None",
",",
"*",
"*",
"kwargs",
")",
":",
"super",
"(",
"Font",
",",
"self",
")",
".",
"__init__",
"(",
"\"font\"",... | [
143,
4
] | [
227,
34
] | python | en | ['en', 'error', 'th'] | False |
BaseVerifier.__repr__ | (self) |
Return a human readable representation of this class.
Returns:
A human readable string for this class
|
Return a human readable representation of this class. | def __repr__(self) -> str:
"""
Return a human readable representation of this class.
Returns:
A human readable string for this class
"""
return "<{}>".format(self.__class__.__name__) | [
"def",
"__repr__",
"(",
"self",
")",
"->",
"str",
":",
"return",
"\"<{}>\"",
".",
"format",
"(",
"self",
".",
"__class__",
".",
"__name__",
")"
] | [
8,
4
] | [
16,
53
] | python | en | ['en', 'error', 'th'] | False |
main | (args=None) | Console script for {{cookiecutter.project_slug}}. | Console script for {{cookiecutter.project_slug}}. | def main(args=None):
"""Console script for {{cookiecutter.project_slug}}."""
click.echo("Replace this message by putting your code into "
"{{cookiecutter.project_slug}}.cli.main")
click.echo("See click documentation at https://click.palletsprojects.com/")
return 0 | [
"def",
"main",
"(",
"args",
"=",
"None",
")",
":",
"click",
".",
"echo",
"(",
"\"Replace this message by putting your code into \"",
"\"{{cookiecutter.project_slug}}.cli.main\"",
")",
"click",
".",
"echo",
"(",
"\"See click documentation at https://click.palletsprojects.com/\""... | [
12,
0
] | [
17,
12
] | python | en | ['en', 'it', 'en'] | True |
main | () | Console script for {{cookiecutter.project_slug}}. | Console script for {{cookiecutter.project_slug}}. | def main():
"""Console script for {{cookiecutter.project_slug}}."""
parser = argparse.ArgumentParser()
parser.add_argument('_', nargs='*')
args = parser.parse_args()
print("Arguments: " + str(args._))
print("Replace this message by putting your code into "
"{{cookiecutter.project_slug... | [
"def",
"main",
"(",
")",
":",
"parser",
"=",
"argparse",
".",
"ArgumentParser",
"(",
")",
"parser",
".",
"add_argument",
"(",
"'_'",
",",
"nargs",
"=",
"'*'",
")",
"args",
"=",
"parser",
".",
"parse_args",
"(",
")",
"print",
"(",
"\"Arguments: \"",
"+"... | [
20,
0
] | [
29,
12
] | python | en | ['en', 'it', 'en'] | True |
pytest_sessionfinish | (session, exitstatus) |
Ensure that pytest doesn't report failure when no tests are collected.
This can sometimes happen due to the way we distribute tests across multiple circle
nodes.
|
Ensure that pytest doesn't report failure when no tests are collected. | def pytest_sessionfinish(session, exitstatus):
"""
Ensure that pytest doesn't report failure when no tests are collected.
This can sometimes happen due to the way we distribute tests across multiple circle
nodes.
"""
if exitstatus == pytest.ExitCode.NO_TESTS_COLLECTED:
session.exitstatu... | [
"def",
"pytest_sessionfinish",
"(",
"session",
",",
"exitstatus",
")",
":",
"if",
"exitstatus",
"==",
"pytest",
".",
"ExitCode",
".",
"NO_TESTS_COLLECTED",
":",
"session",
".",
"exitstatus",
"=",
"pytest",
".",
"ExitCode",
".",
"OK"
] | [
115,
0
] | [
123,
47
] | python | en | ['en', 'error', 'th'] | False |
test_revert_auth_rule_changing | (looper,
txnPoolNodeSet,
sdk_wallet_trustee,
sdk_wallet_steward,
sdk_pool_handle) | We try to change rule for adding new steward. For this case we | We try to change rule for adding new steward. For this case we | def test_revert_auth_rule_changing(looper,
txnPoolNodeSet,
sdk_wallet_trustee,
sdk_wallet_steward,
sdk_pool_handle):
node_stashers = [n.nodeIbStasher for n in txnPoolNodeSet]
... | [
"def",
"test_revert_auth_rule_changing",
"(",
"looper",
",",
"txnPoolNodeSet",
",",
"sdk_wallet_trustee",
",",
"sdk_wallet_steward",
",",
"sdk_pool_handle",
")",
":",
"node_stashers",
"=",
"[",
"n",
".",
"nodeIbStasher",
"for",
"n",
"in",
"txnPoolNodeSet",
"]",
"wh"... | [
19,
0
] | [
85,
74
] | python | en | ['en', 'en', 'en'] | True |
Font.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 |
Font.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 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.