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 |
|---|---|---|---|---|---|---|---|---|---|---|---|
Marker.size | (self) |
Sets the marker size of selected points.
The 'size' property is a number and may be specified as:
- An int or float in the interval [0, inf]
Returns
-------
int|float
|
Sets the marker size of selected points.
The 'size' property is a number and may be specified as:
- An int or float in the interval [0, inf] | def size(self):
"""
Sets the marker size of selected points.
The 'size' property is a number and may be specified as:
- An int or float in the interval [0, inf]
Returns
-------
int|float
"""
return self["size"] | [
"def",
"size",
"(",
"self",
")",
":",
"return",
"self",
"[",
"\"size\"",
"]"
] | [
94,
4
] | [
105,
27
] | python | en | ['en', 'error', 'th'] | False |
Marker.__init__ | (self, arg=None, color=None, opacity=None, size=None, **kwargs) |
Construct a new Marker object
Parameters
----------
arg
dict of properties compatible with this constructor or
an instance of :class:`plotly.graph_objs.scatterpolargl
.selected.Marker`
color
Sets the marker color of select... |
Construct a new Marker object
Parameters
----------
arg
dict of properties compatible with this constructor or
an instance of :class:`plotly.graph_objs.scatterpolargl
.selected.Marker`
color
Sets the marker color of select... | def __init__(self, arg=None, color=None, opacity=None, size=None, **kwargs):
"""
Construct a new Marker object
Parameters
----------
arg
dict of properties compatible with this constructor or
an instance of :class:`plotly.graph_objs.scatterpolargl... | [
"def",
"__init__",
"(",
"self",
",",
"arg",
"=",
"None",
",",
"color",
"=",
"None",
",",
"opacity",
"=",
"None",
",",
"size",
"=",
"None",
",",
"*",
"*",
"kwargs",
")",
":",
"super",
"(",
"Marker",
",",
"self",
")",
".",
"__init__",
"(",
"\"marke... | [
124,
4
] | [
193,
34
] | python | en | ['en', 'error', 'th'] | False |
Tickfont.color | (self) |
The 'color' property is a color and may be specified as:
- A hex string (e.g. '#ff0000')
- An rgb/rgba string (e.g. 'rgb(255,0,0)')
- An hsl/hsla string (e.g. 'hsl(0,100%,50%)')
- An hsv/hsva string (e.g. 'hsv(0,100%,100%)')
- A named CSS color:
... |
The 'color' property is a color and may be specified as:
- A hex string (e.g. '#ff0000')
- An rgb/rgba string (e.g. 'rgb(255,0,0)')
- An hsl/hsla string (e.g. 'hsl(0,100%,50%)')
- An hsv/hsva string (e.g. 'hsv(0,100%,100%)')
- A named CSS color:
... | def color(self):
"""
The 'color' property is a color and may be specified as:
- A hex string (e.g. '#ff0000')
- An rgb/rgba string (e.g. 'rgb(255,0,0)')
- An hsl/hsla string (e.g. 'hsl(0,100%,50%)')
- An hsv/hsva string (e.g. 'hsv(0,100%,100%)')
- A name... | [
"def",
"color",
"(",
"self",
")",
":",
"return",
"self",
"[",
"\"color\"",
"]"
] | [
15,
4
] | [
63,
28
] | python | en | ['en', 'error', 'th'] | False |
Tickfont.family | (self) |
HTML font family - the typeface that will be applied by the web
browser. The web browser will only be able to apply a font if
it is available on the system which it operates. Provide
multiple font families, separated by commas, to indicate the
preference in which to apply fonts ... |
HTML font family - the typeface that will be applied by the web
browser. The web browser will only be able to apply a font if
it is available on the system which it operates. Provide
multiple font families, separated by commas, to indicate the
preference in which to apply fonts ... | def family(self):
"""
HTML font family - the typeface that will be applied by the web
browser. The web browser will only be able to apply a font if
it is available on the system which it operates. Provide
multiple font families, separated by commas, to indicate the
prefer... | [
"def",
"family",
"(",
"self",
")",
":",
"return",
"self",
"[",
"\"family\"",
"]"
] | [
72,
4
] | [
94,
29
] | python | en | ['en', 'error', 'th'] | False |
Tickfont.size | (self) |
The 'size' property is a number and may be specified as:
- An int or float in the interval [1, inf]
Returns
-------
int|float
|
The 'size' property is a number and may be specified as:
- An int or float in the interval [1, inf] | def size(self):
"""
The 'size' property is a number and may be specified as:
- An int or float in the interval [1, inf]
Returns
-------
int|float
"""
return self["size"] | [
"def",
"size",
"(",
"self",
")",
":",
"return",
"self",
"[",
"\"size\"",
"]"
] | [
103,
4
] | [
112,
27
] | python | en | ['en', 'error', 'th'] | False |
Tickfont.__init__ | (self, arg=None, color=None, family=None, size=None, **kwargs) |
Construct a new Tickfont object
Sets the color bar's tick label font
Parameters
----------
arg
dict of properties compatible with this constructor or
an instance of
:class:`plotly.graph_objs.volume.colorbar.Tickfont`
color
... |
Construct a new Tickfont object
Sets the color bar's tick label font | def __init__(self, arg=None, color=None, family=None, size=None, **kwargs):
"""
Construct a new Tickfont object
Sets the color bar's tick label font
Parameters
----------
arg
dict of properties compatible with this constructor or
an insta... | [
"def",
"__init__",
"(",
"self",
",",
"arg",
"=",
"None",
",",
"color",
"=",
"None",
",",
"family",
"=",
"None",
",",
"size",
"=",
"None",
",",
"*",
"*",
"kwargs",
")",
":",
"super",
"(",
"Tickfont",
",",
"self",
")",
".",
"__init__",
"(",
"\"tick... | [
143,
4
] | [
226,
34
] | python | en | ['en', 'error', 'th'] | False |
BaseDetector.with_neck | (self) | bool: whether the detector has a neck | bool: whether the detector has a neck | def with_neck(self):
"""bool: whether the detector has a neck"""
return hasattr(self, 'neck') and self.neck is not None | [
"def",
"with_neck",
"(",
"self",
")",
":",
"return",
"hasattr",
"(",
"self",
",",
"'neck'",
")",
"and",
"self",
".",
"neck",
"is",
"not",
"None"
] | [
22,
4
] | [
24,
62
] | python | en | ['en', 'en', 'en'] | True |
BaseDetector.with_shared_head | (self) | bool: whether the detector has a shared head in the RoI Head | bool: whether the detector has a shared head in the RoI Head | def with_shared_head(self):
"""bool: whether the detector has a shared head in the RoI Head"""
return hasattr(self.roi_head,
'shared_head') and self.roi_head.shared_head is not None | [
"def",
"with_shared_head",
"(",
"self",
")",
":",
"return",
"hasattr",
"(",
"self",
".",
"roi_head",
",",
"'shared_head'",
")",
"and",
"self",
".",
"roi_head",
".",
"shared_head",
"is",
"not",
"None"
] | [
29,
4
] | [
32,
79
] | python | en | ['en', 'en', 'en'] | True |
BaseDetector.with_bbox | (self) | bool: whether the detector has a bbox head | bool: whether the detector has a bbox head | def with_bbox(self):
"""bool: whether the detector has a bbox head"""
return ((hasattr(self.roi_head, 'bbox_head')
and self.roi_head.bbox_head is not None)
or (hasattr(self, 'bbox_head') and self.bbox_head is not None)) | [
"def",
"with_bbox",
"(",
"self",
")",
":",
"return",
"(",
"(",
"hasattr",
"(",
"self",
".",
"roi_head",
",",
"'bbox_head'",
")",
"and",
"self",
".",
"roi_head",
".",
"bbox_head",
"is",
"not",
"None",
")",
"or",
"(",
"hasattr",
"(",
"self",
",",
"'bbo... | [
35,
4
] | [
39,
79
] | python | en | ['en', 'en', 'en'] | True |
BaseDetector.with_mask | (self) | bool: whether the detector has a mask head | bool: whether the detector has a mask head | def with_mask(self):
"""bool: whether the detector has a mask head"""
return ((hasattr(self.roi_head, 'mask_head')
and self.roi_head.mask_head is not None)
or (hasattr(self, 'mask_head') and self.mask_head is not None)) | [
"def",
"with_mask",
"(",
"self",
")",
":",
"return",
"(",
"(",
"hasattr",
"(",
"self",
".",
"roi_head",
",",
"'mask_head'",
")",
"and",
"self",
".",
"roi_head",
".",
"mask_head",
"is",
"not",
"None",
")",
"or",
"(",
"hasattr",
"(",
"self",
",",
"'mas... | [
42,
4
] | [
46,
79
] | python | en | ['en', 'en', 'en'] | True |
BaseDetector.extract_feat | (self, imgs) | Extract features from images. | Extract features from images. | def extract_feat(self, imgs):
"""Extract features from images."""
pass | [
"def",
"extract_feat",
"(",
"self",
",",
"imgs",
")",
":",
"pass"
] | [
49,
4
] | [
51,
12
] | python | en | ['en', 'en', 'en'] | True |
BaseDetector.extract_feats | (self, imgs) | Extract features from multiple images.
Args:
imgs (list[torch.Tensor]): A list of images. The images are
augmented from the same image but in different ways.
Returns:
list[torch.Tensor]: Features of different images
| Extract features from multiple images. | def extract_feats(self, imgs):
"""Extract features from multiple images.
Args:
imgs (list[torch.Tensor]): A list of images. The images are
augmented from the same image but in different ways.
Returns:
list[torch.Tensor]: Features of different images
... | [
"def",
"extract_feats",
"(",
"self",
",",
"imgs",
")",
":",
"assert",
"isinstance",
"(",
"imgs",
",",
"list",
")",
"return",
"[",
"self",
".",
"extract_feat",
"(",
"img",
")",
"for",
"img",
"in",
"imgs",
"]"
] | [
53,
4
] | [
64,
55
] | python | en | ['en', 'en', 'en'] | True |
BaseDetector.forward_train | (self, imgs, img_metas, **kwargs) |
Args:
img (list[Tensor]): List of tensors of shape (1, C, H, W).
Typically these should be mean centered and std scaled.
img_metas (list[dict]): List of image info dict where each dict
has: 'img_shape', 'scale_factor', 'flip', and my also contain
... |
Args:
img (list[Tensor]): List of tensors of shape (1, C, H, W).
Typically these should be mean centered and std scaled.
img_metas (list[dict]): List of image info dict where each dict
has: 'img_shape', 'scale_factor', 'flip', and my also contain
... | def forward_train(self, imgs, img_metas, **kwargs):
"""
Args:
img (list[Tensor]): List of tensors of shape (1, C, H, W).
Typically these should be mean centered and std scaled.
img_metas (list[dict]): List of image info dict where each dict
has: 'i... | [
"def",
"forward_train",
"(",
"self",
",",
"imgs",
",",
"img_metas",
",",
"*",
"*",
"kwargs",
")",
":",
"pass"
] | [
67,
4
] | [
79,
12
] | python | en | ['en', 'error', 'th'] | False |
BaseDetector.aug_test | (self, imgs, img_metas, **kwargs) | Test function with test time augmentation. | Test function with test time augmentation. | def aug_test(self, imgs, img_metas, **kwargs):
"""Test function with test time augmentation."""
pass | [
"def",
"aug_test",
"(",
"self",
",",
"imgs",
",",
"img_metas",
",",
"*",
"*",
"kwargs",
")",
":",
"pass"
] | [
89,
4
] | [
91,
12
] | python | en | ['en', 'en', 'en'] | True |
BaseDetector.init_weights | (self, pretrained=None) | Initialize the weights in detector.
Args:
pretrained (str, optional): Path to pre-trained weights.
Defaults to None.
| Initialize the weights in detector. | def init_weights(self, pretrained=None):
"""Initialize the weights in detector.
Args:
pretrained (str, optional): Path to pre-trained weights.
Defaults to None.
"""
if pretrained is not None:
logger = get_root_logger()
print_log(f'load... | [
"def",
"init_weights",
"(",
"self",
",",
"pretrained",
"=",
"None",
")",
":",
"if",
"pretrained",
"is",
"not",
"None",
":",
"logger",
"=",
"get_root_logger",
"(",
")",
"print_log",
"(",
"f'load model from: {pretrained}'",
",",
"logger",
"=",
"logger",
")"
] | [
93,
4
] | [
102,
70
] | python | en | ['en', 'en', 'en'] | True |
BaseDetector.forward_test | (self, imgs, img_metas, **kwargs) |
Args:
imgs (List[Tensor]): the outer list indicates test-time
augmentations and inner Tensor should have a shape NxCxHxW,
which contains all images in the batch.
img_metas (List[List[dict]]): the outer list indicates test-time
augs (multis... |
Args:
imgs (List[Tensor]): the outer list indicates test-time
augmentations and inner Tensor should have a shape NxCxHxW,
which contains all images in the batch.
img_metas (List[List[dict]]): the outer list indicates test-time
augs (multis... | def forward_test(self, imgs, img_metas, **kwargs):
"""
Args:
imgs (List[Tensor]): the outer list indicates test-time
augmentations and inner Tensor should have a shape NxCxHxW,
which contains all images in the batch.
img_metas (List[List[dict]]): t... | [
"def",
"forward_test",
"(",
"self",
",",
"imgs",
",",
"img_metas",
",",
"*",
"*",
"kwargs",
")",
":",
"for",
"var",
",",
"name",
"in",
"[",
"(",
"imgs",
",",
"'imgs'",
")",
",",
"(",
"img_metas",
",",
"'img_metas'",
")",
"]",
":",
"if",
"not",
"i... | [
122,
4
] | [
156,
59
] | python | en | ['en', 'error', 'th'] | False |
BaseDetector.forward | (self, img, img_metas, return_loss=True, **kwargs) | Calls either :func:`forward_train` or :func:`forward_test` depending
on whether ``return_loss`` is ``True``.
Note this setting will change the expected inputs. When
``return_loss=True``, img and img_meta are single-nested (i.e. Tensor
and List[dict]), and when ``resturn_loss=False``, im... | Calls either :func:`forward_train` or :func:`forward_test` depending
on whether ``return_loss`` is ``True``. | def forward(self, img, img_metas, return_loss=True, **kwargs):
"""Calls either :func:`forward_train` or :func:`forward_test` depending
on whether ``return_loss`` is ``True``.
Note this setting will change the expected inputs. When
``return_loss=True``, img and img_meta are single-nested... | [
"def",
"forward",
"(",
"self",
",",
"img",
",",
"img_metas",
",",
"return_loss",
"=",
"True",
",",
"*",
"*",
"kwargs",
")",
":",
"if",
"return_loss",
":",
"return",
"self",
".",
"forward_train",
"(",
"img",
",",
"img_metas",
",",
"*",
"*",
"kwargs",
... | [
159,
4
] | [
172,
62
] | python | en | ['en', 'en', 'en'] | True |
BaseDetector._parse_losses | (self, losses) | Parse the raw outputs (losses) of the network.
Args:
losses (dict): Raw output of the network, which usually contain
losses and other necessary infomation.
Returns:
tuple[Tensor, dict]: (loss, log_vars), loss is the loss tensor
which may be a wei... | Parse the raw outputs (losses) of the network. | def _parse_losses(self, losses):
"""Parse the raw outputs (losses) of the network.
Args:
losses (dict): Raw output of the network, which usually contain
losses and other necessary infomation.
Returns:
tuple[Tensor, dict]: (loss, log_vars), loss is the lo... | [
"def",
"_parse_losses",
"(",
"self",
",",
"losses",
")",
":",
"log_vars",
"=",
"OrderedDict",
"(",
")",
"for",
"loss_name",
",",
"loss_value",
"in",
"losses",
".",
"items",
"(",
")",
":",
"if",
"isinstance",
"(",
"loss_value",
",",
"torch",
".",
"Tensor"... | [
174,
4
] | [
207,
29
] | python | en | ['en', 'en', 'en'] | True |
BaseDetector.train_step | (self, data, optimizer) | The iteration step during training.
This method defines an iteration step during training, except for the
back propagation and optimizer updating, which are done in an optimizer
hook. Note that in some complicated cases or models, the whole process
including back propagation and optimiz... | The iteration step during training. | def train_step(self, data, optimizer):
"""The iteration step during training.
This method defines an iteration step during training, except for the
back propagation and optimizer updating, which are done in an optimizer
hook. Note that in some complicated cases or models, the whole proc... | [
"def",
"train_step",
"(",
"self",
",",
"data",
",",
"optimizer",
")",
":",
"losses",
"=",
"self",
"(",
"*",
"*",
"data",
")",
"loss",
",",
"log_vars",
"=",
"self",
".",
"_parse_losses",
"(",
"losses",
")",
"outputs",
"=",
"dict",
"(",
"loss",
"=",
... | [
209,
4
] | [
241,
22
] | python | en | ['en', 'en', 'en'] | True |
BaseDetector.val_step | (self, data, optimizer) | The iteration step during validation.
This method shares the same signature as :func:`train_step`, but used
during val epochs. Note that the evaluation after training epochs is
not implemented with this method, but an evaluation hook.
| The iteration step during validation. | def val_step(self, data, optimizer):
"""The iteration step during validation.
This method shares the same signature as :func:`train_step`, but used
during val epochs. Note that the evaluation after training epochs is
not implemented with this method, but an evaluation hook.
"""
... | [
"def",
"val_step",
"(",
"self",
",",
"data",
",",
"optimizer",
")",
":",
"losses",
"=",
"self",
"(",
"*",
"*",
"data",
")",
"loss",
",",
"log_vars",
"=",
"self",
".",
"_parse_losses",
"(",
"losses",
")",
"outputs",
"=",
"dict",
"(",
"loss",
"=",
"l... | [
243,
4
] | [
256,
22
] | python | en | ['en', 'en', 'en'] | True |
BaseDetector.show_result | (self,
img,
result,
score_thr=0.3,
bbox_color='green',
text_color='green',
thickness=1,
font_scale=0.5,
win_name='',
show=False,
... | Draw `result` over `img`.
Args:
img (str or Tensor): The image to be displayed.
result (Tensor or tuple): The results to draw over `img`
bbox_result or (bbox_result, segm_result).
score_thr (float, optional): Minimum score of bboxes to be shown.
... | Draw `result` over `img`. | def show_result(self,
img,
result,
score_thr=0.3,
bbox_color='green',
text_color='green',
thickness=1,
font_scale=0.5,
win_name='',
show=Fal... | [
"def",
"show_result",
"(",
"self",
",",
"img",
",",
"result",
",",
"score_thr",
"=",
"0.3",
",",
"bbox_color",
"=",
"'green'",
",",
"text_color",
"=",
"'green'",
",",
"thickness",
"=",
"1",
",",
"font_scale",
"=",
"0.5",
",",
"win_name",
"=",
"''",
","... | [
258,
4
] | [
341,
22
] | python | en | ['pl', 'en', 'nl'] | False |
Line.color | (self) |
Sets the line 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%)')
- ... |
Sets the line 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%)')
- ... | def color(self):
"""
Sets the line 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... | [
"def",
"color",
"(",
"self",
")",
":",
"return",
"self",
"[",
"\"color\"",
"]"
] | [
15,
4
] | [
65,
28
] | python | en | ['en', 'error', 'th'] | False |
Line.dash | (self) |
Sets the style of the lines.
The 'dash' property is an enumeration that may be specified as:
- One of the following enumeration values:
['solid', 'dot', 'dash', 'longdash', 'dashdot',
'longdashdot']
Returns
-------
Any
|
Sets the style of the lines.
The 'dash' property is an enumeration that may be specified as:
- One of the following enumeration values:
['solid', 'dot', 'dash', 'longdash', 'dashdot',
'longdashdot'] | def dash(self):
"""
Sets the style of the lines.
The 'dash' property is an enumeration that may be specified as:
- One of the following enumeration values:
['solid', 'dot', 'dash', 'longdash', 'dashdot',
'longdashdot']
Returns
-----... | [
"def",
"dash",
"(",
"self",
")",
":",
"return",
"self",
"[",
"\"dash\"",
"]"
] | [
74,
4
] | [
87,
27
] | python | en | ['en', 'error', 'th'] | False |
Line.shape | (self) |
Determines the line shape. The values correspond to step-wise
line shapes.
The 'shape' property is an enumeration that may be specified as:
- One of the following enumeration values:
['linear', 'hv', 'vh', 'hvh', 'vhv']
Returns
-------
Any... |
Determines the line shape. The values correspond to step-wise
line shapes.
The 'shape' property is an enumeration that may be specified as:
- One of the following enumeration values:
['linear', 'hv', 'vh', 'hvh', 'vhv'] | def shape(self):
"""
Determines the line shape. The values correspond to step-wise
line shapes.
The 'shape' property is an enumeration that may be specified as:
- One of the following enumeration values:
['linear', 'hv', 'vh', 'hvh', 'vhv']
Returns... | [
"def",
"shape",
"(",
"self",
")",
":",
"return",
"self",
"[",
"\"shape\"",
"]"
] | [
96,
4
] | [
109,
28
] | python | en | ['en', 'error', 'th'] | False |
Line.width | (self) |
Sets the line width (in px).
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 line width (in px).
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 line width (in px).
The 'width' property is a number and may be specified as:
- An int or float in the interval [0, inf]
Returns
-------
int|float
"""
return self["width"] | [
"def",
"width",
"(",
"self",
")",
":",
"return",
"self",
"[",
"\"width\"",
"]"
] | [
118,
4
] | [
129,
28
] | python | en | ['en', 'error', 'th'] | False |
Line.__init__ | (
self, arg=None, color=None, dash=None, shape=None, width=None, **kwargs
) |
Construct a new Line object
Parameters
----------
arg
dict of properties compatible with this constructor or
an instance of
:class:`plotly.graph_objs.scatterpolargl.Line`
color
Sets the line color.
dash
... |
Construct a new Line object
Parameters
----------
arg
dict of properties compatible with this constructor or
an instance of
:class:`plotly.graph_objs.scatterpolargl.Line`
color
Sets the line color.
dash
... | def __init__(
self, arg=None, color=None, dash=None, shape=None, width=None, **kwargs
):
"""
Construct a new Line object
Parameters
----------
arg
dict of properties compatible with this constructor or
an instance of
:class... | [
"def",
"__init__",
"(",
"self",
",",
"arg",
"=",
"None",
",",
"color",
"=",
"None",
",",
"dash",
"=",
"None",
",",
"shape",
"=",
"None",
",",
"width",
"=",
"None",
",",
"*",
"*",
"kwargs",
")",
":",
"super",
"(",
"Line",
",",
"self",
")",
".",
... | [
151,
4
] | [
229,
34
] | python | en | ['en', 'error', 'th'] | False |
_call_or_get | (value, menu=None, choice=None, string=None, obj=None, caller=None) |
Call the value, if appropriate, or just return it.
Args:
value (any): the value to obtain. It might be a callable (see note).
Kwargs:
menu (BuildingMenu, optional): the building menu to pass to value
if it is a callable.
choice (Choice, optional): the choice to pa... |
Call the value, if appropriate, or just return it. | def _call_or_get(value, menu=None, choice=None, string=None, obj=None, caller=None):
"""
Call the value, if appropriate, or just return it.
Args:
value (any): the value to obtain. It might be a callable (see note).
Kwargs:
menu (BuildingMenu, optional): the building menu to pass to va... | [
"def",
"_call_or_get",
"(",
"value",
",",
"menu",
"=",
"None",
",",
"choice",
"=",
"None",
",",
"string",
"=",
"None",
",",
"obj",
"=",
"None",
",",
"caller",
"=",
"None",
")",
":",
"if",
"callable",
"(",
"value",
")",
":",
"# Check the function argume... | [
169,
0
] | [
231,
16
] | python | en | ['en', 'error', 'th'] | False |
menu_setattr | (menu, choice, obj, string) |
Set the value at the specified attribute.
Args:
menu (BuildingMenu): the menu object.
choice (Chocie): the specific choice.
obj (Object): the object to modify.
string (str): the string with the new value.
Note:
This function is supposed to be used as a default to
... |
Set the value at the specified attribute. | def menu_setattr(menu, choice, obj, string):
"""
Set the value at the specified attribute.
Args:
menu (BuildingMenu): the menu object.
choice (Chocie): the specific choice.
obj (Object): the object to modify.
string (str): the string with the new value.
Note:
Th... | [
"def",
"menu_setattr",
"(",
"menu",
",",
"choice",
",",
"obj",
",",
"string",
")",
":",
"attr",
"=",
"getattr",
"(",
"choice",
",",
"\"attr\"",
",",
"None",
")",
"if",
"choice",
"else",
"None",
"if",
"choice",
"is",
"None",
"or",
"string",
"is",
"Non... | [
236,
0
] | [
264,
15
] | python | en | ['en', 'error', 'th'] | False |
menu_quit | (caller, menu) |
Quit the menu, closing the CmdSet.
Args:
caller (Account or Object): the caller.
menu (BuildingMenu): the building menu to close.
Note:
This callback is used by default when using the
`BuildingMenu.add_choice_quit` method. This method is called
automatically if th... |
Quit the menu, closing the CmdSet. | def menu_quit(caller, menu):
"""
Quit the menu, closing the CmdSet.
Args:
caller (Account or Object): the caller.
menu (BuildingMenu): the building menu to close.
Note:
This callback is used by default when using the
`BuildingMenu.add_choice_quit` method. This method i... | [
"def",
"menu_quit",
"(",
"caller",
",",
"menu",
")",
":",
"if",
"caller",
"is",
"None",
"or",
"menu",
"is",
"None",
":",
"log_err",
"(",
"\"The function `menu_quit` was called with missing \"",
"\"arguments: caller={}, menu={}\"",
".",
"format",
"(",
"caller",
",",
... | [
267,
0
] | [
289,
78
] | python | en | ['en', 'error', 'th'] | False |
menu_edit | (caller, choice, obj) |
Open the EvEditor to edit a specified attribute.
Args:
caller (Account or Object): the caller.
choice (Choice): the choice object.
obj (Object): the object to edit.
|
Open the EvEditor to edit a specified attribute. | def menu_edit(caller, choice, obj):
"""
Open the EvEditor to edit a specified attribute.
Args:
caller (Account or Object): the caller.
choice (Choice): the choice object.
obj (Object): the object to edit.
"""
attr = choice.attr
caller.db._building_menu_to_edit = (obj, a... | [
"def",
"menu_edit",
"(",
"caller",
",",
"choice",
",",
"obj",
")",
":",
"attr",
"=",
"choice",
".",
"attr",
"caller",
".",
"db",
".",
"_building_menu_to_edit",
"=",
"(",
"obj",
",",
"attr",
")",
"caller",
".",
"cmdset",
".",
"remove",
"(",
"BuildingMen... | [
292,
0
] | [
306,
43
] | python | en | ['en', 'error', 'th'] | False |
CmdNoInput.func | (self) | Display the menu or choice text. | Display the menu or choice text. | def func(self):
"""Display the menu or choice text."""
if self.menu:
self.menu.display()
else:
log_err("When CMDNOINPUT was called, the building menu couldn't be found")
self.caller.msg("|rThe building menu couldn't be found, remove the CmdSet.|n")
... | [
"def",
"func",
"(",
"self",
")",
":",
"if",
"self",
".",
"menu",
":",
"self",
".",
"menu",
".",
"display",
"(",
")",
"else",
":",
"log_err",
"(",
"\"When CMDNOINPUT was called, the building menu couldn't be found\"",
")",
"self",
".",
"caller",
".",
"msg",
"... | [
322,
4
] | [
329,
57
] | python | en | ['en', 'fil', 'en'] | True |
CmdNoMatch.func | (self) | Call the proper menu or redirect to nomatch. | Call the proper menu or redirect to nomatch. | def func(self):
"""Call the proper menu or redirect to nomatch."""
raw_string = self.args.rstrip()
if self.menu is None:
log_err("When CMDNOMATCH was called, the building menu couldn't be found")
self.caller.msg("|rThe building menu couldn't be found, remove the CmdSet.|n... | [
"def",
"func",
"(",
"self",
")",
":",
"raw_string",
"=",
"self",
".",
"args",
".",
"rstrip",
"(",
")",
"if",
"self",
".",
"menu",
"is",
"None",
":",
"log_err",
"(",
"\"When CMDNOMATCH was called, the building menu couldn't be found\"",
")",
"self",
".",
"calle... | [
343,
4
] | [
369,
67
] | python | en | ['en', 'en', 'en'] | True |
BuildingMenuCmdSet.at_cmdset_creation | (self) | Populates the cmdset with commands. | Populates the cmdset with commands. | def at_cmdset_creation(self):
"""Populates the cmdset with commands."""
caller = self.cmdsetobj
# The caller could recall the menu
menu = caller.ndb._building_menu
if menu is None:
menu = caller.db._building_menu
if menu:
menu = BuildingMe... | [
"def",
"at_cmdset_creation",
"(",
"self",
")",
":",
"caller",
"=",
"self",
".",
"cmdsetobj",
"# The caller could recall the menu",
"menu",
"=",
"caller",
".",
"ndb",
".",
"_building_menu",
"if",
"menu",
"is",
"None",
":",
"menu",
"=",
"caller",
".",
"db",
".... | [
379,
4
] | [
392,
45
] | python | en | ['en', 'en', 'en'] | True |
Choice.__init__ | (self, title, key=None, aliases=None, attr=None, text=None,
glance=None, on_enter=None, on_nomatch=None, on_leave=None,
menu=None, caller=None, obj=None) | Constructor.
Args:
title (str): the choice's title.
key (str, optional): the key of the letters to type to access
the choice. If not set, try to guess it based on the title.
aliases (list of str, optional): the allowed aliases for this choice.
... | Constructor. | def __init__(self, title, key=None, aliases=None, attr=None, text=None,
glance=None, on_enter=None, on_nomatch=None, on_leave=None,
menu=None, caller=None, obj=None):
"""Constructor.
Args:
title (str): the choice's title.
key (str, optional): th... | [
"def",
"__init__",
"(",
"self",
",",
"title",
",",
"key",
"=",
"None",
",",
"aliases",
"=",
"None",
",",
"attr",
"=",
"None",
",",
"text",
"=",
"None",
",",
"glance",
"=",
"None",
",",
"on_enter",
"=",
"None",
",",
"on_nomatch",
"=",
"None",
",",
... | [
401,
4
] | [
440,
22
] | python | en | ['en', 'en', 'en'] | False |
Choice.keys | (self) | Return a tuple of keys separated by `sep_keys`. | Return a tuple of keys separated by `sep_keys`. | def keys(self):
"""Return a tuple of keys separated by `sep_keys`."""
return tuple(self.key.split(self.menu.sep_keys)) | [
"def",
"keys",
"(",
"self",
")",
":",
"return",
"tuple",
"(",
"self",
".",
"key",
".",
"split",
"(",
"self",
".",
"menu",
".",
"sep_keys",
")",
")"
] | [
446,
4
] | [
448,
56
] | python | en | ['en', 'af', 'en'] | True |
Choice.format_text | (self) | Format the choice text and return it, or an empty string. | Format the choice text and return it, or an empty string. | def format_text(self):
"""Format the choice text and return it, or an empty string."""
text = ""
if self.text:
text = _call_or_get(self.text, menu=self.menu, choice=self, string="", caller=self.caller, obj=self.obj)
text = dedent(text.strip("\n"))
text = text.... | [
"def",
"format_text",
"(",
"self",
")",
":",
"text",
"=",
"\"\"",
"if",
"self",
".",
"text",
":",
"text",
"=",
"_call_or_get",
"(",
"self",
".",
"text",
",",
"menu",
"=",
"self",
".",
"menu",
",",
"choice",
"=",
"self",
",",
"string",
"=",
"\"\"",
... | [
450,
4
] | [
458,
19
] | python | en | ['en', 'en', 'en'] | True |
Choice.enter | (self, string) | Called when the user opens the choice.
Args:
string (str): the entered string.
| Called when the user opens the choice. | def enter(self, string):
"""Called when the user opens the choice.
Args:
string (str): the entered string.
"""
if self.on_enter:
_call_or_get(self.on_enter, menu=self.menu, choice=self, string=string,
caller=self.caller, obj=self.obj) | [
"def",
"enter",
"(",
"self",
",",
"string",
")",
":",
"if",
"self",
".",
"on_enter",
":",
"_call_or_get",
"(",
"self",
".",
"on_enter",
",",
"menu",
"=",
"self",
".",
"menu",
",",
"choice",
"=",
"self",
",",
"string",
"=",
"string",
",",
"caller",
... | [
460,
4
] | [
469,
58
] | python | en | ['en', 'en', 'en'] | True |
Choice.nomatch | (self, string) | Called when the user entered something in the choice.
Args:
string (str): the entered string.
Returns:
to_display (bool): The return value of `nomatch` if set or
`True`. The rule is that if `no_match` returns `True`,
then the choice or menu is displayed... | Called when the user entered something in the choice. | def nomatch(self, string):
"""Called when the user entered something in the choice.
Args:
string (str): the entered string.
Returns:
to_display (bool): The return value of `nomatch` if set or
`True`. The rule is that if `no_match` returns `True`,
... | [
"def",
"nomatch",
"(",
"self",
",",
"string",
")",
":",
"if",
"self",
".",
"on_nomatch",
":",
"return",
"_call_or_get",
"(",
"self",
".",
"on_nomatch",
",",
"menu",
"=",
"self",
".",
"menu",
",",
"choice",
"=",
"self",
",",
"string",
"=",
"string",
"... | [
471,
4
] | [
487,
19
] | python | en | ['en', 'en', 'en'] | True |
Choice.leave | (self, string) | Called when the user closes the choice.
Args:
string (str): the entered string.
| Called when the user closes the choice. | def leave(self, string):
"""Called when the user closes the choice.
Args:
string (str): the entered string.
"""
if self.on_leave:
_call_or_get(self.on_leave, menu=self.menu, choice=self,
string=string, caller=self.caller, obj=self.obj) | [
"def",
"leave",
"(",
"self",
",",
"string",
")",
":",
"if",
"self",
".",
"on_leave",
":",
"_call_or_get",
"(",
"self",
".",
"on_leave",
",",
"menu",
"=",
"self",
".",
"menu",
",",
"choice",
"=",
"self",
",",
"string",
"=",
"string",
",",
"caller",
... | [
489,
4
] | [
498,
73
] | python | en | ['en', 'en', 'en'] | True |
BuildingMenu.__init__ | (self, caller=None, obj=None, title="Building menu: {obj}",
keys=None, parents=None, persistent=False) | Constructor, you shouldn't override. See `init` instead.
Args:
caller (Account or Object): the caller.
obj (Object): the object to be edited, like a room.
title (str, optional): the menu title.
keys (list of str, optional): the starting menu keys (None
... | Constructor, you shouldn't override. See `init` instead. | def __init__(self, caller=None, obj=None, title="Building menu: {obj}",
keys=None, parents=None, persistent=False):
"""Constructor, you shouldn't override. See `init` instead.
Args:
caller (Account or Object): the caller.
obj (Object): the object to be edited, ... | [
"def",
"__init__",
"(",
"self",
",",
"caller",
"=",
"None",
",",
"obj",
"=",
"None",
",",
"title",
"=",
"\"Building menu: {obj}\"",
",",
"keys",
"=",
"None",
",",
"parents",
"=",
"None",
",",
"persistent",
"=",
"False",
")",
":",
"self",
".",
"caller",... | [
529,
4
] | [
569,
35
] | python | en | ['en', 'en', 'en'] | True |
BuildingMenu.current_choice | (self) | Return the current choice or None.
Returns:
choice (Choice): the current choice or None.
Note:
We use the menu keys to identify the current position of
the caller in the menu. The menu `keys` hold a list of
keys that should match a choice to be usable.
... | Return the current choice or None. | def current_choice(self):
"""Return the current choice or None.
Returns:
choice (Choice): the current choice or None.
Note:
We use the menu keys to identify the current position of
the caller in the menu. The menu `keys` hold a list of
keys that... | [
"def",
"current_choice",
"(",
"self",
")",
":",
"menu_keys",
"=",
"self",
".",
"keys",
"if",
"not",
"menu_keys",
":",
"return",
"None",
"for",
"choice",
"in",
"self",
".",
"choices",
":",
"choice_keys",
"=",
"choice",
".",
"keys",
"if",
"len",
"(",
"me... | [
572,
4
] | [
604,
19
] | python | en | ['en', 'en', 'en'] | True |
BuildingMenu.relevant_choices | (self) | Only return the relevant choices according to the current meny key.
Returns:
relevant (list of Choice object): the relevant choices.
Note:
We use the menu keys to identify the current position of
the caller in the menu. The menu `keys` hold a list of
ke... | Only return the relevant choices according to the current meny key. | def relevant_choices(self):
"""Only return the relevant choices according to the current meny key.
Returns:
relevant (list of Choice object): the relevant choices.
Note:
We use the menu keys to identify the current position of
the caller in the menu. The me... | [
"def",
"relevant_choices",
"(",
"self",
")",
":",
"menu_keys",
"=",
"self",
".",
"keys",
"relevant",
"=",
"[",
"]",
"for",
"choice",
"in",
"self",
".",
"choices",
":",
"choice_keys",
"=",
"choice",
".",
"keys",
"if",
"not",
"menu_keys",
"and",
"len",
"... | [
607,
4
] | [
640,
23
] | python | en | ['en', 'en', 'en'] | True |
BuildingMenu._save | (self) | Save the menu in a attributes on the caller.
If `persistent` is set to `True`, also save in a persistent attribute.
| Save the menu in a attributes on the caller. | def _save(self):
"""Save the menu in a attributes on the caller.
If `persistent` is set to `True`, also save in a persistent attribute.
"""
self.caller.ndb._building_menu = self
if self.persistent:
self.caller.db._building_menu = {
"class": type... | [
"def",
"_save",
"(",
"self",
")",
":",
"self",
".",
"caller",
".",
"ndb",
".",
"_building_menu",
"=",
"self",
"if",
"self",
".",
"persistent",
":",
"self",
".",
"caller",
".",
"db",
".",
"_building_menu",
"=",
"{",
"\"class\"",
":",
"type",
"(",
"sel... | [
642,
4
] | [
658,
13
] | python | en | ['en', 'en', 'en'] | True |
BuildingMenu._add_keys_choice | (self) | Add the choices' keys if some choices don't have valid keys. | Add the choices' keys if some choices don't have valid keys. | def _add_keys_choice(self):
"""Add the choices' keys if some choices don't have valid keys."""
# If choices have been added without keys, try to guess them
for choice in self.choices:
if not choice.key:
title = strip_ansi(choice.title.strip()).lower()
... | [
"def",
"_add_keys_choice",
"(",
"self",
")",
":",
"# If choices have been added without keys, try to guess them",
"for",
"choice",
"in",
"self",
".",
"choices",
":",
"if",
"not",
"choice",
".",
"key",
":",
"title",
"=",
"strip_ansi",
"(",
"choice",
".",
"title",
... | [
660,
4
] | [
685,
82
] | python | en | ['en', 'en', 'en'] | True |
BuildingMenu.init | (self, obj) | Create the sub-menu to edit the specified object.
Args:
obj (Object): the object to edit.
Note:
This method is probably to be overridden in your subclasses.
Use `add_choice` and its variants to create menu choices.
| Create the sub-menu to edit the specified object. | def init(self, obj):
"""Create the sub-menu to edit the specified object.
Args:
obj (Object): the object to edit.
Note:
This method is probably to be overridden in your subclasses.
Use `add_choice` and its variants to create menu choices.
"""
... | [
"def",
"init",
"(",
"self",
",",
"obj",
")",
":",
"pass"
] | [
687,
4
] | [
698,
12
] | python | en | ['en', 'en', 'en'] | True |
BuildingMenu.add_choice | (self, title, key=None, aliases=None, attr=None, text=None, glance=None,
on_enter=None, on_nomatch=None, on_leave=None) |
Add a choice, a valid sub-menu, in the current builder menu.
Args:
title (str): the choice's title.
key (str, optional): the key of the letters to type to access
the sub-neu. If not set, try to guess it based on the
choice title.
... |
Add a choice, a valid sub-menu, in the current builder menu. | def add_choice(self, title, key=None, aliases=None, attr=None, text=None, glance=None,
on_enter=None, on_nomatch=None, on_leave=None):
"""
Add a choice, a valid sub-menu, in the current builder menu.
Args:
title (str): the choice's title.
key (str, opt... | [
"def",
"add_choice",
"(",
"self",
",",
"title",
",",
"key",
"=",
"None",
",",
"aliases",
"=",
"None",
",",
"attr",
"=",
"None",
",",
"text",
"=",
"None",
",",
"glance",
"=",
"None",
",",
"on_enter",
"=",
"None",
",",
"on_nomatch",
"=",
"None",
",",... | [
700,
4
] | [
792,
21
] | python | en | ['en', 'error', 'th'] | False |
BuildingMenu.add_choice_edit | (self, title="description", key="d", aliases=None, attr="db.desc",
glance="\n {obj.db.desc}", on_enter=None) |
Add a simple choice to edit a given attribute in the EvEditor.
Args:
title (str, optional): the choice's title.
key (str, optional): the choice's key.
aliases (list of str, optional): the choice's aliases.
glance (str or callable, optional): the at-a-gla... |
Add a simple choice to edit a given attribute in the EvEditor. | def add_choice_edit(self, title="description", key="d", aliases=None, attr="db.desc",
glance="\n {obj.db.desc}", on_enter=None):
"""
Add a simple choice to edit a given attribute in the EvEditor.
Args:
title (str, optional): the choice's title.
... | [
"def",
"add_choice_edit",
"(",
"self",
",",
"title",
"=",
"\"description\"",
",",
"key",
"=",
"\"d\"",
",",
"aliases",
"=",
"None",
",",
"attr",
"=",
"\"db.desc\"",
",",
"glance",
"=",
"\"\\n {obj.db.desc}\"",
",",
"on_enter",
"=",
"None",
")",
":",
"on_... | [
794,
4
] | [
820,
73
] | python | en | ['en', 'error', 'th'] | False |
BuildingMenu.add_choice_quit | (self, title="quit the menu", key="q", aliases=None, on_enter=None) |
Add a simple choice just to quit the building menu.
Args:
title (str, optional): the choice's title.
key (str, optional): the choice's key.
aliases (list of str, optional): the choice's aliases.
on_enter (callable, optional): a different callable
... |
Add a simple choice just to quit the building menu. | def add_choice_quit(self, title="quit the menu", key="q", aliases=None, on_enter=None):
"""
Add a simple choice just to quit the building menu.
Args:
title (str, optional): the choice's title.
key (str, optional): the choice's key.
aliases (list of str, optio... | [
"def",
"add_choice_quit",
"(",
"self",
",",
"title",
"=",
"\"quit the menu\"",
",",
"key",
"=",
"\"q\"",
",",
"aliases",
"=",
"None",
",",
"on_enter",
"=",
"None",
")",
":",
"on_enter",
"=",
"on_enter",
"or",
"menu_quit",
"self",
".",
"can_quit",
"=",
"T... | [
822,
4
] | [
843,
82
] | python | en | ['en', 'error', 'th'] | False |
BuildingMenu.open | (self) | Open the building menu for the caller.
Note:
This method should be called once when the building menu
has been instanciated. From there, the building menu will
be re-created automatically when the server
reloads/restarts, assuming `persistent` is set to `True`.
... | Open the building menu for the caller. | def open(self):
"""Open the building menu for the caller.
Note:
This method should be called once when the building menu
has been instanciated. From there, the building menu will
be re-created automatically when the server
reloads/restarts, assuming `per... | [
"def",
"open",
"(",
"self",
")",
":",
"caller",
"=",
"self",
".",
"caller",
"self",
".",
"_save",
"(",
")",
"# Remove the same-key cmdset if exists",
"if",
"caller",
".",
"cmdset",
".",
"has",
"(",
"BuildingMenuCmdSet",
")",
":",
"caller",
".",
"cmdset",
"... | [
845,
4
] | [
863,
22
] | python | en | ['en', 'en', 'en'] | True |
BuildingMenu.open_parent_menu | (self) | Open the parent menu, using `self.parents`.
Note:
You probably don't need to call this method directly,
since the caller can go back to the parent menu using the
`keys_go_back` automatically.
| Open the parent menu, using `self.parents`. | def open_parent_menu(self):
"""Open the parent menu, using `self.parents`.
Note:
You probably don't need to call this method directly,
since the caller can go back to the parent menu using the
`keys_go_back` automatically.
"""
parents = list(self.par... | [
"def",
"open_parent_menu",
"(",
"self",
")",
":",
"parents",
"=",
"list",
"(",
"self",
".",
"parents",
")",
"if",
"parents",
":",
"parent_class",
",",
"parent_obj",
",",
"parent_keys",
"=",
"parents",
"[",
"-",
"1",
"]",
"del",
"parents",
"[",
"-",
"1"... | [
865,
4
] | [
898,
43
] | python | en | ['en', 'fr', 'en'] | True |
BuildingMenu.open_submenu | (self, submenu_class, submenu_obj, parent_keys=None) |
Open a sub-menu, closing the current menu and opening the new one.
Args:
submenu_class (str): the submenu class as a Python path.
submenu_obj (Object): the object to give to the submenu.
parent_keys (list of str, optional): the parent keys when
t... |
Open a sub-menu, closing the current menu and opening the new one. | def open_submenu(self, submenu_class, submenu_obj, parent_keys=None):
"""
Open a sub-menu, closing the current menu and opening the new one.
Args:
submenu_class (str): the submenu class as a Python path.
submenu_obj (Object): the object to give to the submenu.
... | [
"def",
"open_submenu",
"(",
"self",
",",
"submenu_class",
",",
"submenu_obj",
",",
"parent_keys",
"=",
"None",
")",
":",
"parent_keys",
"=",
"parent_keys",
"or",
"[",
"]",
"parents",
"=",
"list",
"(",
"self",
".",
"parents",
")",
"parents",
".",
"append",
... | [
900,
4
] | [
940,
39
] | python | en | ['en', 'error', 'th'] | False |
BuildingMenu.move | (self, key=None, back=False, quiet=False, string="") |
Move inside the menu.
Args:
key (any): the portion of the key to add to the current
menu keys. If you wish to go back in the menu
tree, don't provide a `key`, just set `back` to `True`.
back (bool, optional): go back in the menu (`False`... |
Move inside the menu. | def move(self, key=None, back=False, quiet=False, string=""):
"""
Move inside the menu.
Args:
key (any): the portion of the key to add to the current
menu keys. If you wish to go back in the menu
tree, don't provide a `key`, just set `back` t... | [
"def",
"move",
"(",
"self",
",",
"key",
"=",
"None",
",",
"back",
"=",
"False",
",",
"quiet",
"=",
"False",
",",
"string",
"=",
"\"\"",
")",
":",
"choice",
"=",
"self",
".",
"current_choice",
"if",
"choice",
":",
"choice",
".",
"leave",
"(",
"\"\""... | [
942,
4
] | [
987,
26
] | python | en | ['en', 'error', 'th'] | False |
BuildingMenu.close | (self) | Close the building menu, removing the CmdSet. | Close the building menu, removing the CmdSet. | def close(self):
"""Close the building menu, removing the CmdSet."""
if self.caller.cmdset.has(BuildingMenuCmdSet):
self.caller.cmdset.delete(BuildingMenuCmdSet)
if self.caller.attributes.has("_building_menu"):
self.caller.attributes.remove("_building_menu")
if se... | [
"def",
"close",
"(",
"self",
")",
":",
"if",
"self",
".",
"caller",
".",
"cmdset",
".",
"has",
"(",
"BuildingMenuCmdSet",
")",
":",
"self",
".",
"caller",
".",
"cmdset",
".",
"delete",
"(",
"BuildingMenuCmdSet",
")",
"if",
"self",
".",
"caller",
".",
... | [
989,
4
] | [
996,
60
] | python | en | ['en', 'en', 'en'] | True |
BuildingMenu.display_title | (self) | Return the menu title to be displayed. | Return the menu title to be displayed. | def display_title(self):
"""Return the menu title to be displayed."""
return _call_or_get(self.title, menu=self, obj=self.obj, caller=self.caller).format(obj=self.obj) | [
"def",
"display_title",
"(",
"self",
")",
":",
"return",
"_call_or_get",
"(",
"self",
".",
"title",
",",
"menu",
"=",
"self",
",",
"obj",
"=",
"self",
".",
"obj",
",",
"caller",
"=",
"self",
".",
"caller",
")",
".",
"format",
"(",
"obj",
"=",
"self... | [
999,
4
] | [
1001,
105
] | python | en | ['en', 'en', 'en'] | True |
BuildingMenu.display_choice | (self, choice) | Display the specified choice.
Args:
choice (Choice): the menu choice.
| Display the specified choice. | def display_choice(self, choice):
"""Display the specified choice.
Args:
choice (Choice): the menu choice.
"""
title = _call_or_get(choice.title, menu=self, choice=choice, obj=self.obj, caller=self.caller)
clear_title = title.lower()
pos = clear_title.find(c... | [
"def",
"display_choice",
"(",
"self",
",",
"choice",
")",
":",
"title",
"=",
"_call_or_get",
"(",
"choice",
".",
"title",
",",
"menu",
"=",
"self",
",",
"choice",
"=",
"choice",
",",
"obj",
"=",
"self",
".",
"obj",
",",
"caller",
"=",
"self",
".",
... | [
1003,
4
] | [
1026,
18
] | python | en | ['en', 'en', 'en'] | True |
BuildingMenu.display | (self) | Display the entire menu or a single choice, depending on the keys. | Display the entire menu or a single choice, depending on the keys. | def display(self):
"""Display the entire menu or a single choice, depending on the keys."""
choice = self.current_choice
if self.keys and choice:
text = choice.format_text()
else:
text = self.display_title() + "\n"
for choice in self.relevant_choices:
... | [
"def",
"display",
"(",
"self",
")",
":",
"choice",
"=",
"self",
".",
"current_choice",
"if",
"self",
".",
"keys",
"and",
"choice",
":",
"text",
"=",
"choice",
".",
"format_text",
"(",
")",
"else",
":",
"text",
"=",
"self",
".",
"display_title",
"(",
... | [
1028,
4
] | [
1038,
29
] | python | en | ['en', 'en', 'en'] | True |
BuildingMenu.restore | (caller) | Restore the building menu for the caller.
Args:
caller (Account or Object): the caller.
Note:
This method should be automatically called if a menu is
saved in the caller, but the object itself cannot be found.
| Restore the building menu for the caller. | def restore(caller):
"""Restore the building menu for the caller.
Args:
caller (Account or Object): the caller.
Note:
This method should be automatically called if a menu is
saved in the caller, but the object itself cannot be found.
"""
men... | [
"def",
"restore",
"(",
"caller",
")",
":",
"menu",
"=",
"caller",
".",
"db",
".",
"_building_menu",
"if",
"menu",
":",
"class_name",
"=",
"menu",
".",
"get",
"(",
"\"class\"",
")",
"if",
"not",
"class_name",
":",
"log_err",
"(",
"\"BuildingMenu: on caller ... | [
1041,
4
] | [
1079,
32
] | python | en | ['en', 'en', 'en'] | True |
GenericBuildingMenu.init | (self, obj) | Build the meny, adding the 'key' and 'description' choices.
Args:
obj (Object): any object to be edited, like a character or room.
Note:
The 'quit' choice will be automatically added, though you can
call `add_choice_quit` to add this choice with different options.
... | Build the meny, adding the 'key' and 'description' choices. | def init(self, obj):
"""Build the meny, adding the 'key' and 'description' choices.
Args:
obj (Object): any object to be edited, like a character or room.
Note:
The 'quit' choice will be automatically added, though you can
call `add_choice_quit` to add this ... | [
"def",
"init",
"(",
"self",
",",
"obj",
")",
":",
"self",
".",
"add_choice",
"(",
"\"key\"",
",",
"key",
"=",
"\"k\"",
",",
"attr",
"=",
"\"key\"",
",",
"glance",
"=",
"\"{obj.key}\"",
",",
"text",
"=",
"\"\"\"\n --------------------------------... | [
1093,
4
] | [
1113,
68
] | python | en | ['en', 'en', 'en'] | True |
Stream.maxpoints | (self) |
Sets the maximum number of points to keep on the plots from an
incoming stream. If `maxpoints` is set to 50, only the newest
50 points will be displayed on the plot.
The 'maxpoints' property is a number and may be specified as:
- An int or float in the interval [0, 10000]... |
Sets the maximum number of points to keep on the plots from an
incoming stream. If `maxpoints` is set to 50, only the newest
50 points will be displayed on the plot.
The 'maxpoints' property is a number and may be specified as:
- An int or float in the interval [0, 10000] | def maxpoints(self):
"""
Sets the maximum number of points to keep on the plots from an
incoming stream. If `maxpoints` is set to 50, only the newest
50 points will be displayed on the plot.
The 'maxpoints' property is a number and may be specified as:
- An int or ... | [
"def",
"maxpoints",
"(",
"self",
")",
":",
"return",
"self",
"[",
"\"maxpoints\"",
"]"
] | [
15,
4
] | [
28,
32
] | python | en | ['en', 'error', 'th'] | False |
Stream.token | (self) |
The stream id number links a data trace on a plot with a
stream. See https://chart-studio.plotly.com/settings for more
details.
The 'token' property is a string and must be specified as:
- A non-empty string
Returns
-------
str
|
The stream id number links a data trace on a plot with a
stream. See https://chart-studio.plotly.com/settings for more
details.
The 'token' property is a string and must be specified as:
- A non-empty string | def token(self):
"""
The stream id number links a data trace on a plot with a
stream. See https://chart-studio.plotly.com/settings for more
details.
The 'token' property is a string and must be specified as:
- A non-empty string
Returns
-------
... | [
"def",
"token",
"(",
"self",
")",
":",
"return",
"self",
"[",
"\"token\"",
"]"
] | [
37,
4
] | [
50,
28
] | python | en | ['en', 'error', 'th'] | False |
Stream.__init__ | (self, arg=None, maxpoints=None, token=None, **kwargs) |
Construct a new Stream object
Parameters
----------
arg
dict of properties compatible with this constructor or
an instance of
:class:`plotly.graph_objs.choropleth.Stream`
maxpoints
Sets the maximum number of points to keep... |
Construct a new Stream object
Parameters
----------
arg
dict of properties compatible with this constructor or
an instance of
:class:`plotly.graph_objs.choropleth.Stream`
maxpoints
Sets the maximum number of points to keep... | def __init__(self, arg=None, maxpoints=None, token=None, **kwargs):
"""
Construct a new Stream object
Parameters
----------
arg
dict of properties compatible with this constructor or
an instance of
:class:`plotly.graph_objs.choropleth.... | [
"def",
"__init__",
"(",
"self",
",",
"arg",
"=",
"None",
",",
"maxpoints",
"=",
"None",
",",
"token",
"=",
"None",
",",
"*",
"*",
"kwargs",
")",
":",
"super",
"(",
"Stream",
",",
"self",
")",
".",
"__init__",
"(",
"\"stream\"",
")",
"if",
"\"_paren... | [
72,
4
] | [
140,
34
] | python | en | ['en', 'error', 'th'] | False |
format_header | (caller, entry) |
Formats a header
|
Formats a header
| def format_header(caller, entry):
"""
Formats a header
"""
width = _HEADER_WIDTH - 10
# strip all comments for the header
if caller.ndb.batch_batchmode != "batch_commands":
# only do cleanup for batchcode
entry = _RE_CODE_START.split(entry, 1)[1]
entry = _RE_COMMENT.sub(... | [
"def",
"format_header",
"(",
"caller",
",",
"entry",
")",
":",
"width",
"=",
"_HEADER_WIDTH",
"-",
"10",
"# strip all comments for the header",
"if",
"caller",
".",
"ndb",
".",
"batch_batchmode",
"!=",
"\"batch_commands\"",
":",
"# only do cleanup for batchcode",
"en... | [
87,
0
] | [
105,
17
] | python | en | ['en', 'error', 'th'] | False |
format_code | (entry) |
Formats the viewing of code and errors
|
Formats the viewing of code and errors
| def format_code(entry):
"""
Formats the viewing of code and errors
"""
code = ""
for line in entry.split('\n'):
code += "\n|G>>>|n %s" % line
return code.strip() | [
"def",
"format_code",
"(",
"entry",
")",
":",
"code",
"=",
"\"\"",
"for",
"line",
"in",
"entry",
".",
"split",
"(",
"'\\n'",
")",
":",
"code",
"+=",
"\"\\n|G>>>|n %s\"",
"%",
"line",
"return",
"code",
".",
"strip",
"(",
")"
] | [
108,
0
] | [
115,
23
] | python | en | ['en', 'error', 'th'] | False |
batch_cmd_exec | (caller) |
Helper function for executing a single batch-command entry
|
Helper function for executing a single batch-command entry
| def batch_cmd_exec(caller):
"""
Helper function for executing a single batch-command entry
"""
ptr = caller.ndb.batch_stackptr
stack = caller.ndb.batch_stack
command = stack[ptr]
caller.msg(format_header(caller, command))
try:
caller.execute_cmd(command)
except Exception:
... | [
"def",
"batch_cmd_exec",
"(",
"caller",
")",
":",
"ptr",
"=",
"caller",
".",
"ndb",
".",
"batch_stackptr",
"stack",
"=",
"caller",
".",
"ndb",
".",
"batch_stack",
"command",
"=",
"stack",
"[",
"ptr",
"]",
"caller",
".",
"msg",
"(",
"format_header",
"(",
... | [
118,
0
] | [
131,
15
] | python | en | ['en', 'error', 'th'] | False |
batch_code_exec | (caller) |
Helper function for executing a single batch-code entry
|
Helper function for executing a single batch-code entry
| def batch_code_exec(caller):
"""
Helper function for executing a single batch-code entry
"""
ptr = caller.ndb.batch_stackptr
stack = caller.ndb.batch_stack
debug = caller.ndb.batch_debug
code = stack[ptr]
caller.msg(format_header(caller, code))
err = BATCHCODE.code_exec(code,
... | [
"def",
"batch_code_exec",
"(",
"caller",
")",
":",
"ptr",
"=",
"caller",
".",
"ndb",
".",
"batch_stackptr",
"stack",
"=",
"caller",
".",
"ndb",
".",
"batch_stack",
"debug",
"=",
"caller",
".",
"ndb",
".",
"batch_debug",
"code",
"=",
"stack",
"[",
"ptr",
... | [
134,
0
] | [
149,
15
] | python | en | ['en', 'error', 'th'] | False |
step_pointer | (caller, step=1) |
Step in stack, returning the item located.
stackptr - current position in stack
stack - the stack of units
step - how many steps to move from stackptr
|
Step in stack, returning the item located. | def step_pointer(caller, step=1):
"""
Step in stack, returning the item located.
stackptr - current position in stack
stack - the stack of units
step - how many steps to move from stackptr
"""
ptr = caller.ndb.batch_stackptr
stack = caller.ndb.batch_stack
nstack = len(stack)
if ... | [
"def",
"step_pointer",
"(",
"caller",
",",
"step",
"=",
"1",
")",
":",
"ptr",
"=",
"caller",
".",
"ndb",
".",
"batch_stackptr",
"stack",
"=",
"caller",
".",
"ndb",
".",
"batch_stack",
"nstack",
"=",
"len",
"(",
"stack",
")",
"if",
"ptr",
"+",
"step",... | [
152,
0
] | [
167,
67
] | python | en | ['en', 'error', 'th'] | False |
show_curr | (caller, showall=False) |
Show the current position in stack
|
Show the current position in stack
| def show_curr(caller, showall=False):
"""
Show the current position in stack
"""
stackptr = caller.ndb.batch_stackptr
stack = caller.ndb.batch_stack
if stackptr >= len(stack):
caller.ndb.batch_stackptr = len(stack) - 1
show_curr(caller, showall)
return
entry = stack... | [
"def",
"show_curr",
"(",
"caller",
",",
"showall",
"=",
"False",
")",
":",
"stackptr",
"=",
"caller",
".",
"ndb",
".",
"batch_stackptr",
"stack",
"=",
"caller",
".",
"ndb",
".",
"batch_stack",
"if",
"stackptr",
">=",
"len",
"(",
"stack",
")",
":",
"cal... | [
170,
0
] | [
190,
22
] | python | en | ['en', 'error', 'th'] | False |
purge_processor | (caller) |
This purges all effects running
on the caller.
|
This purges all effects running
on the caller.
| def purge_processor(caller):
"""
This purges all effects running
on the caller.
"""
try:
del caller.ndb.batch_stack
del caller.ndb.batch_stackptr
del caller.ndb.batch_pythonpath
del caller.ndb.batch_batchmode
except Exception:
# something might have alread... | [
"def",
"purge_processor",
"(",
"caller",
")",
":",
"try",
":",
"del",
"caller",
".",
"ndb",
".",
"batch_stack",
"del",
"caller",
".",
"ndb",
".",
"batch_stackptr",
"del",
"caller",
".",
"ndb",
".",
"batch_pythonpath",
"del",
"caller",
".",
"ndb",
".",
"b... | [
193,
0
] | [
215,
29
] | python | en | ['en', 'error', 'th'] | False |
CmdBatchCommands.func | (self) | Starts the processor. | Starts the processor. | def func(self):
"""Starts the processor."""
caller = self.caller
args = self.args
if not args:
caller.msg("Usage: @batchcommands[/interactive] <path.to.file>")
return
python_path = self.args
# parse indata file
try:
commands... | [
"def",
"func",
"(",
"self",
")",
":",
"caller",
"=",
"self",
".",
"caller",
"args",
"=",
"self",
".",
"args",
"if",
"not",
"args",
":",
"caller",
".",
"msg",
"(",
"\"Usage: @batchcommands[/interactive] <path.to.file>\"",
")",
"return",
"python_path",
"=",
"s... | [
243,
4
] | [
326,
39
] | python | en | ['en', 'hr', 'en'] | True |
CmdBatchCode.func | (self) | Starts the processor. | Starts the processor. | def func(self):
"""Starts the processor."""
caller = self.caller
args = self.args
if not args:
caller.msg("Usage: @batchcode[/interactive/debug] <path.to.file>")
return
python_path = self.args
debug = 'debug' in self.switches
# parse ind... | [
"def",
"func",
"(",
"self",
")",
":",
"caller",
"=",
"self",
".",
"caller",
"args",
"=",
"self",
".",
"args",
"if",
"not",
"args",
":",
"caller",
".",
"msg",
"(",
"\"Usage: @batchcode[/interactive/debug] <path.to.file>\"",
")",
"return",
"python_path",
"=",
... | [
354,
4
] | [
435,
39
] | python | en | ['en', 'hr', 'en'] | True |
CmdStateAbort.func | (self) | Exit back to default. | Exit back to default. | def func(self):
"""Exit back to default."""
purge_processor(self.caller)
self.caller.msg("Exited processor and reset out active cmdset back to the default one.") | [
"def",
"func",
"(",
"self",
")",
":",
"purge_processor",
"(",
"self",
".",
"caller",
")",
"self",
".",
"caller",
".",
"msg",
"(",
"\"Exited processor and reset out active cmdset back to the default one.\"",
")"
] | [
455,
4
] | [
458,
96
] | python | en | ['it', 'en', 'en'] | True |
CmdStatePP.func | (self) |
This checks which type of processor we are running.
|
This checks which type of processor we are running.
| def func(self):
"""
This checks which type of processor we are running.
"""
caller = self.caller
if caller.ndb.batch_batchmode == "batch_code":
batch_code_exec(caller)
else:
batch_cmd_exec(caller) | [
"def",
"func",
"(",
"self",
")",
":",
"caller",
"=",
"self",
".",
"caller",
"if",
"caller",
".",
"ndb",
".",
"batch_batchmode",
"==",
"\"batch_code\"",
":",
"batch_code_exec",
"(",
"caller",
")",
"else",
":",
"batch_cmd_exec",
"(",
"caller",
")"
] | [
486,
4
] | [
494,
34
] | python | en | ['en', 'error', 'th'] | False |
BatchSafeCmdSet.at_cmdset_creation | (self) | Init the cmdset | Init the cmdset | def at_cmdset_creation(self):
"""Init the cmdset"""
self.add(CmdStateAbort()) | [
"def",
"at_cmdset_creation",
"(",
"self",
")",
":",
"self",
".",
"add",
"(",
"CmdStateAbort",
"(",
")",
")"
] | [
830,
4
] | [
832,
33
] | python | en | ['en', 'la', 'en'] | True |
BatchInteractiveCmdSet.at_cmdset_creation | (self) | init the cmdset | init the cmdset | def at_cmdset_creation(self):
"""init the cmdset"""
self.add(CmdStateAbort())
self.add(CmdStateLL())
self.add(CmdStatePP())
self.add(CmdStateRR())
self.add(CmdStateRRR())
self.add(CmdStateNN())
self.add(CmdStateNL())
self.add(CmdStateBB())
... | [
"def",
"at_cmdset_creation",
"(",
"self",
")",
":",
"self",
".",
"add",
"(",
"CmdStateAbort",
"(",
")",
")",
"self",
".",
"add",
"(",
"CmdStateLL",
"(",
")",
")",
"self",
".",
"add",
"(",
"CmdStatePP",
"(",
")",
")",
"self",
".",
"add",
"(",
"CmdSt... | [
842,
4
] | [
859,
30
] | python | en | ['en', 'la', 'en'] | True |
TestPingResponse.test_init | (self) | Test initialization. | Test initialization. | def test_init(self):
"""Test initialization."""
assert self.test_ping.comment == self.test_comment | [
"def",
"test_init",
"(",
"self",
")",
":",
"assert",
"self",
".",
"test_ping",
".",
"comment",
"==",
"self",
".",
"test_comment"
] | [
14,
4
] | [
16,
58
] | python | co | ['es', 'co', 'en'] | False |
TestPingResponse.test_deserialize | (self, mock_ping_schema_load) |
Test deserialization.
|
Test deserialization.
| def test_deserialize(self, mock_ping_schema_load):
"""
Test deserialization.
"""
obj = {"obj": "obj"}
msg = PingResponse.deserialize(obj)
mock_ping_schema_load.assert_called_once_with(obj)
assert msg is mock_ping_schema_load.return_value | [
"def",
"test_deserialize",
"(",
"self",
",",
"mock_ping_schema_load",
")",
":",
"obj",
"=",
"{",
"\"obj\"",
":",
"\"obj\"",
"}",
"msg",
"=",
"PingResponse",
".",
"deserialize",
"(",
"obj",
")",
"mock_ping_schema_load",
".",
"assert_called_once_with",
"(",
"obj",... | [
25,
4
] | [
34,
56
] | python | en | ['en', 'error', 'th'] | False |
TestPingResponse.test_serialize | (self, mock_ping_schema_load) |
Test serialization.
|
Test serialization.
| def test_serialize(self, mock_ping_schema_load):
"""
Test serialization.
"""
msg_dict = self.test_ping.serialize()
mock_ping_schema_load.assert_called_once_with(self.test_ping)
assert msg_dict is mock_ping_schema_load.return_value | [
"def",
"test_serialize",
"(",
"self",
",",
"mock_ping_schema_load",
")",
":",
"msg_dict",
"=",
"self",
".",
"test_ping",
".",
"serialize",
"(",
")",
"mock_ping_schema_load",
".",
"assert_called_once_with",
"(",
"self",
".",
"test_ping",
")",
"assert",
"msg_dict",
... | [
39,
4
] | [
46,
61
] | python | en | ['en', 'error', 'th'] | False |
Marker.line | (self) |
The 'line' property is an instance of Line
that may be specified as:
- An instance of :class:`plotly.graph_objs.choroplethmapbox.marker.Line`
- A dict of string/value properties that will be passed
to the Line constructor
Supported dict properties:
... |
The 'line' property is an instance of Line
that may be specified as:
- An instance of :class:`plotly.graph_objs.choroplethmapbox.marker.Line`
- A dict of string/value properties that will be passed
to the Line constructor
Supported dict properties:
... | def line(self):
"""
The 'line' property is an instance of Line
that may be specified as:
- An instance of :class:`plotly.graph_objs.choroplethmapbox.marker.Line`
- A dict of string/value properties that will be passed
to the Line constructor
Suppo... | [
"def",
"line",
"(",
"self",
")",
":",
"return",
"self",
"[",
"\"line\"",
"]"
] | [
15,
4
] | [
46,
27
] | python | en | ['en', 'error', 'th'] | False |
Marker.opacity | (self) |
Sets the opacity of the locations.
The 'opacity' property is a number and may be specified as:
- An int or float in the interval [0, 1]
- A tuple, list, or one-dimensional numpy array of the above
Returns
-------
int|float|numpy.ndarray
|
Sets the opacity of the locations.
The 'opacity' property is a number and may be specified as:
- An int or float in the interval [0, 1]
- A tuple, list, or one-dimensional numpy array of the above | def opacity(self):
"""
Sets the opacity of the locations.
The 'opacity' property is a number and may be specified as:
- An int or float in the interval [0, 1]
- A tuple, list, or one-dimensional numpy array of the above
Returns
-------
int|float|... | [
"def",
"opacity",
"(",
"self",
")",
":",
"return",
"self",
"[",
"\"opacity\"",
"]"
] | [
55,
4
] | [
67,
30
] | python | en | ['en', 'error', 'th'] | False |
Marker.opacitysrc | (self) |
Sets the source reference on Chart Studio Cloud for opacity .
The 'opacitysrc' 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 opacity .
The 'opacitysrc' property must be specified as a string or
as a plotly.grid_objs.Column object | def opacitysrc(self):
"""
Sets the source reference on Chart Studio Cloud for opacity .
The 'opacitysrc' property must be specified as a string or
as a plotly.grid_objs.Column object
Returns
-------
str
"""
return self["opacitysrc"] | [
"def",
"opacitysrc",
"(",
"self",
")",
":",
"return",
"self",
"[",
"\"opacitysrc\"",
"]"
] | [
76,
4
] | [
87,
33
] | python | en | ['en', 'error', 'th'] | False |
Marker.__init__ | (self, arg=None, line=None, opacity=None, opacitysrc=None, **kwargs) |
Construct a new Marker object
Parameters
----------
arg
dict of properties compatible with this constructor or
an instance of
:class:`plotly.graph_objs.choroplethmapbox.Marker`
line
:class:`plotly.graph_objects.choroplethm... |
Construct a new Marker object
Parameters
----------
arg
dict of properties compatible with this constructor or
an instance of
:class:`plotly.graph_objs.choroplethmapbox.Marker`
line
:class:`plotly.graph_objects.choroplethm... | def __init__(self, arg=None, line=None, opacity=None, opacitysrc=None, **kwargs):
"""
Construct a new Marker object
Parameters
----------
arg
dict of properties compatible with this constructor or
an instance of
:class:`plotly.graph_ob... | [
"def",
"__init__",
"(",
"self",
",",
"arg",
"=",
"None",
",",
"line",
"=",
"None",
",",
"opacity",
"=",
"None",
",",
"opacitysrc",
"=",
"None",
",",
"*",
"*",
"kwargs",
")",
":",
"super",
"(",
"Marker",
",",
"self",
")",
".",
"__init__",
"(",
"\"... | [
108,
4
] | [
179,
34
] | python | en | ['en', 'error', 'th'] | False |
TransportDecorator.__init__ | (
self,
*,
return_route: str = None,
return_route_thread: str = None,
queued_message_count: int = None,
) |
Initialize a TransportDecorator instance.
Args:
return_route: Set the return routing mode
return_route_thread: Identify the thread to enable return routing for
queued_message_count: Indicate the number of queued messages
|
Initialize a TransportDecorator instance. | def __init__(
self,
*,
return_route: str = None,
return_route_thread: str = None,
queued_message_count: int = None,
):
"""
Initialize a TransportDecorator instance.
Args:
return_route: Set the return routing mode
return_route_t... | [
"def",
"__init__",
"(",
"self",
",",
"*",
",",
"return_route",
":",
"str",
"=",
"None",
",",
"return_route_thread",
":",
"str",
"=",
"None",
",",
"queued_message_count",
":",
"int",
"=",
"None",
",",
")",
":",
"super",
"(",
"TransportDecorator",
",",
"se... | [
21,
4
] | [
39,
56
] | python | en | ['en', 'error', 'th'] | False |
build_validator_py | (node: PlotlyNode) |
Build validator class source code string for a datatype PlotlyNode
Parameters
----------
node : PlotlyNode
The datatype node (node.is_datatype must evaluate to true) for which
to build the validator class
Returns
-------
str
String containing source code for the val... |
Build validator class source code string for a datatype PlotlyNode | def build_validator_py(node: PlotlyNode):
"""
Build validator class source code string for a datatype PlotlyNode
Parameters
----------
node : PlotlyNode
The datatype node (node.is_datatype must evaluate to true) for which
to build the validator class
Returns
-------
str
... | [
"def",
"build_validator_py",
"(",
"node",
":",
"PlotlyNode",
")",
":",
"# Validate inputs",
"# ---------------",
"assert",
"node",
".",
"is_datatype",
"# Initialize source code buffer",
"# -----------------------------",
"buffer",
"=",
"StringIO",
"(",
")",
"# Imports",
"... | [
7,
0
] | [
79,
28
] | python | en | ['en', 'error', 'th'] | False |
write_validator_py | (outdir, node: PlotlyNode) |
Build validator source code and write to a file
Parameters
----------
outdir : str
Root outdir in which the validators package should reside
node : PlotlyNode
The datatype node (node.is_datatype must evaluate to true) for which
to build a validator class
Returns
---... |
Build validator source code and write to a file | def write_validator_py(outdir, node: PlotlyNode):
"""
Build validator source code and write to a file
Parameters
----------
outdir : str
Root outdir in which the validators package should reside
node : PlotlyNode
The datatype node (node.is_datatype must evaluate to true) for whi... | [
"def",
"write_validator_py",
"(",
"outdir",
",",
"node",
":",
"PlotlyNode",
")",
":",
"if",
"node",
".",
"is_mapped",
":",
"# No validator written for mapped nodes",
"# e.g. no validator for layout.titlefont since ths is mapped to",
"# layout.title.font",
"return",
"# Generate ... | [
82,
0
] | [
114,
67
] | python | en | ['en', 'error', 'th'] | False |
build_data_validator_params | (base_trace_node: TraceNode) |
Build a dict of constructor params for the DataValidator.
(This is the validator that inputs a list of traces)
Parameters
----------
base_trace_node : PlotlyNode
PlotlyNode that is the parent of all of the individual trace nodes
Returns
-------
dict
Mapping from property... |
Build a dict of constructor params for the DataValidator.
(This is the validator that inputs a list of traces)
Parameters
----------
base_trace_node : PlotlyNode
PlotlyNode that is the parent of all of the individual trace nodes
Returns
-------
dict
Mapping from property... | def build_data_validator_params(base_trace_node: TraceNode):
"""
Build a dict of constructor params for the DataValidator.
(This is the validator that inputs a list of traces)
Parameters
----------
base_trace_node : PlotlyNode
PlotlyNode that is the parent of all of the individual trace ... | [
"def",
"build_data_validator_params",
"(",
"base_trace_node",
":",
"TraceNode",
")",
":",
"# Get list of trace nodes",
"# -----------------------",
"tracetype_nodes",
"=",
"base_trace_node",
".",
"child_compound_datatypes",
"# Build class_map_repr string",
"# ------------------------... | [
117,
0
] | [
164,
17
] | python | en | ['en', 'error', 'th'] | False |
build_data_validator_py | (base_trace_node: TraceNode) |
Build source code for the DataValidator
(this is the validator that inputs a list of traces)
Parameters
----------
base_trace_node : PlotlyNode
PlotlyNode that is the parent of all of the individual trace nodes
Returns
-------
str
Source code string for DataValidator cl... |
Build source code for the DataValidator
(this is the validator that inputs a list of traces) | def build_data_validator_py(base_trace_node: TraceNode):
"""
Build source code for the DataValidator
(this is the validator that inputs a list of traces)
Parameters
----------
base_trace_node : PlotlyNode
PlotlyNode that is the parent of all of the individual trace nodes
Returns
... | [
"def",
"build_data_validator_py",
"(",
"base_trace_node",
":",
"TraceNode",
")",
":",
"# Get constructor params",
"# ----------------------",
"params",
"=",
"build_data_validator_params",
"(",
"base_trace_node",
")",
"# Build source code",
"# -----------------",
"buffer",
"=",
... | [
167,
0
] | [
206,
28
] | python | en | ['en', 'error', 'th'] | False |
get_data_validator_instance | (base_trace_node: TraceNode) |
Construct an instance of the DataValidator
(this is the validator that inputs a list of traces)
Parameters
----------
base_trace_node :
PlotlyNode that is the parent of all of the individual trace nodes
Returns
-------
BaseDataValidator
|
Construct an instance of the DataValidator
(this is the validator that inputs a list of traces) | def get_data_validator_instance(base_trace_node: TraceNode):
"""
Construct an instance of the DataValidator
(this is the validator that inputs a list of traces)
Parameters
----------
base_trace_node :
PlotlyNode that is the parent of all of the individual trace nodes
Returns
---... | [
"def",
"get_data_validator_instance",
"(",
"base_trace_node",
":",
"TraceNode",
")",
":",
"# Build constructor params",
"# ------------------------",
"# We need to eval the values to convert out of the repr-form of the",
"# params. e.g. '3' -> 3",
"params",
"=",
"build_data_validator_par... | [
209,
0
] | [
232,
72
] | python | en | ['en', 'error', 'th'] | False |
write_data_validator_py | (outdir, base_trace_node: TraceNode) |
Construct and write out the DataValidator
(this is the validator that inputs a list of traces)
Parameters
----------
outdir : str
Root outdir in which the top-level validators package should reside
base_trace_node : PlotlyNode
PlotlyNode that is the parent of all of the individ... |
Construct and write out the DataValidator
(this is the validator that inputs a list of traces) | def write_data_validator_py(outdir, base_trace_node: TraceNode):
"""
Construct and write out the DataValidator
(this is the validator that inputs a list of traces)
Parameters
----------
outdir : str
Root outdir in which the top-level validators package should reside
base_trace_node ... | [
"def",
"write_data_validator_py",
"(",
"outdir",
",",
"base_trace_node",
":",
"TraceNode",
")",
":",
"# Validate inputs",
"# ---------------",
"if",
"base_trace_node",
".",
"node_path",
":",
"raise",
"ValueError",
"(",
"\"Expected root trace node.\\n\"",
"'Received node wit... | [
235,
0
] | [
266,
57
] | python | en | ['en', 'error', 'th'] | False |
RefEvaluation.__init__ | (self, refer, Res) |
:param refer: refer class of current dataset
:param Res: [{'ref_id', 'sent'}]
|
:param refer: refer class of current dataset
:param Res: [{'ref_id', 'sent'}]
| def __init__(self, refer, Res):
"""
:param refer: refer class of current dataset
:param Res: [{'ref_id', 'sent'}]
"""
self.evalRefs = []
self.eval = {}
self.refToEval = {}
self.refer = refer
self.Res = Res | [
"def",
"__init__",
"(",
"self",
",",
"refer",
",",
"Res",
")",
":",
"self",
".",
"evalRefs",
"=",
"[",
"]",
"self",
".",
"eval",
"=",
"{",
"}",
"self",
".",
"refToEval",
"=",
"{",
"}",
"self",
".",
"refer",
"=",
"refer",
"self",
".",
"Res",
"="... | [
17,
4
] | [
26,
22
] | python | en | ['en', 'error', 'th'] | False |
Lightposition.x | (self) |
Numeric vector, representing the X coordinate for each vertex.
The 'x' property is a number and may be specified as:
- An int or float in the interval [-100000, 100000]
Returns
-------
int|float
|
Numeric vector, representing the X coordinate for each vertex.
The 'x' property is a number and may be specified as:
- An int or float in the interval [-100000, 100000] | def x(self):
"""
Numeric vector, representing the X coordinate for each vertex.
The 'x' property is a number and may be specified as:
- An int or float in the interval [-100000, 100000]
Returns
-------
int|float
"""
return self["x"] | [
"def",
"x",
"(",
"self",
")",
":",
"return",
"self",
"[",
"\"x\"",
"]"
] | [
15,
4
] | [
26,
24
] | python | en | ['en', 'error', 'th'] | False |
Lightposition.y | (self) |
Numeric vector, representing the Y coordinate for each vertex.
The 'y' property is a number and may be specified as:
- An int or float in the interval [-100000, 100000]
Returns
-------
int|float
|
Numeric vector, representing the Y coordinate for each vertex.
The 'y' property is a number and may be specified as:
- An int or float in the interval [-100000, 100000] | def y(self):
"""
Numeric vector, representing the Y coordinate for each vertex.
The 'y' property is a number and may be specified as:
- An int or float in the interval [-100000, 100000]
Returns
-------
int|float
"""
return self["y"] | [
"def",
"y",
"(",
"self",
")",
":",
"return",
"self",
"[",
"\"y\"",
"]"
] | [
35,
4
] | [
46,
24
] | python | en | ['en', 'error', 'th'] | False |
Lightposition.z | (self) |
Numeric vector, representing the Z coordinate for each vertex.
The 'z' property is a number and may be specified as:
- An int or float in the interval [-100000, 100000]
Returns
-------
int|float
|
Numeric vector, representing the Z coordinate for each vertex.
The 'z' property is a number and may be specified as:
- An int or float in the interval [-100000, 100000] | def z(self):
"""
Numeric vector, representing the Z coordinate for each vertex.
The 'z' property is a number and may be specified as:
- An int or float in the interval [-100000, 100000]
Returns
-------
int|float
"""
return self["z"] | [
"def",
"z",
"(",
"self",
")",
":",
"return",
"self",
"[",
"\"z\"",
"]"
] | [
55,
4
] | [
66,
24
] | python | en | ['en', 'error', 'th'] | False |
Lightposition.__init__ | (self, arg=None, x=None, y=None, z=None, **kwargs) |
Construct a new Lightposition object
Parameters
----------
arg
dict of properties compatible with this constructor or
an instance of
:class:`plotly.graph_objs.mesh3d.Lightposition`
x
Numeric vector, representing the X coor... |
Construct a new Lightposition object
Parameters
----------
arg
dict of properties compatible with this constructor or
an instance of
:class:`plotly.graph_objs.mesh3d.Lightposition`
x
Numeric vector, representing the X coor... | def __init__(self, arg=None, x=None, y=None, z=None, **kwargs):
"""
Construct a new Lightposition object
Parameters
----------
arg
dict of properties compatible with this constructor or
an instance of
:class:`plotly.graph_objs.mesh3d.L... | [
"def",
"__init__",
"(",
"self",
",",
"arg",
"=",
"None",
",",
"x",
"=",
"None",
",",
"y",
"=",
"None",
",",
"z",
"=",
"None",
",",
"*",
"*",
"kwargs",
")",
":",
"super",
"(",
"Lightposition",
",",
"self",
")",
".",
"__init__",
"(",
"\"lightpositi... | [
88,
4
] | [
160,
34
] | python | en | ['en', 'error', 'th'] | False |
RouteQueryRequest.__init__ | (self, *, filter: dict = None, paginate: Paginate = None, **kwargs) |
Initialize a RouteQueryRequest message instance.
Args:
filter: Filter results according to specific field values
|
Initialize a RouteQueryRequest message instance. | def __init__(self, *, filter: dict = None, paginate: Paginate = None, **kwargs):
"""
Initialize a RouteQueryRequest message instance.
Args:
filter: Filter results according to specific field values
"""
super(RouteQueryRequest, self).__init__(**kwargs)
self.f... | [
"def",
"__init__",
"(",
"self",
",",
"*",
",",
"filter",
":",
"dict",
"=",
"None",
",",
"paginate",
":",
"Paginate",
"=",
"None",
",",
"*",
"*",
"kwargs",
")",
":",
"super",
"(",
"RouteQueryRequest",
",",
"self",
")",
".",
"__init__",
"(",
"*",
"*"... | [
24,
4
] | [
34,
32
] | python | en | ['en', 'error', 'th'] | False |
format_text | (text: str, lower: bool = True) |
Space punctuation and lowercase text.
:param text:
text to lowercase
:param lower:
whether to lowercase or not
:return text:
return formatted text.
|
Space punctuation and lowercase text. | def format_text(text: str, lower: bool = True) -> str:
"""
Space punctuation and lowercase text.
:param text:
text to lowercase
:param lower:
whether to lowercase or not
:return text:
return formatted text.
"""
if lower:
text = text.lower()
for punc in P... | [
"def",
"format_text",
"(",
"text",
":",
"str",
",",
"lower",
":",
"bool",
"=",
"True",
")",
"->",
"str",
":",
"if",
"lower",
":",
"text",
"=",
"text",
".",
"lower",
"(",
")",
"for",
"punc",
"in",
"PUNCTUATION_LST",
":",
"text",
"=",
"text",
".",
... | [
30,
0
] | [
47,
15
] | python | en | ['en', 'error', 'th'] | False |
get_word_list_token | (text: str, word_lists: Tuple[List[str], List[str]]) |
Return a control token corresponding to gender within text.
:param text:
text to consider for control token
:param word_lists:
tuple of lists for male-specific and female-specific words
:return token:
return control token corresponding to input text.
|
Return a control token corresponding to gender within text. | def get_word_list_token(text: str, word_lists: Tuple[List[str], List[str]]) -> str:
"""
Return a control token corresponding to gender within text.
:param text:
text to consider for control token
:param word_lists:
tuple of lists for male-specific and female-specific words
:return ... | [
"def",
"get_word_list_token",
"(",
"text",
":",
"str",
",",
"word_lists",
":",
"Tuple",
"[",
"List",
"[",
"str",
"]",
",",
"List",
"[",
"str",
"]",
"]",
")",
"->",
"str",
":",
"m_list",
",",
"f_list",
"=",
"word_lists",
"text",
"=",
"format_text",
"(... | [
50,
0
] | [
79,
21
] | python | en | ['en', 'error', 'th'] | False |
flatten_and_classify | (
episode: List[Message],
context_length: int,
word_lists: Tuple[List[str], List[str]],
include_labels: bool = True,
delimiter: str = '\n',
) |
Flatten the dialogue history of an episode, explode into N new examples.
Additionally, add control token corresponding to gender identified in the
episode.
:param episode:
list of examples to flatten
:param context_length:
max number of utterances to use while flattening
:para... |
Flatten the dialogue history of an episode, explode into N new examples. | def flatten_and_classify(
episode: List[Message],
context_length: int,
word_lists: Tuple[List[str], List[str]],
include_labels: bool = True,
delimiter: str = '\n',
):
"""
Flatten the dialogue history of an episode, explode into N new examples.
Additionally, add control token correspondi... | [
"def",
"flatten_and_classify",
"(",
"episode",
":",
"List",
"[",
"Message",
"]",
",",
"context_length",
":",
"int",
",",
"word_lists",
":",
"Tuple",
"[",
"List",
"[",
"str",
"]",
",",
"List",
"[",
"str",
"]",
"]",
",",
"include_labels",
":",
"bool",
"=... | [
82,
0
] | [
125,
22
] | python | en | ['en', 'error', 'th'] | False |
get_original_task_module | (opt: Opt, multi_possible: bool = False) |
Returns task module of "original" task.
Original task in this case means the task we want to use
with the control teacher.
:param opt:
opt dict
:param multi_possible:
specify True if multiple tasks are possible.
:return task_module:
return module associated with task.... |
Returns task module of "original" task. | def get_original_task_module(opt: Opt, multi_possible: bool = False):
"""
Returns task module of "original" task.
Original task in this case means the task we want to use
with the control teacher.
:param opt:
opt dict
:param multi_possible:
specify True if multiple tasks are po... | [
"def",
"get_original_task_module",
"(",
"opt",
":",
"Opt",
",",
"multi_possible",
":",
"bool",
"=",
"False",
")",
":",
"modules",
"=",
"[",
"]",
"tasks",
"=",
"opt",
"[",
"'task'",
"]",
".",
"split",
"(",
"','",
")",
"if",
"not",
"multi_possible",
":",... | [
128,
0
] | [
163,
21
] | python | en | ['en', 'error', 'th'] | False |
LocalizationDecorator.__init__ | (
self,
*,
locale: str = None,
localizable: Sequence[str] = None,
catalogs: Sequence[str] = None,
) |
Initialize a LocalizationDecorator instance.
Args:
locale: The locale of this message
localizable: The fields which may be localized
catalogs: A list of URLs for localization resources
|
Initialize a LocalizationDecorator instance. | def __init__(
self,
*,
locale: str = None,
localizable: Sequence[str] = None,
catalogs: Sequence[str] = None,
):
"""
Initialize a LocalizationDecorator instance.
Args:
locale: The locale of this message
localizable: The fields ... | [
"def",
"__init__",
"(",
"self",
",",
"*",
",",
"locale",
":",
"str",
"=",
"None",
",",
"localizable",
":",
"Sequence",
"[",
"str",
"]",
"=",
"None",
",",
"catalogs",
":",
"Sequence",
"[",
"str",
"]",
"=",
"None",
",",
")",
":",
"super",
"(",
"Loc... | [
17,
4
] | [
36,
58
] | python | en | ['en', 'error', 'th'] | False |
_standardize | (orig: str) |
Standardize string given punctuation differences in the list of safe personas.
|
Standardize string given punctuation differences in the list of safe personas.
| def _standardize(orig: str) -> str:
"""
Standardize string given punctuation differences in the list of safe personas.
"""
new = orig.lower().rstrip('.!?')
string_replace = {
"i've": 'i have',
'i ve': 'i have',
'ive': 'i have',
"i'm": 'i am',
'i m': 'i am',
... | [
"def",
"_standardize",
"(",
"orig",
":",
"str",
")",
"->",
"str",
":",
"new",
"=",
"orig",
".",
"lower",
"(",
")",
".",
"rstrip",
"(",
"'.!?'",
")",
"string_replace",
"=",
"{",
"\"i've\"",
":",
"'i have'",
",",
"'i ve'",
":",
"'i have'",
",",
"'ive'"... | [
76,
0
] | [
100,
14
] | 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.