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
ErrorX.traceref
(self)
The 'traceref' property is a integer and may be specified as: - An int (or float that will be cast to an int) in the interval [0, 9223372036854775807] Returns ------- int
The 'traceref' property is a integer and may be specified as: - An int (or float that will be cast to an int) in the interval [0, 9223372036854775807]
def traceref(self): """ The 'traceref' property is a integer and may be specified as: - An int (or float that will be cast to an int) in the interval [0, 9223372036854775807] Returns ------- int """ return self["traceref"]
[ "def", "traceref", "(", "self", ")", ":", "return", "self", "[", "\"traceref\"", "]" ]
[ 234, 4 ]
[ 244, 31 ]
python
en
['en', 'error', 'th']
False
ErrorX.tracerefminus
(self)
The 'tracerefminus' property is a integer and may be specified as: - An int (or float that will be cast to an int) in the interval [0, 9223372036854775807] Returns ------- int
The 'tracerefminus' property is a integer and may be specified as: - An int (or float that will be cast to an int) in the interval [0, 9223372036854775807]
def tracerefminus(self): """ The 'tracerefminus' property is a integer and may be specified as: - An int (or float that will be cast to an int) in the interval [0, 9223372036854775807] Returns ------- int """ return self["tracerefminus"]
[ "def", "tracerefminus", "(", "self", ")", ":", "return", "self", "[", "\"tracerefminus\"", "]" ]
[ 253, 4 ]
[ 263, 36 ]
python
en
['en', 'error', 'th']
False
ErrorX.type
(self)
Determines the rule used to generate the error bars. If *constant`, the bar lengths are of a constant value. Set this constant in `value`. If "percent", the bar lengths correspond to a percentage of underlying data. Set this percentage in `value`. If "sqrt", the bar lengths corr...
Determines the rule used to generate the error bars. If *constant`, the bar lengths are of a constant value. Set this constant in `value`. If "percent", the bar lengths correspond to a percentage of underlying data. Set this percentage in `value`. If "sqrt", the bar lengths corr...
def type(self): """ Determines the rule used to generate the error bars. If *constant`, the bar lengths are of a constant value. Set this constant in `value`. If "percent", the bar lengths correspond to a percentage of underlying data. Set this percentage in `value`. If "...
[ "def", "type", "(", "self", ")", ":", "return", "self", "[", "\"type\"", "]" ]
[ 272, 4 ]
[ 290, 27 ]
python
en
['en', 'error', 'th']
False
ErrorX.value
(self)
Sets the value of either the percentage (if `type` is set to "percent") or the constant (if `type` is set to "constant") corresponding to the lengths of the error bars. The 'value' property is a number and may be specified as: - An int or float in the interval [0, inf] ...
Sets the value of either the percentage (if `type` is set to "percent") or the constant (if `type` is set to "constant") corresponding to the lengths of the error bars. The 'value' property is a number and may be specified as: - An int or float in the interval [0, inf]
def value(self): """ Sets the value of either the percentage (if `type` is set to "percent") or the constant (if `type` is set to "constant") corresponding to the lengths of the error bars. The 'value' property is a number and may be specified as: - An int or float...
[ "def", "value", "(", "self", ")", ":", "return", "self", "[", "\"value\"", "]" ]
[ 299, 4 ]
[ 312, 28 ]
python
en
['en', 'error', 'th']
False
ErrorX.valueminus
(self)
Sets the value of either the percentage (if `type` is set to "percent") or the constant (if `type` is set to "constant") corresponding to the lengths of the error bars in the bottom (left) direction for vertical (horizontal) bars The 'valueminus' property is a number and ma...
Sets the value of either the percentage (if `type` is set to "percent") or the constant (if `type` is set to "constant") corresponding to the lengths of the error bars in the bottom (left) direction for vertical (horizontal) bars The 'valueminus' property is a number and ma...
def valueminus(self): """ Sets the value of either the percentage (if `type` is set to "percent") or the constant (if `type` is set to "constant") corresponding to the lengths of the error bars in the bottom (left) direction for vertical (horizontal) bars The 'valuem...
[ "def", "valueminus", "(", "self", ")", ":", "return", "self", "[", "\"valueminus\"", "]" ]
[ 321, 4 ]
[ 335, 33 ]
python
en
['en', 'error', 'th']
False
ErrorX.visible
(self)
Determines whether or not this set of error bars is visible. The 'visible' property must be specified as a bool (either True, or False) Returns ------- bool
Determines whether or not this set of error bars is visible. The 'visible' property must be specified as a bool (either True, or False)
def visible(self): """ Determines whether or not this set of error bars is visible. The 'visible' property must be specified as a bool (either True, or False) Returns ------- bool """ return self["visible"]
[ "def", "visible", "(", "self", ")", ":", "return", "self", "[", "\"visible\"", "]" ]
[ 344, 4 ]
[ 355, 30 ]
python
en
['en', 'error', 'th']
False
ErrorX.width
(self)
Sets the width (in px) of the cross-bar at both ends of the error bars. The 'width' property is a number and may be specified as: - An int or float in the interval [0, inf] Returns ------- int|float
Sets the width (in px) of the cross-bar at both ends of the error bars. The 'width' property is a number and may be specified as: - An int or float in the interval [0, inf]
def width(self): """ Sets the width (in px) of the cross-bar at both ends of the error bars. The 'width' property is a number and may be specified as: - An int or float in the interval [0, inf] Returns ------- int|float """ return s...
[ "def", "width", "(", "self", ")", ":", "return", "self", "[", "\"width\"", "]" ]
[ 364, 4 ]
[ 376, 28 ]
python
en
['en', 'error', 'th']
False
ErrorX.__init__
( self, arg=None, array=None, arrayminus=None, arrayminussrc=None, arraysrc=None, color=None, copy_zstyle=None, symmetric=None, thickness=None, traceref=None, tracerefminus=None, type=None, value=None, ...
Construct a new ErrorX object Parameters ---------- arg dict of properties compatible with this constructor or an instance of :class:`plotly.graph_objs.scatter3d.ErrorX` array Sets the data corresponding the length of each...
Construct a new ErrorX object Parameters ---------- arg dict of properties compatible with this constructor or an instance of :class:`plotly.graph_objs.scatter3d.ErrorX` array Sets the data corresponding the length of each...
def __init__( self, arg=None, array=None, arrayminus=None, arrayminussrc=None, arraysrc=None, color=None, copy_zstyle=None, symmetric=None, thickness=None, traceref=None, tracerefminus=None, type=None, value=...
[ "def", "__init__", "(", "self", ",", "arg", "=", "None", ",", "array", "=", "None", ",", "arrayminus", "=", "None", ",", "arrayminussrc", "=", "None", ",", "arraysrc", "=", "None", ",", "color", "=", "None", ",", "copy_zstyle", "=", "None", ",", "sym...
[ 444, 4 ]
[ 629, 34 ]
python
en
['en', 'error', 'th']
False
iou_loss
(pred, target, eps=1e-6)
IoU loss. Computing the IoU loss between a set of predicted bboxes and target bboxes. The loss is calculated as negative log of IoU. Args: pred (torch.Tensor): Predicted bboxes of format (x1, y1, x2, y2), shape (n, 4). target (torch.Tensor): Corresponding gt bboxes, shape (n, 4...
IoU loss.
def iou_loss(pred, target, eps=1e-6): """IoU loss. Computing the IoU loss between a set of predicted bboxes and target bboxes. The loss is calculated as negative log of IoU. Args: pred (torch.Tensor): Predicted bboxes of format (x1, y1, x2, y2), shape (n, 4). target (torch....
[ "def", "iou_loss", "(", "pred", ",", "target", ",", "eps", "=", "1e-6", ")", ":", "ious", "=", "bbox_overlaps", "(", "pred", ",", "target", ",", "is_aligned", "=", "True", ")", ".", "clamp", "(", "min", "=", "eps", ")", "loss", "=", "-", "ious", ...
[ 9, 0 ]
[ 26, 15 ]
python
es
['es', 'hmn', 'it']
False
bounded_iou_loss
(pred, target, beta=0.2, eps=1e-3)
`Improving Object Localization with Fitness NMS and Bounded IoU Loss. <https://arxiv.org/abs/1711.00164>`_. Args: pred (torch.Tensor): Predicted bboxes. target (torch.Tensor): Target bboxes. beta (float): beta parameter in smoothl1. eps (float): eps to avoid NaN.
`Improving Object Localization with Fitness NMS and Bounded IoU Loss.
def bounded_iou_loss(pred, target, beta=0.2, eps=1e-3): """`Improving Object Localization with Fitness NMS and Bounded IoU Loss. <https://arxiv.org/abs/1711.00164>`_. Args: pred (torch.Tensor): Predicted bboxes. target (torch.Tensor): Target bboxes. beta (float): beta parameter in ...
[ "def", "bounded_iou_loss", "(", "pred", ",", "target", ",", "beta", "=", "0.2", ",", "eps", "=", "1e-3", ")", ":", "pred_ctrx", "=", "(", "pred", "[", ":", ",", "0", "]", "+", "pred", "[", ":", ",", "2", "]", ")", "*", "0.5", "pred_ctry", "=", ...
[ 30, 0 ]
[ 69, 15 ]
python
en
['en', 'en', 'en']
True
giou_loss
(pred, target, eps=1e-7)
r"""`Generalized Intersection over Union: A Metric and A Loss for Bounding Box Regression <https://arxiv.org/abs/1902.09630>`_. Args: pred (torch.Tensor): Predicted bboxes of format (x1, y1, x2, y2), shape (n, 4). target (torch.Tensor): Corresponding gt bboxes, shape (n, 4). ...
r"""`Generalized Intersection over Union: A Metric and A Loss for Bounding Box Regression <https://arxiv.org/abs/1902.09630>`_.
def giou_loss(pred, target, eps=1e-7): r"""`Generalized Intersection over Union: A Metric and A Loss for Bounding Box Regression <https://arxiv.org/abs/1902.09630>`_. Args: pred (torch.Tensor): Predicted bboxes of format (x1, y1, x2, y2), shape (n, 4). target (torch.Tensor): Cor...
[ "def", "giou_loss", "(", "pred", ",", "target", ",", "eps", "=", "1e-7", ")", ":", "# overlap", "lt", "=", "torch", ".", "max", "(", "pred", "[", ":", ",", ":", "2", "]", ",", "target", "[", ":", ",", ":", "2", "]", ")", "rb", "=", "torch", ...
[ 73, 0 ]
[ 109, 15 ]
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", ")" ]
[ 75, 0 ]
[ 99, 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", ")", ":", "# Start with a roll from 1 to 100.", "attack_value", "=", "randint", "(", "1", ",", "100", ")", "accuracy_bonus", "=", "0", "# If armed, add weapon's accuracy bonus.", "if", "attacker", ".", "db", "."...
[ 102, 0 ]
[ 132, 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", ")", ":", "# Start with a defense value of 50 for a 50/50 chance to hit.", "defense_value", "=", "50", "# Modify this value based on defender's armor.", "if", "defender", ".", "db", ".", "worn_armor", ":", "armor", "="...
[ 135, 0 ]
[ 159, 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", ")", ":", "damage_value", "=", "0", "# Generate a damage value from wielded weapon if armed", "if", "attacker", ".", "db", ".", "wielded_weapon", ":", "weapon", "=", "attacker", ".", "db", ".", "wielded_weapon",...
[ 162, 0 ]
[ 196, 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", ":...
[ 199, 0 ]
[ 211, 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", ")" ]
[ 213, 0 ]
[ 226, 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 the attacker's weapon type to reference in combat messages.", "attackers_weapon", "=", "\"attack\"", "if", "attacker", ".", "...
[ 228, 0 ]
[ 265, 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_'...", "...
[ 268, 0 ]
[ 281, 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", ")" ]
[ 284, 0 ]
[ 294, 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...
[ 297, 0 ]
[ 309, 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", "action_name", ":", "character", ".", "db", ".", "combat_lastaction", "=", "action_name", "if", "actions", "==", "'all'", ":", "# If spending all actions", ...
[ 312, 0 ]
[ 332, 61 ]
python
en
['en', 'error', 'th']
False
TBEquipTurnHandler.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", "=", "[", "]", ...
[ 353, 4 ]
[ 387, 36 ]
python
en
['en', 'error', 'th']
False
TBEquipTurnHandler.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", "=",...
[ 389, 4 ]
[ 395, 45 ]
python
en
['en', 'error', 'th']
False
TBEquipTurnHandler.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", ...
[ 397, 4 ]
[ 412, 48 ]
python
en
['en', 'error', 'th']
False
TBEquipTurnHandler.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...
[ 414, 4 ]
[ 424, 47 ]
python
en
['en', 'error', 'th']
False
TBEquipTurnHandler.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 ...
[ 426, 4 ]
[ 443, 88 ]
python
en
['en', 'error', 'th']
False
TBEquipTurnHandler.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...
[ 445, 4 ]
[ 482, 32 ]
python
en
['en', 'error', 'th']
False
TBEquipTurnHandler.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" ]
[ 484, 4 ]
[ 493, 18 ]
python
en
['en', 'error', 'th']
False
TBEquipTurnHandler.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...
[ 495, 4 ]
[ 507, 45 ]
python
en
['en', 'error', 'th']
False
TBEWeapon.at_object_creation
(self)
Called once, when this object is first created. This is the normal hook to overload for most object types.
Called once, when this object is first created. This is the normal hook to overload for most object types.
def at_object_creation(self): """ Called once, when this object is first created. This is the normal hook to overload for most object types. """ self.db.damage_range = (15, 25) # Minimum and maximum damage on hit self.db.accuracy_bonus = 0 # Bonus to attack rolls (or pena...
[ "def", "at_object_creation", "(", "self", ")", ":", "self", ".", "db", ".", "damage_range", "=", "(", "15", ",", "25", ")", "# Minimum and maximum damage on hit", "self", ".", "db", ".", "accuracy_bonus", "=", "0", "# Bonus to attack rolls (or penalty if negative)",...
[ 519, 4 ]
[ 526, 105 ]
python
en
['en', 'error', 'th']
False
TBEWeapon.at_drop
(self, dropper)
Stop being wielded if dropped.
Stop being wielded if dropped.
def at_drop(self, dropper): """ Stop being wielded if dropped. """ if dropper.db.wielded_weapon == self: dropper.db.wielded_weapon = None dropper.location.msg_contents("%s stops wielding %s." % (dropper, self))
[ "def", "at_drop", "(", "self", ",", "dropper", ")", ":", "if", "dropper", ".", "db", ".", "wielded_weapon", "==", "self", ":", "dropper", ".", "db", ".", "wielded_weapon", "=", "None", "dropper", ".", "location", ".", "msg_contents", "(", "\"%s stops wield...
[ 527, 4 ]
[ 533, 84 ]
python
en
['en', 'error', 'th']
False
TBEWeapon.at_give
(self, giver, getter)
Stop being wielded if given.
Stop being wielded if given.
def at_give(self, giver, getter): """ Stop being wielded if given. """ if giver.db.wielded_weapon == self: giver.db.wielded_weapon = None giver.location.msg_contents("%s stops wielding %s." % (giver, self))
[ "def", "at_give", "(", "self", ",", "giver", ",", "getter", ")", ":", "if", "giver", ".", "db", ".", "wielded_weapon", "==", "self", ":", "giver", ".", "db", ".", "wielded_weapon", "=", "None", "giver", ".", "location", ".", "msg_contents", "(", "\"%s ...
[ 534, 4 ]
[ 540, 80 ]
python
en
['en', 'error', 'th']
False
TBEArmor.at_object_creation
(self)
Called once, when this object is first created. This is the normal hook to overload for most object types.
Called once, when this object is first created. This is the normal hook to overload for most object types.
def at_object_creation(self): """ Called once, when this object is first created. This is the normal hook to overload for most object types. """ self.db.damage_reduction = 4 # Amount of incoming damage reduced by armor self.db.defense_modifier = -4 # Amount to modify defe...
[ "def", "at_object_creation", "(", "self", ")", ":", "self", ".", "db", ".", "damage_reduction", "=", "4", "# Amount of incoming damage reduced by armor", "self", ".", "db", ".", "defense_modifier", "=", "-", "4", "# Amount to modify defense value (pos = harder to hit, neg...
[ 546, 4 ]
[ 552, 106 ]
python
en
['en', 'error', 'th']
False
TBEArmor.at_before_drop
(self, dropper)
Can't drop in combat.
Can't drop in combat.
def at_before_drop(self, dropper): """ Can't drop in combat. """ if is_in_combat(dropper): dropper.msg("You can't doff armor in a fight!") return False return True
[ "def", "at_before_drop", "(", "self", ",", "dropper", ")", ":", "if", "is_in_combat", "(", "dropper", ")", ":", "dropper", ".", "msg", "(", "\"You can't doff armor in a fight!\"", ")", "return", "False", "return", "True" ]
[ 553, 4 ]
[ 560, 19 ]
python
en
['en', 'error', 'th']
False
TBEArmor.at_drop
(self, dropper)
Stop being wielded if dropped.
Stop being wielded if dropped.
def at_drop(self, dropper): """ Stop being wielded if dropped. """ if dropper.db.worn_armor == self: dropper.db.worn_armor = None dropper.location.msg_contents("%s removes %s." % (dropper, self))
[ "def", "at_drop", "(", "self", ",", "dropper", ")", ":", "if", "dropper", ".", "db", ".", "worn_armor", "==", "self", ":", "dropper", ".", "db", ".", "worn_armor", "=", "None", "dropper", ".", "location", ".", "msg_contents", "(", "\"%s removes %s.\"", "...
[ 561, 4 ]
[ 567, 77 ]
python
en
['en', 'error', 'th']
False
TBEArmor.at_before_give
(self, giver, getter)
Can't give away in combat.
Can't give away in combat.
def at_before_give(self, giver, getter): """ Can't give away in combat. """ if is_in_combat(giver): dropper.msg("You can't doff armor in a fight!") return False return True
[ "def", "at_before_give", "(", "self", ",", "giver", ",", "getter", ")", ":", "if", "is_in_combat", "(", "giver", ")", ":", "dropper", ".", "msg", "(", "\"You can't doff armor in a fight!\"", ")", "return", "False", "return", "True" ]
[ 568, 4 ]
[ 575, 19 ]
python
en
['en', 'error', 'th']
False
TBEArmor.at_give
(self, giver, getter)
Stop being wielded if given.
Stop being wielded if given.
def at_give(self, giver, getter): """ Stop being wielded if given. """ if giver.db.worn_armor == self: giver.db.worn_armor = None giver.location.msg_contents("%s removes %s." % (giver, self))
[ "def", "at_give", "(", "self", ",", "giver", ",", "getter", ")", ":", "if", "giver", ".", "db", ".", "worn_armor", "==", "self", ":", "giver", ".", "db", ".", "worn_armor", "=", "None", "giver", ".", "location", ".", "msg_contents", "(", "\"%s removes ...
[ 576, 4 ]
[ 582, 73 ]
python
en
['en', 'error', 'th']
False
TBEquipCharacter.at_object_creation
(self)
Called once, when this object is first created. This is the normal hook to overload for most object types.
Called once, when this object is first created. This is the normal hook to overload for most object types.
def at_object_creation(self): """ Called once, when this object is first created. This is the normal hook to overload for most object types. """ self.db.max_hp = 100 # Set maximum HP to 100 self.db.hp = self.db.max_hp # Set current HP to maximum self.db.wielded_...
[ "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", ".", "wielde...
[ 590, 4 ]
[ 608, 11 ]
python
en
['en', 'error', 'th']
False
TBEquipCharacter.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", "...
[ 610, 4 ]
[ 633, 19 ]
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", "(",...
[ 657, 4 ]
[ 682, 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...
[ 700, 4 ]
[ 732, 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...
[ 750, 4 ]
[ 763, 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...
[ 782, 4 ]
[ 799, 11 ]
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.location....
[ "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", ...
[ 816, 4 ]
[ 827, 11 ]
python
en
['en', 'en', 'en']
True
CmdWield.func
(self)
This performs the actual command.
This performs the actual command.
def func(self): """ This performs the actual command. """ # If in combat, check to see if it's your turn. if is_in_combat(self.caller): if not is_turn(self.caller): self.caller.msg("You can only do that on your turn.") return if...
[ "def", "func", "(", "self", ")", ":", "# If in combat, check to see if it's your turn.", "if", "is_in_combat", "(", "self", ".", "caller", ")", ":", "if", "not", "is_turn", "(", "self", ".", "caller", ")", ":", "self", ".", "caller", ".", "msg", "(", "\"Yo...
[ 872, 4 ]
[ 901, 61 ]
python
en
['en', 'error', 'th']
False
CmdUnwield.func
(self)
This performs the actual command.
This performs the actual command.
def func(self): """ This performs the actual command. """ # If in combat, check to see if it's your turn. if is_in_combat(self.caller): if not is_turn(self.caller): self.caller.msg("You can only do that on your turn.") return if...
[ "def", "func", "(", "self", ")", ":", "# If in combat, check to see if it's your turn.", "if", "is_in_combat", "(", "self", ".", "caller", ")", ":", "if", "not", "is_turn", "(", "self", ".", "caller", ")", ":", "self", ".", "caller", ".", "msg", "(", "\"Yo...
[ 917, 4 ]
[ 931, 90 ]
python
en
['en', 'error', 'th']
False
CmdDon.func
(self)
This performs the actual command.
This performs the actual command.
def func(self): """ This performs the actual command. """ # Can't do this in combat if is_in_combat(self.caller): self.caller.msg("You can't don armor in a fight!") return if not self.args: self.caller.msg("Usage: don <obj>") ...
[ "def", "func", "(", "self", ")", ":", "# Can't do this in combat", "if", "is_in_combat", "(", "self", ".", "caller", ")", ":", "self", ".", "caller", ".", "msg", "(", "\"You can't don armor in a fight!\"", ")", "return", "if", "not", "self", ".", "args", ":"...
[ 948, 4 ]
[ 973, 109 ]
python
en
['en', 'error', 'th']
False
CmdDoff.func
(self)
This performs the actual command.
This performs the actual command.
def func(self): """ This performs the actual command. """ # Can't do this in combat if is_in_combat(self.caller): self.caller.msg("You can't doff armor in a fight!") return if not self.caller.db.worn_armor: self.caller.msg("You aren't w...
[ "def", "func", "(", "self", ")", ":", "# Can't do this in combat", "if", "is_in_combat", "(", "self", ".", "caller", ")", ":", "self", ".", "caller", ".", "msg", "(", "\"You can't doff armor in a fight!\"", ")", "return", "if", "not", "self", ".", "caller", ...
[ 990, 4 ]
[ 1003, 90 ]
python
en
['en', 'error', 'th']
False
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(CmdWield()) self.add(CmdUnwiel...
[ "def", "at_cmdset_creation", "(", "self", ")", ":", "self", ".", "add", "(", "CmdFight", "(", ")", ")", "self", ".", "add", "(", "CmdAttack", "(", ")", ")", "self", ".", "add", "(", "CmdRest", "(", ")", ")", "self", ".", "add", "(", "CmdPass", "(...
[ 1013, 4 ]
[ 1026, 27 ]
python
en
['en', 'error', 'th']
False
dewpoint
(rh: float, t: float)
Calculate the dewpoint from relative_humidity Ref: https://www.omnicalculator.com/physics/dew-point#howto
Calculate the dewpoint from relative_humidity Ref: https://www.omnicalculator.com/physics/dew-point#howto
def dewpoint(rh: float, t: float) -> float: """ Calculate the dewpoint from relative_humidity Ref: https://www.omnicalculator.com/physics/dew-point#howto """ a, b = 17.62, 243.12 alpha = log(rh) + a * t / (b + t) return b * alpha / (a - alpha)
[ "def", "dewpoint", "(", "rh", ":", "float", ",", "t", ":", "float", ")", "->", "float", ":", "a", ",", "b", "=", "17.62", ",", "243.12", "alpha", "=", "log", "(", "rh", ")", "+", "a", "*", "t", "/", "(", "b", "+", "t", ")", "return", "b", ...
[ 30, 0 ]
[ 37, 34 ]
python
en
['en', 'error', 'th']
False
GeneratesRequest.ledgerRequest
(self)
Generates a Request object to be submitted to the ledger. :return: a Request to be submitted, or None if it shouldn't be written
Generates a Request object to be submitted to the ledger. :return: a Request to be submitted, or None if it shouldn't be written
def ledgerRequest(self): """ Generates a Request object to be submitted to the ledger. :return: a Request to be submitted, or None if it shouldn't be written """
[ "def", "ledgerRequest", "(", "self", ")", ":" ]
[ 9, 4 ]
[ 13, 11 ]
python
en
['en', 'error', 'th']
False
HredAgent.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. """ agent = parser.add_argument_group("HRED Arguments") agent.add_argument( "-hs", ...
[ "def", "add_cmdline_args", "(", "cls", ",", "parser", ":", "ParlaiParser", ",", "partial_opt", ":", "Optional", "[", "Opt", "]", "=", "None", ")", "->", "ParlaiParser", ":", "agent", "=", "parser", ".", "add_argument_group", "(", "\"HRED Arguments\"", ")", "...
[ 18, 4 ]
[ 68, 20 ]
python
en
['en', 'error', 'th']
False
HredAgent.__init__
(self, opt, shared=None)
Set up model.
Set up model.
def __init__(self, opt, shared=None): """ Set up model. """ if torch.cuda.is_available(): self.device = torch.device("cuda:0") else: self.device = torch.device("cpu") super().__init__(opt, shared) self.id = "Hred"
[ "def", "__init__", "(", "self", ",", "opt", ",", "shared", "=", "None", ")", ":", "if", "torch", ".", "cuda", ".", "is_available", "(", ")", ":", "self", ".", "device", "=", "torch", ".", "device", "(", "\"cuda:0\"", ")", "else", ":", "self", ".", ...
[ 70, 4 ]
[ 79, 24 ]
python
en
['en', 'error', 'th']
False
HredAgent.batchify
(self, obs_batch, sort=True)
Add action and attribute supervision for batches. Store history vec as context_vec.
Add action and attribute supervision for batches.
def batchify(self, obs_batch, sort=True): """ Add action and attribute supervision for batches. Store history vec as context_vec. """ batch = super().batchify(obs_batch, sort) batch["context_vec"], batch["hist_lens"] = self.parse_context_vec(batch) return batch
[ "def", "batchify", "(", "self", ",", "obs_batch", ",", "sort", "=", "True", ")", ":", "batch", "=", "super", "(", ")", ".", "batchify", "(", "obs_batch", ",", "sort", ")", "batch", "[", "\"context_vec\"", "]", ",", "batch", "[", "\"hist_lens\"", "]", ...
[ 124, 4 ]
[ 132, 20 ]
python
en
['en', 'error', 'th']
False
HredAgent._set_text_vec
(self, obs, history, truncate)
Set the 'text_vec' field in the observation. Overridden to include both local utterance (text_vec) and full history (context_vec)
Set the 'text_vec' field in the observation.
def _set_text_vec(self, obs, history, truncate): """ Set the 'text_vec' field in the observation. Overridden to include both local utterance (text_vec) and full history (context_vec) """ if "text" not in obs: return obs if "text_vec" not in obs: ...
[ "def", "_set_text_vec", "(", "self", ",", "obs", ",", "history", ",", "truncate", ")", ":", "if", "\"text\"", "not", "in", "obs", ":", "return", "obs", "if", "\"text_vec\"", "not", "in", "obs", ":", "# text vec is not precomputed, so we set it using the history", ...
[ 155, 4 ]
[ 183, 18 ]
python
en
['en', 'error', 'th']
False
HredAgent._dummy_batch
(self, batchsize, maxlen)
Overridden to add dummy context vec and hist lens.
Overridden to add dummy context vec and hist lens.
def _dummy_batch(self, batchsize, maxlen): """ Overridden to add dummy context vec and hist lens. """ batch = super()._dummy_batch(batchsize, maxlen) batch["context_vec"] = batch["text_vec"] batch["hist_lens"] = torch.ones(batchsize, dtype=torch.long) return batch
[ "def", "_dummy_batch", "(", "self", ",", "batchsize", ",", "maxlen", ")", ":", "batch", "=", "super", "(", ")", ".", "_dummy_batch", "(", "batchsize", ",", "maxlen", ")", "batch", "[", "\"context_vec\"", "]", "=", "batch", "[", "\"text_vec\"", "]", "batc...
[ 185, 4 ]
[ 192, 20 ]
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\"", "]" ]
[ 26, 4 ]
[ 41, 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\"", "]" ]
[ 50, 4 ]
[ 61, 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\"", "]" ]
[ 70, 4 ]
[ 121, 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\"", "]" ]
[ 130, 4 ]
[ 141, 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\"", "]" ]
[ 150, 4 ]
[ 201, 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\"", "]" ]
[ 210, 4 ]
[ 222, 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.candlestick.hoverlabel.Font` - A dict of string/value properties that will be passed to the Font constructor ...
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.candlestick.hoverlabel.Font` - A dict of string/value properties that will be passed to the Font constructor ...
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.candlestick.hoverlabel.Font` - A dict of string/value properties that will be passed ...
[ "def", "font", "(", "self", ")", ":", "return", "self", "[", "\"font\"", "]" ]
[ 231, 4 ]
[ 278, 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\"", "]" ]
[ 287, 4 ]
[ 305, 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\"", "]" ]
[ 314, 4 ]
[ 326, 36 ]
python
en
['en', 'error', 'th']
False
Hoverlabel.split
(self)
Show hover information (open, close, high, low) in separate labels. The 'split' property must be specified as a bool (either True, or False) Returns ------- bool
Show hover information (open, close, high, low) in separate labels. The 'split' property must be specified as a bool (either True, or False)
def split(self): """ Show hover information (open, close, high, low) in separate labels. The 'split' property must be specified as a bool (either True, or False) Returns ------- bool """ return self["split"]
[ "def", "split", "(", "self", ")", ":", "return", "self", "[", "\"split\"", "]" ]
[ 335, 4 ]
[ 347, 28 ]
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, split=None, **kwargs )
Construct a new Hoverlabel object Parameters ---------- arg dict of properties compatible with this constructor or an instance of :class:`plotly.graph_objs.candlestick.Hoverlabel` align Sets the horizontal alignment of the...
Construct a new Hoverlabel object Parameters ---------- arg dict of properties compatible with this constructor or an instance of :class:`plotly.graph_objs.candlestick.Hoverlabel` align Sets the horizontal alignment of the...
def __init__( self, arg=None, align=None, alignsrc=None, bgcolor=None, bgcolorsrc=None, bordercolor=None, bordercolorsrc=None, font=None, namelength=None, namelengthsrc=None, split=None, **kwargs ): """ ...
[ "def", "__init__", "(", "self", ",", "arg", "=", "None", ",", "align", "=", "None", ",", "alignsrc", "=", "None", ",", "bgcolor", "=", "None", ",", "bgcolorsrc", "=", "None", ",", "bordercolor", "=", "None", ",", "bordercolorsrc", "=", "None", ",", "...
[ 395, 4 ]
[ 535, 34 ]
python
en
['en', 'error', 'th']
False
DIDDoc.__init__
(self, did: str = None)
Initialize the DIDDoc instance. Retain DID ('id' in DIDDoc context); initialize verification keys and services to empty lists. Args: did: DID for current DIDdoc Raises: ValueError: for bad input DID.
Initialize the DIDDoc instance.
def __init__(self, did: str = None) -> None: """ Initialize the DIDDoc instance. Retain DID ('id' in DIDDoc context); initialize verification keys and services to empty lists. Args: did: DID for current DIDdoc Raises: ValueError: for bad input D...
[ "def", "__init__", "(", "self", ",", "did", ":", "str", "=", "None", ")", "->", "None", ":", "self", ".", "_did", "=", "canon_did", "(", "did", ")", "if", "did", "else", "None", "# allow specification post-hoc", "self", ".", "_pubkey", "=", "{", "}", ...
[ 43, 4 ]
[ 60, 26 ]
python
en
['en', 'error', 'th']
False
DIDDoc.did
(self)
Accessor for DID.
Accessor for DID.
def did(self) -> str: """Accessor for DID.""" return self._did
[ "def", "did", "(", "self", ")", "->", "str", ":", "return", "self", ".", "_did" ]
[ 63, 4 ]
[ 66, 24 ]
python
en
['da', 'en', 'en']
True
DIDDoc.did
(self, value: str)
Set DID ('id' in DIDDoc context). Args: value: DID Raises: ValueError: for bad input DID.
Set DID ('id' in DIDDoc context).
def did(self, value: str) -> None: """ Set DID ('id' in DIDDoc context). Args: value: DID Raises: ValueError: for bad input DID. """ self._did = canon_did(value) if value else None
[ "def", "did", "(", "self", ",", "value", ":", "str", ")", "->", "None", ":", "self", ".", "_did", "=", "canon_did", "(", "value", ")", "if", "value", "else", "None" ]
[ 69, 4 ]
[ 81, 55 ]
python
en
['en', 'error', 'th']
False
DIDDoc.pubkey
(self)
Accessor for public keys by identifier.
Accessor for public keys by identifier.
def pubkey(self) -> dict: """Accessor for public keys by identifier.""" return self._pubkey
[ "def", "pubkey", "(", "self", ")", "->", "dict", ":", "return", "self", ".", "_pubkey" ]
[ 84, 4 ]
[ 87, 27 ]
python
en
['en', 'fy', 'en']
True
DIDDoc.authnkey
(self)
Accessor for public keys marked as authentication keys, by identifier.
Accessor for public keys marked as authentication keys, by identifier.
def authnkey(self) -> dict: """Accessor for public keys marked as authentication keys, by identifier.""" return {k: self._pubkey[k] for k in self._pubkey if self._pubkey[k].authn}
[ "def", "authnkey", "(", "self", ")", "->", "dict", ":", "return", "{", "k", ":", "self", ".", "_pubkey", "[", "k", "]", "for", "k", "in", "self", ".", "_pubkey", "if", "self", ".", "_pubkey", "[", "k", "]", ".", "authn", "}" ]
[ 90, 4 ]
[ 93, 82 ]
python
en
['en', 'fy', 'en']
True
DIDDoc.service
(self)
Accessor for services by identifier.
Accessor for services by identifier.
def service(self) -> dict: """Accessor for services by identifier.""" return self._service
[ "def", "service", "(", "self", ")", "->", "dict", ":", "return", "self", ".", "_service" ]
[ 96, 4 ]
[ 99, 28 ]
python
en
['en', 'en', 'en']
True
DIDDoc.set
(self, item: Union[Service, PublicKey])
Add or replace service or public key; return current DIDDoc. Raises: ValueError: if input item is neither service nor public key. Args: item: service or public key to set Returns: the current DIDDoc
Add or replace service or public key; return current DIDDoc.
def set(self, item: Union[Service, PublicKey]) -> "DIDDoc": """ Add or replace service or public key; return current DIDDoc. Raises: ValueError: if input item is neither service nor public key. Args: item: service or public key to set Returns: the curre...
[ "def", "set", "(", "self", ",", "item", ":", "Union", "[", "Service", ",", "PublicKey", "]", ")", "->", "\"DIDDoc\"", ":", "if", "isinstance", "(", "item", ",", "Service", ")", ":", "self", ".", "service", "[", "item", ".", "id", "]", "=", "item", ...
[ 101, 4 ]
[ 122, 13 ]
python
en
['en', 'error', 'th']
False
DIDDoc.serialize
(self)
Dump current object to a JSON-compatible dictionary. Returns: dict representation of current DIDDoc
Dump current object to a JSON-compatible dictionary.
def serialize(self) -> str: """ Dump current object to a JSON-compatible dictionary. Returns: dict representation of current DIDDoc """ return { "@context": DIDDoc.CONTEXT, "id": canon_ref(self.did, self.did), "publicKey": [pubke...
[ "def", "serialize", "(", "self", ")", "->", "str", ":", "return", "{", "\"@context\"", ":", "DIDDoc", ".", "CONTEXT", ",", "\"id\"", ":", "canon_ref", "(", "self", ".", "did", ",", "self", ".", "did", ")", ",", "\"publicKey\"", ":", "[", "pubkey", "....
[ 124, 4 ]
[ 146, 9 ]
python
en
['en', 'error', 'th']
False
DIDDoc.to_json
(self)
Dump current object as json (JSON-LD). Returns: json representation of current DIDDoc
Dump current object as json (JSON-LD).
def to_json(self) -> str: """ Dump current object as json (JSON-LD). Returns: json representation of current DIDDoc """ return json.dumps(self.serialize())
[ "def", "to_json", "(", "self", ")", "->", "str", ":", "return", "json", ".", "dumps", "(", "self", ".", "serialize", "(", ")", ")" ]
[ 148, 4 ]
[ 157, 43 ]
python
en
['en', 'error', 'th']
False
DIDDoc.add_service_pubkeys
( self, service: dict, tags: Union[Sequence[str], str] )
Add public keys specified in service. Return public keys so discovered. Args: service: service from DID document tags: potential tags marking public keys of type of interest (the standard is still coalescing) Raises: ValueError: for public k...
Add public keys specified in service. Return public keys so discovered.
def add_service_pubkeys( self, service: dict, tags: Union[Sequence[str], str] ) -> List[PublicKey]: """ Add public keys specified in service. Return public keys so discovered. Args: service: service from DID document tags: potential tags marking public keys o...
[ "def", "add_service_pubkeys", "(", "self", ",", "service", ":", "dict", ",", "tags", ":", "Union", "[", "Sequence", "[", "str", "]", ",", "str", "]", ")", "->", "List", "[", "PublicKey", "]", ":", "rv", "=", "[", "]", "for", "tag", "in", "[", "ta...
[ 159, 4 ]
[ 214, 17 ]
python
en
['en', 'error', 'th']
False
DIDDoc.deserialize
(cls, did_doc: dict)
Construct DIDDoc object from dict representation. Args: did_doc: DIDDoc dict representation Raises: ValueError: for bad DID or missing mandatory item. Returns: DIDDoc from input json
Construct DIDDoc object from dict representation.
def deserialize(cls, did_doc: dict) -> "DIDDoc": """ Construct DIDDoc object from dict representation. Args: did_doc: DIDDoc dict representation Raises: ValueError: for bad DID or missing mandatory item. Returns: DIDDoc from input json """ ...
[ "def", "deserialize", "(", "cls", ",", "did_doc", ":", "dict", ")", "->", "\"DIDDoc\"", ":", "rv", "=", "None", "if", "\"id\"", "in", "did_doc", ":", "rv", "=", "DIDDoc", "(", "did_doc", "[", "\"id\"", "]", ")", "else", ":", "# heuristic: get DID to serv...
[ 217, 4 ]
[ 304, 17 ]
python
en
['en', 'error', 'th']
False
DIDDoc.from_json
(cls, did_doc_json: str)
Construct DIDDoc object from json representation. Args: did_doc_json: DIDDoc json representation Returns: DIDDoc from input json
Construct DIDDoc object from json representation.
def from_json(cls, did_doc_json: str) -> "DIDDoc": """ Construct DIDDoc object from json representation. Args: did_doc_json: DIDDoc json representation Returns: DIDDoc from input json """ return cls.deserialize(json.loads(did_doc_json))
[ "def", "from_json", "(", "cls", ",", "did_doc_json", ":", "str", ")", "->", "\"DIDDoc\"", ":", "return", "cls", ".", "deserialize", "(", "json", ".", "loads", "(", "did_doc_json", ")", ")" ]
[ 307, 4 ]
[ 318, 56 ]
python
en
['en', 'error', 'th']
False
DIDDoc.__str__
(self)
Return string representation for abbreviated display.
Return string representation for abbreviated display.
def __str__(self) -> str: """Return string representation for abbreviated display.""" return f"DIDDoc({self.did})"
[ "def", "__str__", "(", "self", ")", "->", "str", ":", "return", "f\"DIDDoc({self.did})\"" ]
[ 320, 4 ]
[ 323, 36 ]
python
en
['en', 'en', 'en']
True
DIDDoc.__repr__
(self)
Format DIDDoc for logging.
Format DIDDoc for logging.
def __repr__(self) -> str: """Format DIDDoc for logging.""" return f"<DIDDoc did={self.did}>"
[ "def", "__repr__", "(", "self", ")", "->", "str", ":", "return", "f\"<DIDDoc did={self.did}>\"" ]
[ 325, 4 ]
[ 328, 41 ]
python
en
['en', 'da', 'en']
True
color_parser
(colors, function)
Takes color(s) and a function and applies the function on the color(s) In particular, this function identifies whether the given color object is an iterable or not and applies the given color-parsing function to the color or iterable of colors. If given an iterable, it will only be able to work wi...
Takes color(s) and a function and applies the function on the color(s)
def color_parser(colors, function): """ Takes color(s) and a function and applies the function on the color(s) In particular, this function identifies whether the given color object is an iterable or not and applies the given color-parsing function to the color or iterable of colors. If given an it...
[ "def", "color_parser", "(", "colors", ",", "function", ")", ":", "if", "isinstance", "(", "colors", ",", "str", ")", ":", "return", "function", "(", "colors", ")", "if", "isinstance", "(", "colors", ",", "tuple", ")", "and", "isinstance", "(", "colors", ...
[ 284, 0 ]
[ 307, 33 ]
python
en
['en', 'error', 'th']
False
validate_colors
(colors, colortype="tuple")
Validates color(s) and returns a list of color(s) of a specified type
Validates color(s) and returns a list of color(s) of a specified type
def validate_colors(colors, colortype="tuple"): """ Validates color(s) and returns a list of color(s) of a specified type """ from numbers import Number if colors is None: colors = DEFAULT_PLOTLY_COLORS if isinstance(colors, str): if colors in PLOTLY_SCALES: colors_...
[ "def", "validate_colors", "(", "colors", ",", "colortype", "=", "\"tuple\"", ")", ":", "from", "numbers", "import", "Number", "if", "colors", "is", "None", ":", "colors", "=", "DEFAULT_PLOTLY_COLORS", "if", "isinstance", "(", "colors", ",", "str", ")", ":", ...
[ 310, 0 ]
[ 374, 17 ]
python
en
['en', 'error', 'th']
False
validate_colors_dict
(colors, colortype="tuple")
Validates dictioanry of color(s)
Validates dictioanry of color(s)
def validate_colors_dict(colors, colortype="tuple"): """ Validates dictioanry of color(s) """ # validate each color element in the dictionary for key in colors: if "rgb" in colors[key]: colors[key] = color_parser(colors[key], unlabel_rgb) for value in colors[key]: ...
[ "def", "validate_colors_dict", "(", "colors", ",", "colortype", "=", "\"tuple\"", ")", ":", "# validate each color element in the dictionary", "for", "key", "in", "colors", ":", "if", "\"rgb\"", "in", "colors", "[", "key", "]", ":", "colors", "[", "key", "]", ...
[ 377, 0 ]
[ 410, 17 ]
python
en
['en', 'error', 'th']
False
convert_colors_to_same_type
( colors, colortype="rgb", scale=None, return_default_colors=False, num_of_defualt_colors=2, )
Converts color(s) to the specified color type Takes a single color or an iterable of colors, as well as a list of scale values, and outputs a 2-pair of the list of color(s) converted all to an rgb or tuple color type, aswell as the scale as the second element. If colors is a Plotly Scale name, the...
Converts color(s) to the specified color type
def convert_colors_to_same_type( colors, colortype="rgb", scale=None, return_default_colors=False, num_of_defualt_colors=2, ): """ Converts color(s) to the specified color type Takes a single color or an iterable of colors, as well as a list of scale values, and outputs a 2-pair of ...
[ "def", "convert_colors_to_same_type", "(", "colors", ",", "colortype", "=", "\"rgb\"", ",", "scale", "=", "None", ",", "return_default_colors", "=", "False", ",", "num_of_defualt_colors", "=", "2", ",", ")", ":", "colors_list", "=", "[", "]", "if", "colors", ...
[ 413, 0 ]
[ 494, 9 ]
python
en
['en', 'error', 'th']
False
convert_dict_colors_to_same_type
(colors_dict, colortype="rgb")
Converts a colors in a dictioanry of colors to the specified color type :param (dict) colors_dict: a dictioanry whose values are single colors
Converts a colors in a dictioanry of colors to the specified color type
def convert_dict_colors_to_same_type(colors_dict, colortype="rgb"): """ Converts a colors in a dictioanry of colors to the specified color type :param (dict) colors_dict: a dictioanry whose values are single colors """ for key in colors_dict: if "#" in colors_dict[key]: colors_d...
[ "def", "convert_dict_colors_to_same_type", "(", "colors_dict", ",", "colortype", "=", "\"rgb\"", ")", ":", "for", "key", "in", "colors_dict", ":", "if", "\"#\"", "in", "colors_dict", "[", "key", "]", ":", "colors_dict", "[", "key", "]", "=", "color_parser", ...
[ 497, 0 ]
[ 522, 9 ]
python
en
['en', 'error', 'th']
False
validate_scale_values
(scale)
Validates scale values from a colorscale :param (list) scale: a strictly increasing list of floats that begins with 0 and ends with 1. Its usage derives from a colorscale which is a list of two-lists (a list with two elements) of the form [value, color] which are used to determine how ...
Validates scale values from a colorscale
def validate_scale_values(scale): """ Validates scale values from a colorscale :param (list) scale: a strictly increasing list of floats that begins with 0 and ends with 1. Its usage derives from a colorscale which is a list of two-lists (a list with two elements) of the form [value...
[ "def", "validate_scale_values", "(", "scale", ")", ":", "if", "len", "(", "scale", ")", "<", "2", ":", "raise", "exceptions", ".", "PlotlyError", "(", "\"You must input a list of scale values \"", "\"that has at least two values.\"", ")", "if", "(", "scale", "[", ...
[ 525, 0 ]
[ 551, 9 ]
python
en
['en', 'error', 'th']
False
validate_colorscale
(colorscale)
Validate the structure, scale values and colors of colorscale.
Validate the structure, scale values and colors of colorscale.
def validate_colorscale(colorscale): """Validate the structure, scale values and colors of colorscale.""" if not isinstance(colorscale, list): # TODO Write tests for these exceptions raise exceptions.PlotlyError("A valid colorscale must be a list.") if not all(isinstance(innerlist, list) for...
[ "def", "validate_colorscale", "(", "colorscale", ")", ":", "if", "not", "isinstance", "(", "colorscale", ",", "list", ")", ":", "# TODO Write tests for these exceptions", "raise", "exceptions", ".", "PlotlyError", "(", "\"A valid colorscale must be a list.\"", ")", "if"...
[ 554, 0 ]
[ 565, 38 ]
python
en
['en', 'en', 'en']
True
make_colorscale
(colors, scale=None)
Makes a colorscale from a list of colors and a scale Takes a list of colors and scales and constructs a colorscale based on the colors in sequential order. If 'scale' is left empty, a linear- interpolated colorscale will be generated. If 'scale' is a specificed list, it must be the same legnth as ...
Makes a colorscale from a list of colors and a scale
def make_colorscale(colors, scale=None): """ Makes a colorscale from a list of colors and a scale Takes a list of colors and scales and constructs a colorscale based on the colors in sequential order. If 'scale' is left empty, a linear- interpolated colorscale will be generated. If 'scale' is a spe...
[ "def", "make_colorscale", "(", "colors", ",", "scale", "=", "None", ")", ":", "colorscale", "=", "[", "]", "# validate minimum colors length of 2", "if", "len", "(", "colors", ")", "<", "2", ":", "raise", "exceptions", ".", "PlotlyError", "(", "\"You must inpu...
[ 568, 0 ]
[ 602, 25 ]
python
en
['en', 'error', 'th']
False
find_intermediate_color
(lowcolor, highcolor, intermed, colortype="tuple")
Returns the color at a given distance between two colors This function takes two color tuples, where each element is between 0 and 1, along with a value 0 < intermed < 1 and returns a color that is intermed-percent from lowcolor to highcolor. If colortype is set to 'rgb', the function will automat...
Returns the color at a given distance between two colors
def find_intermediate_color(lowcolor, highcolor, intermed, colortype="tuple"): """ Returns the color at a given distance between two colors This function takes two color tuples, where each element is between 0 and 1, along with a value 0 < intermed < 1 and returns a color that is intermed-percent f...
[ "def", "find_intermediate_color", "(", "lowcolor", ",", "highcolor", ",", "intermed", ",", "colortype", "=", "\"tuple\"", ")", ":", "if", "colortype", "==", "\"rgb\"", ":", "# convert to tuple color, eg. (1, 0.45, 0.7)", "lowcolor", "=", "unlabel_rgb", "(", "lowcolor"...
[ 605, 0 ]
[ 635, 26 ]
python
en
['en', 'error', 'th']
False
unconvert_from_RGB_255
(colors)
Return a tuple where each element gets divided by 255 Takes a (list of) color tuple(s) where each element is between 0 and 255. Returns the same tuples where each tuple element is normalized to a value between 0 and 1
Return a tuple where each element gets divided by 255
def unconvert_from_RGB_255(colors): """ Return a tuple where each element gets divided by 255 Takes a (list of) color tuple(s) where each element is between 0 and 255. Returns the same tuples where each tuple element is normalized to a value between 0 and 1 """ return (colors[0] / (255.0), ...
[ "def", "unconvert_from_RGB_255", "(", "colors", ")", ":", "return", "(", "colors", "[", "0", "]", "/", "(", "255.0", ")", ",", "colors", "[", "1", "]", "/", "(", "255.0", ")", ",", "colors", "[", "2", "]", "/", "(", "255.0", ")", ")" ]
[ 638, 0 ]
[ 646, 74 ]
python
en
['en', 'error', 'th']
False
convert_to_RGB_255
(colors)
Multiplies each element of a triplet by 255 Each coordinate of the color tuple is rounded to the nearest float and then is turned into an integer. If a number is of the form x.5, then if x is odd, the number rounds up to (x+1). Otherwise, it rounds down to just x. This is the way rounding works in...
Multiplies each element of a triplet by 255
def convert_to_RGB_255(colors): """ Multiplies each element of a triplet by 255 Each coordinate of the color tuple is rounded to the nearest float and then is turned into an integer. If a number is of the form x.5, then if x is odd, the number rounds up to (x+1). Otherwise, it rounds down to ju...
[ "def", "convert_to_RGB_255", "(", "colors", ")", ":", "rgb_components", "=", "[", "]", "for", "component", "in", "colors", ":", "rounded_num", "=", "decimal", ".", "Decimal", "(", "str", "(", "component", "*", "255.0", ")", ")", ".", "quantize", "(", "de...
[ 649, 0 ]
[ 672, 68 ]
python
en
['en', 'error', 'th']
False
n_colors
(lowcolor, highcolor, n_colors, colortype="tuple")
Splits a low and high color into a list of n_colors colors in it Accepts two color tuples and returns a list of n_colors colors which form the intermediate colors between lowcolor and highcolor from linearly interpolating through RGB space. If colortype is 'rgb' the function will return a list of ...
Splits a low and high color into a list of n_colors colors in it
def n_colors(lowcolor, highcolor, n_colors, colortype="tuple"): """ Splits a low and high color into a list of n_colors colors in it Accepts two color tuples and returns a list of n_colors colors which form the intermediate colors between lowcolor and highcolor from linearly interpolating through R...
[ "def", "n_colors", "(", "lowcolor", ",", "highcolor", ",", "n_colors", ",", "colortype", "=", "\"tuple\"", ")", ":", "if", "colortype", "==", "\"rgb\"", ":", "# convert to tuple", "lowcolor", "=", "unlabel_rgb", "(", "lowcolor", ")", "highcolor", "=", "unlabel...
[ 675, 0 ]
[ 709, 25 ]
python
en
['en', 'error', 'th']
False
label_rgb
(colors)
Takes tuple (a, b, c) and returns an rgb color 'rgb(a, b, c)'
Takes tuple (a, b, c) and returns an rgb color 'rgb(a, b, c)'
def label_rgb(colors): """ Takes tuple (a, b, c) and returns an rgb color 'rgb(a, b, c)' """ return "rgb(%s, %s, %s)" % (colors[0], colors[1], colors[2])
[ "def", "label_rgb", "(", "colors", ")", ":", "return", "\"rgb(%s, %s, %s)\"", "%", "(", "colors", "[", "0", "]", ",", "colors", "[", "1", "]", ",", "colors", "[", "2", "]", ")" ]
[ 712, 0 ]
[ 716, 64 ]
python
en
['en', 'error', 'th']
False
unlabel_rgb
(colors)
Takes rgb color(s) 'rgb(a, b, c)' and returns tuple(s) (a, b, c) This function takes either an 'rgb(a, b, c)' color or a list of such colors and returns the color tuples in tuple(s) (a, b, c)
Takes rgb color(s) 'rgb(a, b, c)' and returns tuple(s) (a, b, c)
def unlabel_rgb(colors): """ Takes rgb color(s) 'rgb(a, b, c)' and returns tuple(s) (a, b, c) This function takes either an 'rgb(a, b, c)' color or a list of such colors and returns the color tuples in tuple(s) (a, b, c) """ str_vals = "" for index in range(len(colors)): try: ...
[ "def", "unlabel_rgb", "(", "colors", ")", ":", "str_vals", "=", "\"\"", "for", "index", "in", "range", "(", "len", "(", "colors", ")", ")", ":", "try", ":", "float", "(", "colors", "[", "index", "]", ")", "str_vals", "=", "str_vals", "+", "colors", ...
[ 719, 0 ]
[ 744, 47 ]
python
en
['en', 'error', 'th']
False
hex_to_rgb
(value)
Calculates rgb values from a hex color code. :param (string) value: Hex color string :rtype (tuple) (r_value, g_value, b_value): tuple of rgb values
Calculates rgb values from a hex color code.
def hex_to_rgb(value): """ Calculates rgb values from a hex color code. :param (string) value: Hex color string :rtype (tuple) (r_value, g_value, b_value): tuple of rgb values """ value = value.lstrip("#") hex_total_length = len(value) rgb_section_length = hex_total_length // 3 ret...
[ "def", "hex_to_rgb", "(", "value", ")", ":", "value", "=", "value", ".", "lstrip", "(", "\"#\"", ")", "hex_total_length", "=", "len", "(", "value", ")", "rgb_section_length", "=", "hex_total_length", "//", "3", "return", "tuple", "(", "int", "(", "value", ...
[ 747, 0 ]
[ 761, 5 ]
python
en
['en', 'error', 'th']
False
colorscale_to_colors
(colorscale)
Extracts the colors from colorscale as a list
Extracts the colors from colorscale as a list
def colorscale_to_colors(colorscale): """ Extracts the colors from colorscale as a list """ color_list = [] for item in colorscale: color_list.append(item[1]) return color_list
[ "def", "colorscale_to_colors", "(", "colorscale", ")", ":", "color_list", "=", "[", "]", "for", "item", "in", "colorscale", ":", "color_list", ".", "append", "(", "item", "[", "1", "]", ")", "return", "color_list" ]
[ 764, 0 ]
[ 771, 21 ]
python
en
['en', 'error', 'th']
False
colorscale_to_scale
(colorscale)
Extracts the interpolation scale values from colorscale as a list
Extracts the interpolation scale values from colorscale as a list
def colorscale_to_scale(colorscale): """ Extracts the interpolation scale values from colorscale as a list """ scale_list = [] for item in colorscale: scale_list.append(item[0]) return scale_list
[ "def", "colorscale_to_scale", "(", "colorscale", ")", ":", "scale_list", "=", "[", "]", "for", "item", "in", "colorscale", ":", "scale_list", ".", "append", "(", "item", "[", "0", "]", ")", "return", "scale_list" ]
[ 774, 0 ]
[ 781, 21 ]
python
en
['en', 'error', 'th']
False
convert_colorscale_to_rgb
(colorscale)
Converts the colors in a colorscale to rgb colors A colorscale is an array of arrays, each with a numeric value as the first item and a color as the second. This function specifically is converting a colorscale with tuple colors (each coordinate between 0 and 1) into a colorscale with the colors t...
Converts the colors in a colorscale to rgb colors
def convert_colorscale_to_rgb(colorscale): """ Converts the colors in a colorscale to rgb colors A colorscale is an array of arrays, each with a numeric value as the first item and a color as the second. This function specifically is converting a colorscale with tuple colors (each coordinate betwee...
[ "def", "convert_colorscale_to_rgb", "(", "colorscale", ")", ":", "for", "color", "in", "colorscale", ":", "color", "[", "1", "]", "=", "convert_to_RGB_255", "(", "color", "[", "1", "]", ")", "for", "color", "in", "colorscale", ":", "color", "[", "1", "]"...
[ 784, 0 ]
[ 798, 21 ]
python
en
['en', 'error', 'th']
False