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 |
|---|---|---|---|---|---|---|---|---|---|---|---|
Hoverlabel.alignsrc | (self) |
Sets the source reference on Chart Studio Cloud for align .
The 'alignsrc' property must be specified as a string or
as a plotly.grid_objs.Column object
Returns
-------
str
|
Sets the source reference on Chart Studio Cloud for align .
The 'alignsrc' property must be specified as a string or
as a plotly.grid_objs.Column object | def alignsrc(self):
"""
Sets the source reference on Chart Studio Cloud for align .
The 'alignsrc' property must be specified as a string or
as a plotly.grid_objs.Column object
Returns
-------
str
"""
return self["alignsrc"] | [
"def",
"alignsrc",
"(",
"self",
")",
":",
"return",
"self",
"[",
"\"alignsrc\"",
"]"
] | [
49,
4
] | [
60,
31
] | python | en | ['en', 'error', 'th'] | False |
Hoverlabel.bgcolor | (self) |
Sets the background color of the hover labels for this trace
The 'bgcolor' property is a color and may be specified as:
- A hex string (e.g. '#ff0000')
- An rgb/rgba string (e.g. 'rgb(255,0,0)')
- An hsl/hsla string (e.g. 'hsl(0,100%,50%)')
- An hsv/hsva str... |
Sets the background color of the hover labels for this trace
The 'bgcolor' property is a color and may be specified as:
- A hex string (e.g. '#ff0000')
- An rgb/rgba string (e.g. 'rgb(255,0,0)')
- An hsl/hsla string (e.g. 'hsl(0,100%,50%)')
- An hsv/hsva str... | def bgcolor(self):
"""
Sets the background color of the hover labels for this trace
The 'bgcolor' property is a color and may be specified as:
- A hex string (e.g. '#ff0000')
- An rgb/rgba string (e.g. 'rgb(255,0,0)')
- An hsl/hsla string (e.g. 'hsl(0,100%,50%)... | [
"def",
"bgcolor",
"(",
"self",
")",
":",
"return",
"self",
"[",
"\"bgcolor\"",
"]"
] | [
69,
4
] | [
120,
30
] | python | en | ['en', 'error', 'th'] | False |
Hoverlabel.bgcolorsrc | (self) |
Sets the source reference on Chart Studio Cloud for bgcolor .
The 'bgcolorsrc' property must be specified as a string or
as a plotly.grid_objs.Column object
Returns
-------
str
|
Sets the source reference on Chart Studio Cloud for bgcolor .
The 'bgcolorsrc' property must be specified as a string or
as a plotly.grid_objs.Column object | def bgcolorsrc(self):
"""
Sets the source reference on Chart Studio Cloud for bgcolor .
The 'bgcolorsrc' property must be specified as a string or
as a plotly.grid_objs.Column object
Returns
-------
str
"""
return self["bgcolorsrc"] | [
"def",
"bgcolorsrc",
"(",
"self",
")",
":",
"return",
"self",
"[",
"\"bgcolorsrc\"",
"]"
] | [
129,
4
] | [
140,
33
] | python | en | ['en', 'error', 'th'] | False |
Hoverlabel.bordercolor | (self) |
Sets the border color of the hover labels for this trace.
The 'bordercolor' property is a color and may be specified as:
- A hex string (e.g. '#ff0000')
- An rgb/rgba string (e.g. 'rgb(255,0,0)')
- An hsl/hsla string (e.g. 'hsl(0,100%,50%)')
- An hsv/hsva st... |
Sets the border color of the hover labels for this trace.
The 'bordercolor' property is a color and may be specified as:
- A hex string (e.g. '#ff0000')
- An rgb/rgba string (e.g. 'rgb(255,0,0)')
- An hsl/hsla string (e.g. 'hsl(0,100%,50%)')
- An hsv/hsva st... | def bordercolor(self):
"""
Sets the border color of the hover labels for this trace.
The 'bordercolor' property is a color and may be specified as:
- A hex string (e.g. '#ff0000')
- An rgb/rgba string (e.g. 'rgb(255,0,0)')
- An hsl/hsla string (e.g. 'hsl(0,100%... | [
"def",
"bordercolor",
"(",
"self",
")",
":",
"return",
"self",
"[",
"\"bordercolor\"",
"]"
] | [
149,
4
] | [
200,
34
] | python | en | ['en', 'error', 'th'] | False |
Hoverlabel.bordercolorsrc | (self) |
Sets the source reference on Chart Studio Cloud for
bordercolor .
The 'bordercolorsrc' property must be specified as a string or
as a plotly.grid_objs.Column object
Returns
-------
str
|
Sets the source reference on Chart Studio Cloud for
bordercolor .
The 'bordercolorsrc' property must be specified as a string or
as a plotly.grid_objs.Column object | def bordercolorsrc(self):
"""
Sets the source reference on Chart Studio Cloud for
bordercolor .
The 'bordercolorsrc' property must be specified as a string or
as a plotly.grid_objs.Column object
Returns
-------
str
"""
return self["bo... | [
"def",
"bordercolorsrc",
"(",
"self",
")",
":",
"return",
"self",
"[",
"\"bordercolorsrc\"",
"]"
] | [
209,
4
] | [
221,
37
] | python | en | ['en', 'error', 'th'] | False |
Hoverlabel.font | (self) |
Sets the font used in hover labels.
The 'font' property is an instance of Font
that may be specified as:
- An instance of :class:`plotly.graph_objs.scattercarpet.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.scattercarpet.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.scattercarpet.hoverlabel.Font`
- A dict of string/value properties that will be passed
... | [
"def",
"font",
"(",
"self",
")",
":",
"return",
"self",
"[",
"\"font\"",
"]"
] | [
230,
4
] | [
277,
27
] | python | en | ['en', 'error', 'th'] | False |
Hoverlabel.namelength | (self) |
Sets the default length (in number of characters) of the trace
name in the hover labels for all traces. -1 shows the whole
name regardless of length. 0-3 shows the first 0-3 characters,
and an integer >3 will show the whole name if it is less than
that many characters, but if it... |
Sets the default length (in number of characters) of the trace
name in the hover labels for all traces. -1 shows the whole
name regardless of length. 0-3 shows the first 0-3 characters,
and an integer >3 will show the whole name if it is less than
that many characters, but if it... | def namelength(self):
"""
Sets the default length (in number of characters) of the trace
name in the hover labels for all traces. -1 shows the whole
name regardless of length. 0-3 shows the first 0-3 characters,
and an integer >3 will show the whole name if it is less than
... | [
"def",
"namelength",
"(",
"self",
")",
":",
"return",
"self",
"[",
"\"namelength\"",
"]"
] | [
286,
4
] | [
304,
33
] | python | en | ['en', 'error', 'th'] | False |
Hoverlabel.namelengthsrc | (self) |
Sets the source reference on Chart Studio Cloud for namelength
.
The 'namelengthsrc' property must be specified as a string or
as a plotly.grid_objs.Column object
Returns
-------
str
|
Sets the source reference on Chart Studio Cloud for namelength
.
The 'namelengthsrc' property must be specified as a string or
as a plotly.grid_objs.Column object | def namelengthsrc(self):
"""
Sets the source reference on Chart Studio Cloud for namelength
.
The 'namelengthsrc' property must be specified as a string or
as a plotly.grid_objs.Column object
Returns
-------
str
"""
return self["name... | [
"def",
"namelengthsrc",
"(",
"self",
")",
":",
"return",
"self",
"[",
"\"namelengthsrc\"",
"]"
] | [
313,
4
] | [
325,
36
] | python | en | ['en', 'error', 'th'] | False |
Hoverlabel.__init__ | (
self,
arg=None,
align=None,
alignsrc=None,
bgcolor=None,
bgcolorsrc=None,
bordercolor=None,
bordercolorsrc=None,
font=None,
namelength=None,
namelengthsrc=None,
**kwargs
) |
Construct a new Hoverlabel object
Parameters
----------
arg
dict of properties compatible with this constructor or
an instance of
:class:`plotly.graph_objs.scattercarpet.Hoverlabel`
align
Sets the horizontal alignment of t... |
Construct a new Hoverlabel object
Parameters
----------
arg
dict of properties compatible with this constructor or
an instance of
:class:`plotly.graph_objs.scattercarpet.Hoverlabel`
align
Sets the horizontal alignment of t... | def __init__(
self,
arg=None,
align=None,
alignsrc=None,
bgcolor=None,
bgcolorsrc=None,
bordercolor=None,
bordercolorsrc=None,
font=None,
namelength=None,
namelengthsrc=None,
**kwargs
):
"""
Construct a n... | [
"def",
"__init__",
"(",
"self",
",",
"arg",
"=",
"None",
",",
"align",
"=",
"None",
",",
"alignsrc",
"=",
"None",
",",
"bgcolor",
"=",
"None",
",",
"bgcolorsrc",
"=",
"None",
",",
"bordercolor",
"=",
"None",
",",
"bordercolorsrc",
"=",
"None",
",",
"... | [
370,
4
] | [
502,
34
] | python | en | ['en', 'error', 'th'] | False |
add_common_args | (parser) |
Add command line arguments for this agent.
|
Add command line arguments for this agent.
| def add_common_args(parser):
"""
Add command line arguments for this agent.
"""
TorchRankerAgent.add_cmdline_args(parser, partial_opt=None)
parser = parser.add_argument_group('Bert Ranker Arguments')
parser.add_argument(
'--add-transformer-layer',
type='bool',
default=Fal... | [
"def",
"add_common_args",
"(",
"parser",
")",
":",
"TorchRankerAgent",
".",
"add_cmdline_args",
"(",
"parser",
",",
"partial_opt",
"=",
"None",
")",
"parser",
"=",
"parser",
".",
"add_argument_group",
"(",
"'Bert Ranker Arguments'",
")",
"parser",
".",
"add_argume... | [
30,
0
] | [
93,
5
] | python | en | ['en', 'error', 'th'] | False |
surround | (idx_vector, start_idx, end_idx) |
Surround the vector by start_idx and end_idx.
|
Surround the vector by start_idx and end_idx.
| def surround(idx_vector, start_idx, end_idx):
"""
Surround the vector by start_idx and end_idx.
"""
start_tensor = idx_vector.new_tensor([start_idx])
end_tensor = idx_vector.new_tensor([end_idx])
return torch.cat([start_tensor, idx_vector, end_tensor], 0) | [
"def",
"surround",
"(",
"idx_vector",
",",
"start_idx",
",",
"end_idx",
")",
":",
"start_tensor",
"=",
"idx_vector",
".",
"new_tensor",
"(",
"[",
"start_idx",
"]",
")",
"end_tensor",
"=",
"idx_vector",
".",
"new_tensor",
"(",
"[",
"end_idx",
"]",
")",
"ret... | [
177,
0
] | [
183,
63
] | python | en | ['en', 'error', 'th'] | False |
BertWrapper.forward | (self, token_ids, segment_ids, attention_mask) |
Forward pass.
|
Forward pass.
| def forward(self, token_ids, segment_ids, attention_mask):
"""
Forward pass.
"""
output_bert, output_pooler = self.bert_model(
token_ids, segment_ids, attention_mask
)
# output_bert is a list of 12 (for bert base) layers.
layer_of_interest = output_ber... | [
"def",
"forward",
"(",
"self",
",",
"token_ids",
",",
"segment_ids",
",",
"attention_mask",
")",
":",
"output_bert",
",",
"output_pooler",
"=",
"self",
".",
"bert_model",
"(",
"token_ids",
",",
"segment_ids",
",",
"attention_mask",
")",
"# output_bert is a list of... | [
128,
4
] | [
174,
21
] | python | en | ['en', 'error', 'th'] | False |
MenuHandler.handle | (self, context: RequestContext, responder: BaseResponder) |
Message handler logic for action menus.
Args:
context: request context
responder: responder callback
|
Message handler logic for action menus. | async def handle(self, context: RequestContext, responder: BaseResponder):
"""
Message handler logic for action menus.
Args:
context: request context
responder: responder callback
"""
self._logger.debug("MenuHandler called with context %s", context)
... | [
"async",
"def",
"handle",
"(",
"self",
",",
"context",
":",
"RequestContext",
",",
"responder",
":",
"BaseResponder",
")",
":",
"self",
".",
"_logger",
".",
"debug",
"(",
"\"MenuHandler called with context %s\"",
",",
"context",
")",
"assert",
"isinstance",
"(",... | [
11,
4
] | [
30,
9
] | python | en | ['en', 'error', 'th'] | False |
CharacterCmdSet.at_cmdset_creation | (self) |
Populates the cmdset
|
Populates the cmdset
| def at_cmdset_creation(self):
"""
Populates the cmdset
"""
super(CharacterCmdSet, self).at_cmdset_creation() | [
"def",
"at_cmdset_creation",
"(",
"self",
")",
":",
"super",
"(",
"CharacterCmdSet",
",",
"self",
")",
".",
"at_cmdset_creation",
"(",
")"
] | [
27,
4
] | [
31,
57
] | python | en | ['en', 'error', 'th'] | False |
AccountCmdSet.at_cmdset_creation | (self) |
Populates the cmdset
|
Populates the cmdset
| def at_cmdset_creation(self):
"""
Populates the cmdset
"""
super(AccountCmdSet, self).at_cmdset_creation() | [
"def",
"at_cmdset_creation",
"(",
"self",
")",
":",
"super",
"(",
"AccountCmdSet",
",",
"self",
")",
".",
"at_cmdset_creation",
"(",
")"
] | [
46,
4
] | [
50,
55
] | python | en | ['en', 'error', 'th'] | False |
UnloggedinCmdSet.at_cmdset_creation | (self) |
Populates the cmdset
|
Populates the cmdset
| def at_cmdset_creation(self):
"""
Populates the cmdset
"""
super(UnloggedinCmdSet, self).at_cmdset_creation() | [
"def",
"at_cmdset_creation",
"(",
"self",
")",
":",
"super",
"(",
"UnloggedinCmdSet",
",",
"self",
")",
".",
"at_cmdset_creation",
"(",
")"
] | [
63,
4
] | [
67,
58
] | python | en | ['en', 'error', 'th'] | False |
SessionCmdSet.at_cmdset_creation | (self) |
This is the only method defined in a cmdset, called during
its creation. It should populate the set with command instances.
As and example we just add the empty base `Command` object.
It prints some info.
|
This is the only method defined in a cmdset, called during
its creation. It should populate the set with command instances. | def at_cmdset_creation(self):
"""
This is the only method defined in a cmdset, called during
its creation. It should populate the set with command instances.
As and example we just add the empty base `Command` object.
It prints some info.
"""
super(SessionCmdSet,... | [
"def",
"at_cmdset_creation",
"(",
"self",
")",
":",
"super",
"(",
"SessionCmdSet",
",",
"self",
")",
".",
"at_cmdset_creation",
"(",
")"
] | [
80,
4
] | [
88,
55
] | python | en | ['en', 'error', 'th'] | False |
Font.color | (self) |
The 'color' property is a color and may be specified as:
- A hex string (e.g. '#ff0000')
- An rgb/rgba string (e.g. 'rgb(255,0,0)')
- An hsl/hsla string (e.g. 'hsl(0,100%,50%)')
- An hsv/hsva string (e.g. 'hsv(0,100%,100%)')
- A named CSS color:
... |
The 'color' property is a color and may be specified as:
- A hex string (e.g. '#ff0000')
- An rgb/rgba string (e.g. 'rgb(255,0,0)')
- An hsl/hsla string (e.g. 'hsl(0,100%,50%)')
- An hsv/hsva string (e.g. 'hsv(0,100%,100%)')
- A named CSS color:
... | def color(self):
"""
The 'color' property is a color and may be specified as:
- A hex string (e.g. '#ff0000')
- An rgb/rgba string (e.g. 'rgb(255,0,0)')
- An hsl/hsla string (e.g. 'hsl(0,100%,50%)')
- An hsv/hsva string (e.g. 'hsv(0,100%,100%)')
- A name... | [
"def",
"color",
"(",
"self",
")",
":",
"return",
"self",
"[",
"\"color\"",
"]"
] | [
15,
4
] | [
64,
28
] | python | en | ['en', 'error', 'th'] | False |
Font.colorsrc | (self) |
Sets the source reference on Chart Studio Cloud for color .
The 'colorsrc' property must be specified as a string or
as a plotly.grid_objs.Column object
Returns
-------
str
|
Sets the source reference on Chart Studio Cloud for color .
The 'colorsrc' property must be specified as a string or
as a plotly.grid_objs.Column object | def colorsrc(self):
"""
Sets the source reference on Chart Studio Cloud for color .
The 'colorsrc' property must be specified as a string or
as a plotly.grid_objs.Column object
Returns
-------
str
"""
return self["colorsrc"] | [
"def",
"colorsrc",
"(",
"self",
")",
":",
"return",
"self",
"[",
"\"colorsrc\"",
"]"
] | [
73,
4
] | [
84,
31
] | python | en | ['en', 'error', 'th'] | False |
Font.family | (self) |
HTML font family - the typeface that will be applied by the web
browser. The web browser will only be able to apply a font if
it is available on the system which it operates. Provide
multiple font families, separated by commas, to indicate the
preference in which to apply fonts ... |
HTML font family - the typeface that will be applied by the web
browser. The web browser will only be able to apply a font if
it is available on the system which it operates. Provide
multiple font families, separated by commas, to indicate the
preference in which to apply fonts ... | def family(self):
"""
HTML font family - the typeface that will be applied by the web
browser. The web browser will only be able to apply a font if
it is available on the system which it operates. Provide
multiple font families, separated by commas, to indicate the
prefer... | [
"def",
"family",
"(",
"self",
")",
":",
"return",
"self",
"[",
"\"family\"",
"]"
] | [
93,
4
] | [
116,
29
] | python | en | ['en', 'error', 'th'] | False |
Font.familysrc | (self) |
Sets the source reference on Chart Studio Cloud for family .
The 'familysrc' 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 family .
The 'familysrc' property must be specified as a string or
as a plotly.grid_objs.Column object | def familysrc(self):
"""
Sets the source reference on Chart Studio Cloud for family .
The 'familysrc' property must be specified as a string or
as a plotly.grid_objs.Column object
Returns
-------
str
"""
return self["familysrc"] | [
"def",
"familysrc",
"(",
"self",
")",
":",
"return",
"self",
"[",
"\"familysrc\"",
"]"
] | [
125,
4
] | [
136,
32
] | python | en | ['en', 'error', 'th'] | False |
Font.size | (self) |
The 'size' property is a number and may be specified as:
- An int or float in the interval [1, inf]
- A tuple, list, or one-dimensional numpy array of the above
Returns
-------
int|float|numpy.ndarray
|
The 'size' property is a number and may be specified as:
- An int or float in the interval [1, inf]
- A tuple, list, or one-dimensional numpy array of the above | def size(self):
"""
The 'size' property is a number and may be specified as:
- An int or float in the interval [1, inf]
- A tuple, list, or one-dimensional numpy array of the above
Returns
-------
int|float|numpy.ndarray
"""
return self["size"... | [
"def",
"size",
"(",
"self",
")",
":",
"return",
"self",
"[",
"\"size\"",
"]"
] | [
145,
4
] | [
155,
27
] | python | en | ['en', 'error', 'th'] | False |
Font.sizesrc | (self) |
Sets the source reference on Chart Studio Cloud for size .
The 'sizesrc' 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 size .
The 'sizesrc' property must be specified as a string or
as a plotly.grid_objs.Column object | def sizesrc(self):
"""
Sets the source reference on Chart Studio Cloud for size .
The 'sizesrc' property must be specified as a string or
as a plotly.grid_objs.Column object
Returns
-------
str
"""
return self["sizesrc"] | [
"def",
"sizesrc",
"(",
"self",
")",
":",
"return",
"self",
"[",
"\"sizesrc\"",
"]"
] | [
164,
4
] | [
175,
30
] | python | en | ['en', 'error', 'th'] | False |
Font.__init__ | (
self,
arg=None,
color=None,
colorsrc=None,
family=None,
familysrc=None,
size=None,
sizesrc=None,
**kwargs
) |
Construct a new Font object
Sets the font used in hover labels.
Parameters
----------
arg
dict of properties compatible with this constructor or
an instance of
:class:`plotly.graph_objs.sankey.node.hoverlabel.Font`
color
... |
Construct a new Font object
Sets the font used in hover labels. | def __init__(
self,
arg=None,
color=None,
colorsrc=None,
family=None,
familysrc=None,
size=None,
sizesrc=None,
**kwargs
):
"""
Construct a new Font object
Sets the font used in hover labels.
Parameters
... | [
"def",
"__init__",
"(",
"self",
",",
"arg",
"=",
"None",
",",
"color",
"=",
"None",
",",
"colorsrc",
"=",
"None",
",",
"family",
"=",
"None",
",",
"familysrc",
"=",
"None",
",",
"size",
"=",
"None",
",",
"sizesrc",
"=",
"None",
",",
"*",
"*",
"kw... | [
215,
4
] | [
329,
34
] | python | en | ['en', 'error', 'th'] | False |
ANSIStringTestCase.checker | (self, ansi, raw, clean) |
Verifies the raw and clean strings of an ANSIString match expected
output.
|
Verifies the raw and clean strings of an ANSIString match expected
output.
| def checker(self, ansi, raw, clean):
"""
Verifies the raw and clean strings of an ANSIString match expected
output.
"""
self.assertEqual(unicode(ansi.clean()), clean)
self.assertEqual(unicode(ansi.raw()), raw) | [
"def",
"checker",
"(",
"self",
",",
"ansi",
",",
"raw",
",",
"clean",
")",
":",
"self",
".",
"assertEqual",
"(",
"unicode",
"(",
"ansi",
".",
"clean",
"(",
")",
")",
",",
"clean",
")",
"self",
".",
"assertEqual",
"(",
"unicode",
"(",
"ansi",
".",
... | [
12,
4
] | [
18,
50
] | python | en | ['en', 'error', 'th'] | False |
ANSIStringTestCase.table_check | (self, ansi, char, code) |
Verifies the indexes in an ANSIString match what they should.
|
Verifies the indexes in an ANSIString match what they should.
| def table_check(self, ansi, char, code):
"""
Verifies the indexes in an ANSIString match what they should.
"""
self.assertEqual(ansi._char_indexes, char)
self.assertEqual(ansi._code_indexes, code) | [
"def",
"table_check",
"(",
"self",
",",
"ansi",
",",
"char",
",",
"code",
")",
":",
"self",
".",
"assertEqual",
"(",
"ansi",
".",
"_char_indexes",
",",
"char",
")",
"self",
".",
"assertEqual",
"(",
"ansi",
".",
"_code_indexes",
",",
"code",
")"
] | [
20,
4
] | [
25,
50
] | python | en | ['en', 'error', 'th'] | False |
ANSIStringTestCase.test_instance | (self) |
Make sure the ANSIString is always constructed correctly.
|
Make sure the ANSIString is always constructed correctly.
| def test_instance(self):
"""
Make sure the ANSIString is always constructed correctly.
"""
clean = u'This isA|r testTest'
encoded = u'\x1b[1m\x1b[32mThis is\x1b[1m\x1b[31mA|r test\x1b[0mTest\x1b[0m'
target = ANSIString(r'|gThis is|rA||r test|nTest|n')
char_table =... | [
"def",
"test_instance",
"(",
"self",
")",
":",
"clean",
"=",
"u'This isA|r testTest'",
"encoded",
"=",
"u'\\x1b[1m\\x1b[32mThis is\\x1b[1m\\x1b[31mA|r test\\x1b[0mTest\\x1b[0m'",
"target",
"=",
"ANSIString",
"(",
"r'|gThis is|rA||r test|nTest|n'",
")",
"char_table",
"=",
"[",... | [
27,
4
] | [
45,
46
] | python | en | ['en', 'error', 'th'] | False |
ANSIStringTestCase.test_slice | (self) |
Verifies that slicing an ANSIString results in expected color code
distribution.
|
Verifies that slicing an ANSIString results in expected color code
distribution.
| def test_slice(self):
"""
Verifies that slicing an ANSIString results in expected color code
distribution.
"""
target = ANSIString(r'|gTest|rTest|n')
result = target[:3]
self.checker(result, u'\x1b[1m\x1b[32mTes', u'Tes')
result = target[:4]
self.c... | [
"def",
"test_slice",
"(",
"self",
")",
":",
"target",
"=",
"ANSIString",
"(",
"r'|gTest|rTest|n'",
")",
"result",
"=",
"target",
"[",
":",
"3",
"]",
"self",
".",
"checker",
"(",
"result",
",",
"u'\\x1b[1m\\x1b[32mTes'",
",",
"u'Tes'",
")",
"result",
"=",
... | [
47,
4
] | [
71,
16
] | python | en | ['en', 'error', 'th'] | False |
ANSIStringTestCase.test_split | (self) |
Verifies that re.split and .split behave similarly and that color
codes end up where they should.
|
Verifies that re.split and .split behave similarly and that color
codes end up where they should.
| def test_split(self):
"""
Verifies that re.split and .split behave similarly and that color
codes end up where they should.
"""
target = ANSIString("|gThis is |nA split string|g")
first = (u'\x1b[1m\x1b[32mThis is \x1b[0m', u'This is ')
second = (u'\x1b[1m\x1b[32m... | [
"def",
"test_split",
"(",
"self",
")",
":",
"target",
"=",
"ANSIString",
"(",
"\"|gThis is |nA split string|g\"",
")",
"first",
"=",
"(",
"u'\\x1b[1m\\x1b[32mThis is \\x1b[0m'",
",",
"u'This is '",
")",
"second",
"=",
"(",
"u'\\x1b[1m\\x1b[32m\\x1b[0m split string\\x1b[1m... | [
73,
4
] | [
87,
46
] | python | en | ['en', 'error', 'th'] | False |
ANSIStringTestCase.test_join | (self) |
Verify that joining a set of ANSIStrings works.
|
Verify that joining a set of ANSIStrings works.
| def test_join(self):
"""
Verify that joining a set of ANSIStrings works.
"""
# This isn't the desired behavior, but the expected one. Python
# concatenates the in-memory representation with the built-in string's
# join.
l = [ANSIString("|gTest|r") for _ in range(0... | [
"def",
"test_join",
"(",
"self",
")",
":",
"# This isn't the desired behavior, but the expected one. Python",
"# concatenates the in-memory representation with the built-in string's",
"# join.",
"l",
"=",
"[",
"ANSIString",
"(",
"\"|gTest|r\"",
")",
"for",
"_",
"in",
"range",
... | [
89,
4
] | [
103,
65
] | python | en | ['en', 'error', 'th'] | False |
ANSIStringTestCase.test_len | (self) |
Make sure that length reporting on ANSIStrings does not include
ANSI codes.
|
Make sure that length reporting on ANSIStrings does not include
ANSI codes.
| def test_len(self):
"""
Make sure that length reporting on ANSIStrings does not include
ANSI codes.
"""
self.assertEqual(len(ANSIString('|gTest|n')), 4) | [
"def",
"test_len",
"(",
"self",
")",
":",
"self",
".",
"assertEqual",
"(",
"len",
"(",
"ANSIString",
"(",
"'|gTest|n'",
")",
")",
",",
"4",
")"
] | [
105,
4
] | [
110,
56
] | python | en | ['en', 'error', 'th'] | False |
ANSIStringTestCase.test_capitalize | (self) |
Make sure that capitalization works. This is the simplest of the
_transform functions.
|
Make sure that capitalization works. This is the simplest of the
_transform functions.
| def test_capitalize(self):
"""
Make sure that capitalization works. This is the simplest of the
_transform functions.
"""
target = ANSIString('|gtest|n')
result = u'\x1b[1m\x1b[32mTest\x1b[0m'
self.checker(target.capitalize(), result, u'Test') | [
"def",
"test_capitalize",
"(",
"self",
")",
":",
"target",
"=",
"ANSIString",
"(",
"'|gtest|n'",
")",
"result",
"=",
"u'\\x1b[1m\\x1b[32mTest\\x1b[0m'",
"self",
".",
"checker",
"(",
"target",
".",
"capitalize",
"(",
")",
",",
"result",
",",
"u'Test'",
")"
] | [
112,
4
] | [
119,
58
] | python | en | ['en', 'error', 'th'] | False |
ANSIStringTestCase.test_mxp_agnostic | (self) |
Make sure MXP tags are not treated like ANSI codes, but normal text.
|
Make sure MXP tags are not treated like ANSI codes, but normal text.
| def test_mxp_agnostic(self):
"""
Make sure MXP tags are not treated like ANSI codes, but normal text.
"""
mxp1 = "|lclook|ltat|le"
mxp2 = "Start to |lclook here|ltclick somewhere here|le first"
self.assertEqual(15, len(ANSIString(mxp1)))
self.assertEqual(53, len(A... | [
"def",
"test_mxp_agnostic",
"(",
"self",
")",
":",
"mxp1",
"=",
"\"|lclook|ltat|le\"",
"mxp2",
"=",
"\"Start to |lclook here|ltclick somewhere here|le first\"",
"self",
".",
"assertEqual",
"(",
"15",
",",
"len",
"(",
"ANSIString",
"(",
"mxp1",
")",
")",
")",
"self... | [
121,
4
] | [
133,
57
] | python | en | ['en', 'error', 'th'] | False |
ANSIStringTestCase.test_add | (self) |
Verify concatenation works correctly.
|
Verify concatenation works correctly.
| def test_add(self):
"""
Verify concatenation works correctly.
"""
a = ANSIString("|gTest")
b = ANSIString("|cString|n")
c = a + b
result = u'\x1b[1m\x1b[32mTest\x1b[1m\x1b[36mString\x1b[0m'
self.checker(c, result, u'TestString')
char_table = [9, 10... | [
"def",
"test_add",
"(",
"self",
")",
":",
"a",
"=",
"ANSIString",
"(",
"\"|gTest\"",
")",
"b",
"=",
"ANSIString",
"(",
"\"|cString|n\"",
")",
"c",
"=",
"a",
"+",
"b",
"result",
"=",
"u'\\x1b[1m\\x1b[32mTest\\x1b[1m\\x1b[36mString\\x1b[0m'",
"self",
".",
"check... | [
135,
4
] | [
146,
51
] | python | en | ['en', 'error', 'th'] | False |
ANSIStringTestCase.test_strip | (self) |
Test the ansi-aware .strip() methods
|
Test the ansi-aware .strip() methods
| def test_strip(self):
"""
Test the ansi-aware .strip() methods
"""
a = ANSIString(" |r Test of stuff |b with spaces |n ")
b = ANSIString("|r|b")
self.assertEqual(a.strip(), ANSIString("|rTest of stuff |b with spaces|n"))
self.assertEqual(a.lstrip(), ANSISt... | [
"def",
"test_strip",
"(",
"self",
")",
":",
"a",
"=",
"ANSIString",
"(",
"\" |r Test of stuff |b with spaces |n \"",
")",
"b",
"=",
"ANSIString",
"(",
"\"|r|b\"",
")",
"self",
".",
"assertEqual",
"(",
"a",
".",
"strip",
"(",
")",
",",
"ANSIString",
"... | [
148,
4
] | [
157,
38
] | python | en | ['en', 'error', 'th'] | False |
PlotlyRenderer.__init__ | (self) | Initialize PlotlyRenderer obj.
PlotlyRenderer obj is called on by an Exporter object to draw
matplotlib objects like figures, axes, text, etc.
All class attributes are listed here in the __init__ method.
| Initialize PlotlyRenderer obj. | def __init__(self):
"""Initialize PlotlyRenderer obj.
PlotlyRenderer obj is called on by an Exporter object to draw
matplotlib objects like figures, axes, text, etc.
All class attributes are listed here in the __init__ method.
"""
self.plotly_fig = go.Figure()
... | [
"def",
"__init__",
"(",
"self",
")",
":",
"self",
".",
"plotly_fig",
"=",
"go",
".",
"Figure",
"(",
")",
"self",
".",
"mpl_fig",
"=",
"None",
"self",
".",
"current_mpl_ax",
"=",
"None",
"self",
".",
"bar_containers",
"=",
"None",
"self",
".",
"current_... | [
45,
4
] | [
63,
49
] | python | da | ['da', 'no', 'it'] | False |
PlotlyRenderer.open_figure | (self, fig, props) | Creates a new figure by beginning to fill out layout dict.
The 'autosize' key is set to false so that the figure will mirror
sizes set by mpl. The 'hovermode' key controls what shows up when you
mouse around a figure in plotly, it's set to show the 'closest' point.
Positional agurments... | Creates a new figure by beginning to fill out layout dict. | def open_figure(self, fig, props):
"""Creates a new figure by beginning to fill out layout dict.
The 'autosize' key is set to false so that the figure will mirror
sizes set by mpl. The 'hovermode' key controls what shows up when you
mouse around a figure in plotly, it's set to show the ... | [
"def",
"open_figure",
"(",
"self",
",",
"fig",
",",
"props",
")",
":",
"self",
".",
"msg",
"+=",
"\"Opening figure\\n\"",
"self",
".",
"mpl_fig",
"=",
"fig",
"self",
".",
"plotly_fig",
"[",
"\"layout\"",
"]",
"=",
"go",
".",
"Layout",
"(",
"width",
"="... | [
65,
4
] | [
97,
52
] | python | en | ['en', 'en', 'en'] | True |
PlotlyRenderer.close_figure | (self, fig) | Closes figure by cleaning up data and layout dictionaries.
The PlotlyRenderer's job is to create an appropriate set of data and
layout dictionaries. When the figure is closed, some cleanup and
repair is necessary. This method removes inappropriate dictionary
entries, freeing up Plotly t... | Closes figure by cleaning up data and layout dictionaries. | def close_figure(self, fig):
"""Closes figure by cleaning up data and layout dictionaries.
The PlotlyRenderer's job is to create an appropriate set of data and
layout dictionaries. When the figure is closed, some cleanup and
repair is necessary. This method removes inappropriate diction... | [
"def",
"close_figure",
"(",
"self",
",",
"fig",
")",
":",
"self",
".",
"plotly_fig",
"[",
"\"layout\"",
"]",
"[",
"\"showlegend\"",
"]",
"=",
"False",
"self",
".",
"msg",
"+=",
"\"Closing figure\\n\""
] | [
99,
4
] | [
113,
38
] | python | en | ['en', 'en', 'en'] | True |
PlotlyRenderer.open_axes | (self, ax, props) | Setup a new axes object (subplot in plotly).
Plotly stores information about subplots in different 'xaxis' and
'yaxis' objects which are numbered. These are just dictionaries
included in the layout dictionary. This function takes information
from the Exporter, fills in appropriate dicti... | Setup a new axes object (subplot in plotly). | def open_axes(self, ax, props):
"""Setup a new axes object (subplot in plotly).
Plotly stores information about subplots in different 'xaxis' and
'yaxis' objects which are numbered. These are just dictionaries
included in the layout dictionary. This function takes information
fr... | [
"def",
"open_axes",
"(",
"self",
",",
"ax",
",",
"props",
")",
":",
"self",
".",
"msg",
"+=",
"\" Opening axes\\n\"",
"self",
".",
"current_mpl_ax",
"=",
"ax",
"self",
".",
"bar_containers",
"=",
"[",
"c",
"for",
"c",
"in",
"ax",
".",
"containers",
"#... | [
115,
4
] | [
184,
37
] | python | en | ['en', 'mg', 'en'] | True |
PlotlyRenderer.close_axes | (self, ax) | Close the axes object and clean up.
Bars from bar charts are given to PlotlyRenderer one-by-one,
thus they need to be taken care of at the close of each axes object.
The self.current_bars variable should be empty unless a bar
chart has been created.
Positional arguments:
... | Close the axes object and clean up. | def close_axes(self, ax):
"""Close the axes object and clean up.
Bars from bar charts are given to PlotlyRenderer one-by-one,
thus they need to be taken care of at the close of each axes object.
The self.current_bars variable should be empty unless a bar
chart has been created.
... | [
"def",
"close_axes",
"(",
"self",
",",
"ax",
")",
":",
"self",
".",
"draw_bars",
"(",
"self",
".",
"current_bars",
")",
"self",
".",
"msg",
"+=",
"\" Closing axes\\n\"",
"self",
".",
"x_is_mpl_date",
"=",
"False"
] | [
186,
4
] | [
200,
34
] | python | en | ['en', 'en', 'en'] | True |
PlotlyRenderer.draw_bar | (self, coll) | Draw a collection of similar patches as a bar chart.
After bars are sorted, an appropriate data dictionary must be created
to tell plotly about this data. Just like draw_line or draw_markers,
draw_bar translates patch/path information into something plotly
understands.
Position... | Draw a collection of similar patches as a bar chart. | def draw_bar(self, coll):
"""Draw a collection of similar patches as a bar chart.
After bars are sorted, an appropriate data dictionary must be created
to tell plotly about this data. Just like draw_line or draw_markers,
draw_bar translates patch/path information into something plotly
... | [
"def",
"draw_bar",
"(",
"self",
",",
"coll",
")",
":",
"tol",
"=",
"1e-10",
"trace",
"=",
"[",
"mpltools",
".",
"make_bar",
"(",
"*",
"*",
"bar_props",
")",
"for",
"bar_props",
"in",
"coll",
"]",
"widths",
"=",
"[",
"bar_props",
"[",
"\"x1\"",
"]",
... | [
217,
4
] | [
312,
13
] | python | en | ['en', 'en', 'en'] | True |
PlotlyRenderer.draw_marked_line | (self, **props) | Create a data dict for a line obj.
This will draw 'lines', 'markers', or 'lines+markers'.
props.keys() -- [
'coordinates', ('data', 'axes', 'figure', or 'display')
'data', (a list of xy pairs)
'mplobj', (the matplotlib.lines.Line2D obj being rendered)
'la... | Create a data dict for a line obj. | def draw_marked_line(self, **props):
"""Create a data dict for a line obj.
This will draw 'lines', 'markers', or 'lines+markers'.
props.keys() -- [
'coordinates', ('data', 'axes', 'figure', or 'display')
'data', (a list of xy pairs)
'mplobj', (the matplot... | [
"def",
"draw_marked_line",
"(",
"self",
",",
"*",
"*",
"props",
")",
":",
"self",
".",
"msg",
"+=",
"\" Attempting to draw a line \"",
"line",
",",
"marker",
"=",
"{",
"}",
",",
"{",
"}",
"if",
"props",
"[",
"\"linestyle\"",
"]",
"and",
"props",
"[",
... | [
314,
4
] | [
412,
13
] | python | en | ['es', 'en', 'en'] | True |
PlotlyRenderer.draw_image | (self, **props) | Draw image.
Not implemented yet!
| Draw image. | def draw_image(self, **props):
"""Draw image.
Not implemented yet!
"""
self.msg += " Attempting to draw image\n"
self.msg += " Not drawing image\n"
warnings.warn(
"Aw. Snap! You're gonna have to hold off on "
"the selfies for now. Plotly ca... | [
"def",
"draw_image",
"(",
"self",
",",
"*",
"*",
"props",
")",
":",
"self",
".",
"msg",
"+=",
"\" Attempting to draw image\\n\"",
"self",
".",
"msg",
"+=",
"\" Not drawing image\\n\"",
"warnings",
".",
"warn",
"(",
"\"Aw. Snap! You're gonna have to hold off on \... | [
414,
4
] | [
426,
9
] | python | en | ['pl', 'ja', 'en'] | False |
PlotlyRenderer.draw_path_collection | (self, **props) | Add a path collection to data list as a scatter plot.
Current implementation defaults such collections as scatter plots.
Matplotlib supports collections that have many of the same parameters
in common like color, size, path, etc. However, they needn't all be
the same. Plotly does not cu... | Add a path collection to data list as a scatter plot. | def draw_path_collection(self, **props):
"""Add a path collection to data list as a scatter plot.
Current implementation defaults such collections as scatter plots.
Matplotlib supports collections that have many of the same parameters
in common like color, size, path, etc. However, they... | [
"def",
"draw_path_collection",
"(",
"self",
",",
"*",
"*",
"props",
")",
":",
"self",
".",
"msg",
"+=",
"\" Attempting to draw a path collection\\n\"",
"if",
"props",
"[",
"\"offset_coordinates\"",
"]",
"==",
"\"data\"",
":",
"markerstyle",
"=",
"mpltools",
"."... | [
428,
4
] | [
477,
13
] | python | en | ['en', 'en', 'en'] | True |
PlotlyRenderer.draw_path | (self, **props) | Draw path, currently only attempts to draw bar charts.
This function attempts to sort a given path into a collection of
horizontal or vertical bar charts. Most of the actual code takes
place in functions from mpltools.py.
props.keys() -- [
'data', (a list of verticies f... | Draw path, currently only attempts to draw bar charts. | def draw_path(self, **props):
"""Draw path, currently only attempts to draw bar charts.
This function attempts to sort a given path into a collection of
horizontal or vertical bar charts. Most of the actual code takes
place in functions from mpltools.py.
props.keys() -- [
... | [
"def",
"draw_path",
"(",
"self",
",",
"*",
"*",
"props",
")",
":",
"self",
".",
"msg",
"+=",
"\" Attempting to draw a path\\n\"",
"is_bar",
"=",
"mpltools",
".",
"is_bar",
"(",
"self",
".",
"current_mpl_ax",
".",
"containers",
",",
"*",
"*",
"props",
")... | [
479,
4
] | [
513,
13
] | python | en | ['en', 'en', 'en'] | True |
PlotlyRenderer.draw_text | (self, **props) | Create an annotation dict for a text obj.
Currently, plotly uses either 'page' or 'data' to reference
annotation locations. These refer to 'display' and 'data',
respectively for the 'coordinates' key used in the Exporter.
Appropriate measures are taken to transform text locations to
... | Create an annotation dict for a text obj. | def draw_text(self, **props):
"""Create an annotation dict for a text obj.
Currently, plotly uses either 'page' or 'data' to reference
annotation locations. These refer to 'display' and 'data',
respectively for the 'coordinates' key used in the Exporter.
Appropriate measures are... | [
"def",
"draw_text",
"(",
"self",
",",
"*",
"*",
"props",
")",
":",
"self",
".",
"msg",
"+=",
"\" Attempting to draw an mpl text object\\n\"",
"if",
"not",
"mpltools",
".",
"check_corners",
"(",
"props",
"[",
"\"mplobj\"",
"]",
",",
"self",
".",
"mpl_fig",
... | [
515,
4
] | [
630,
65
] | python | en | ['en', 'en', 'en'] | True |
PlotlyRenderer.draw_title | (self, **props) | Add a title to the current subplot in layout dictionary.
If there exists more than a single plot in the figure, titles revert
to 'page'-referenced annotations.
props.keys() -- [
'text', (actual content string, not the text obj)
'position', (an x, y pair, not an mpl ... | Add a title to the current subplot in layout dictionary. | def draw_title(self, **props):
"""Add a title to the current subplot in layout dictionary.
If there exists more than a single plot in the figure, titles revert
to 'page'-referenced annotations.
props.keys() -- [
'text', (actual content string, not the text obj)
... | [
"def",
"draw_title",
"(",
"self",
",",
"*",
"*",
"props",
")",
":",
"self",
".",
"msg",
"+=",
"\" Attempting to draw a title\\n\"",
"if",
"len",
"(",
"self",
".",
"mpl_fig",
".",
"axes",
")",
">",
"1",
":",
"self",
".",
"msg",
"+=",
"(",
"\" ... | [
632,
4
] | [
687,
62
] | python | en | ['en', 'en', 'en'] | True |
PlotlyRenderer.draw_xlabel | (self, **props) | Add an xaxis label to the current subplot in layout dictionary.
props.keys() -- [
'text', (actual content string, not the text obj)
'position', (an x, y pair, not an mpl Bbox)
'coordinates', ('data', 'axes', 'figure', 'display')
'text_type', ('title', 'xlabel', o... | Add an xaxis label to the current subplot in layout dictionary. | def draw_xlabel(self, **props):
"""Add an xaxis label to the current subplot in layout dictionary.
props.keys() -- [
'text', (actual content string, not the text obj)
'position', (an x, y pair, not an mpl Bbox)
'coordinates', ('data', 'axes', 'figure', 'display')
... | [
"def",
"draw_xlabel",
"(",
"self",
",",
"*",
"*",
"props",
")",
":",
"self",
".",
"msg",
"+=",
"\" Adding xlabel\\n\"",
"axis_key",
"=",
"\"xaxis{0}\"",
".",
"format",
"(",
"self",
".",
"axis_ct",
")",
"self",
".",
"plotly_fig",
"[",
"\"layout\"",
"... | [
689,
4
] | [
716,
68
] | python | en | ['en', 'en', 'en'] | True |
PlotlyRenderer.draw_ylabel | (self, **props) | Add a yaxis label to the current subplot in layout dictionary.
props.keys() -- [
'text', (actual content string, not the text obj)
'position', (an x, y pair, not an mpl Bbox)
'coordinates', ('data', 'axes', 'figure', 'display')
'text_type', ('title', 'xlabel', or... | Add a yaxis label to the current subplot in layout dictionary. | def draw_ylabel(self, **props):
"""Add a yaxis label to the current subplot in layout dictionary.
props.keys() -- [
'text', (actual content string, not the text obj)
'position', (an x, y pair, not an mpl Bbox)
'coordinates', ('data', 'axes', 'figure', 'display')
... | [
"def",
"draw_ylabel",
"(",
"self",
",",
"*",
"*",
"props",
")",
":",
"self",
".",
"msg",
"+=",
"\" Adding ylabel\\n\"",
"axis_key",
"=",
"\"yaxis{0}\"",
".",
"format",
"(",
"self",
".",
"axis_ct",
")",
"self",
".",
"plotly_fig",
"[",
"\"layout\"",
"... | [
718,
4
] | [
745,
68
] | python | en | ['en', 'en', 'en'] | True |
PlotlyRenderer.resize | (self) | Revert figure layout to allow plotly to resize.
By default, PlotlyRenderer tries its hardest to precisely mimic an
mpl figure. However, plotly is pretty good with aesthetics. By
running PlotlyRenderer.resize(), layout parameters are deleted. This
lets plotly choose them instead of mpl.
... | Revert figure layout to allow plotly to resize. | def resize(self):
"""Revert figure layout to allow plotly to resize.
By default, PlotlyRenderer tries its hardest to precisely mimic an
mpl figure. However, plotly is pretty good with aesthetics. By
running PlotlyRenderer.resize(), layout parameters are deleted. This
lets plotly... | [
"def",
"resize",
"(",
"self",
")",
":",
"self",
".",
"msg",
"+=",
"\"Resizing figure, deleting keys from layout\\n\"",
"for",
"key",
"in",
"[",
"\"width\"",
",",
"\"height\"",
",",
"\"autosize\"",
",",
"\"margin\"",
"]",
":",
"try",
":",
"del",
"self",
".",
... | [
747,
4
] | [
761,
20
] | python | en | ['en', 'en', 'en'] | True |
Font.color | (self) |
The 'color' property is a color and may be specified as:
- A hex string (e.g. '#ff0000')
- An rgb/rgba string (e.g. 'rgb(255,0,0)')
- An hsl/hsla string (e.g. 'hsl(0,100%,50%)')
- An hsv/hsva string (e.g. 'hsv(0,100%,100%)')
- A named CSS color:
... |
The 'color' property is a color and may be specified as:
- A hex string (e.g. '#ff0000')
- An rgb/rgba string (e.g. 'rgb(255,0,0)')
- An hsl/hsla string (e.g. 'hsl(0,100%,50%)')
- An hsv/hsva string (e.g. 'hsv(0,100%,100%)')
- A named CSS color:
... | def color(self):
"""
The 'color' property is a color and may be specified as:
- A hex string (e.g. '#ff0000')
- An rgb/rgba string (e.g. 'rgb(255,0,0)')
- An hsl/hsla string (e.g. 'hsl(0,100%,50%)')
- An hsv/hsva string (e.g. 'hsv(0,100%,100%)')
- A name... | [
"def",
"color",
"(",
"self",
")",
":",
"return",
"self",
"[",
"\"color\"",
"]"
] | [
15,
4
] | [
63,
28
] | python | en | ['en', 'error', 'th'] | False |
Font.family | (self) |
HTML font family - the typeface that will be applied by the web
browser. The web browser will only be able to apply a font if
it is available on the system which it operates. Provide
multiple font families, separated by commas, to indicate the
preference in which to apply fonts ... |
HTML font family - the typeface that will be applied by the web
browser. The web browser will only be able to apply a font if
it is available on the system which it operates. Provide
multiple font families, separated by commas, to indicate the
preference in which to apply fonts ... | def family(self):
"""
HTML font family - the typeface that will be applied by the web
browser. The web browser will only be able to apply a font if
it is available on the system which it operates. Provide
multiple font families, separated by commas, to indicate the
prefer... | [
"def",
"family",
"(",
"self",
")",
":",
"return",
"self",
"[",
"\"family\"",
"]"
] | [
72,
4
] | [
94,
29
] | python | en | ['en', 'error', 'th'] | False |
Font.size | (self) |
The 'size' property is a number and may be specified as:
- An int or float in the interval [1, inf]
Returns
-------
int|float
|
The 'size' property is a number and may be specified as:
- An int or float in the interval [1, inf] | def size(self):
"""
The 'size' property is a number and may be specified as:
- An int or float in the interval [1, inf]
Returns
-------
int|float
"""
return self["size"] | [
"def",
"size",
"(",
"self",
")",
":",
"return",
"self",
"[",
"\"size\"",
"]"
] | [
103,
4
] | [
112,
27
] | python | en | ['en', 'error', 'th'] | False |
Font.__init__ | (self, arg=None, color=None, family=None, size=None, **kwargs) |
Construct a new Font object
Sets this color bar's title font. Note that the title's font
used to be set by the now deprecated `titlefont` attribute.
Parameters
----------
arg
dict of properties compatible with this constructor or
an inst... |
Construct a new Font object
Sets this color bar's title font. Note that the title's font
used to be set by the now deprecated `titlefont` attribute. | def __init__(self, arg=None, color=None, family=None, size=None, **kwargs):
"""
Construct a new Font object
Sets this color bar's title font. Note that the title's font
used to be set by the now deprecated `titlefont` attribute.
Parameters
----------
arg... | [
"def",
"__init__",
"(",
"self",
",",
"arg",
"=",
"None",
",",
"color",
"=",
"None",
",",
"family",
"=",
"None",
",",
"size",
"=",
"None",
",",
"*",
"*",
"kwargs",
")",
":",
"super",
"(",
"Font",
",",
"self",
")",
".",
"__init__",
"(",
"\"font\"",... | [
143,
4
] | [
227,
34
] | python | en | ['en', 'error', 'th'] | False |
setup | (bot) |
Mandatory function to add the Cog to the bot.
|
Mandatory function to add the Cog to the bot.
| def setup(bot):
"""
Mandatory function to add the Cog to the bot.
"""
bot.add_cog(HelpCog(bot)) | [
"def",
"setup",
"(",
"bot",
")",
":",
"bot",
".",
"add_cog",
"(",
"HelpCog",
"(",
"bot",
")",
")"
] | [
478,
0
] | [
482,
29
] | python | en | ['en', 'error', 'th'] | False |
homogenize_prototype | (prototype, custom_keys=None) |
Homogenize the more free-form prototype supported pre Evennia 0.7 into the stricter form.
Args:
prototype (dict): Prototype.
custom_keys (list, optional): Custom keys which should not be interpreted as attrs, beyond
the default reserved keys.
Returns:
homogenized (dic... |
Homogenize the more free-form prototype supported pre Evennia 0.7 into the stricter form. | def homogenize_prototype(prototype, custom_keys=None):
"""
Homogenize the more free-form prototype supported pre Evennia 0.7 into the stricter form.
Args:
prototype (dict): Prototype.
custom_keys (list, optional): Custom keys which should not be interpreted as attrs, beyond
the... | [
"def",
"homogenize_prototype",
"(",
"prototype",
",",
"custom_keys",
"=",
"None",
")",
":",
"reserved",
"=",
"_PROTOTYPE_RESERVED_KEYS",
"+",
"(",
"custom_keys",
"or",
"(",
")",
")",
"attrs",
"=",
"list",
"(",
"prototype",
".",
"get",
"(",
"'attrs'",
",",
... | [
46,
0
] | [
96,
22
] | python | en | ['en', 'error', 'th'] | False |
save_prototype | (**kwargs) |
Create/Store a prototype persistently.
Kwargs:
prototype_key (str): This is required for any storage.
All other kwargs are considered part of the new prototype dict.
Returns:
prototype (dict or None): The prototype stored using the given kwargs, None if deleting.
Raises:
... |
Create/Store a prototype persistently. | def save_prototype(**kwargs):
"""
Create/Store a prototype persistently.
Kwargs:
prototype_key (str): This is required for any storage.
All other kwargs are considered part of the new prototype dict.
Returns:
prototype (dict or None): The prototype stored using the given kwargs... | [
"def",
"save_prototype",
"(",
"*",
"*",
"kwargs",
")",
":",
"kwargs",
"=",
"homogenize_prototype",
"(",
"kwargs",
")",
"def",
"_to_batchtuple",
"(",
"inp",
",",
"*",
"args",
")",
":",
"\"build tuple suitable for batch-creation\"",
"if",
"is_iter",
"(",
"inp",
... | [
149,
0
] | [
225,
37
] | python | en | ['en', 'error', 'th'] | False |
delete_prototype | (prototype_key, caller=None) |
Delete a stored prototype
Args:
key (str): The persistent prototype to delete.
caller (Account or Object, optionsl): Caller aiming to delete a prototype.
Note that no locks will be checked if`caller` is not passed.
Returns:
success (bool): If deletion worked or not.
... |
Delete a stored prototype | def delete_prototype(prototype_key, caller=None):
"""
Delete a stored prototype
Args:
key (str): The persistent prototype to delete.
caller (Account or Object, optionsl): Caller aiming to delete a prototype.
Note that no locks will be checked if`caller` is not passed.
Return... | [
"def",
"delete_prototype",
"(",
"prototype_key",
",",
"caller",
"=",
"None",
")",
":",
"if",
"prototype_key",
"in",
"_MODULE_PROTOTYPES",
":",
"mod",
"=",
"_MODULE_PROTOTYPE_MODULES",
".",
"get",
"(",
"prototype_key",
".",
"lower",
"(",
")",
",",
"\"N/A\"",
")... | [
230,
0
] | [
260,
15
] | python | en | ['en', 'error', 'th'] | False |
search_prototype | (key=None, tags=None) |
Find prototypes based on key and/or tags, or all prototypes.
Kwargs:
key (str): An exact or partial key to query for.
tags (str or list): Tag key or keys to query for. These
will always be applied with the 'db_protototype'
tag category.
Return:
matches (lis... |
Find prototypes based on key and/or tags, or all prototypes. | def search_prototype(key=None, tags=None):
"""
Find prototypes based on key and/or tags, or all prototypes.
Kwargs:
key (str): An exact or partial key to query for.
tags (str or list): Tag key or keys to query for. These
will always be applied with the 'db_protototype'
... | [
"def",
"search_prototype",
"(",
"key",
"=",
"None",
",",
"tags",
"=",
"None",
")",
":",
"# search module prototypes",
"mod_matches",
"=",
"{",
"}",
"if",
"tags",
":",
"# use tags to limit selection",
"tagset",
"=",
"set",
"(",
"tags",
")",
"mod_matches",
"=",
... | [
263,
0
] | [
331,
18
] | python | en | ['en', 'error', 'th'] | False |
search_objects_with_prototype | (prototype_key) |
Retrieve all object instances created by a given prototype.
Args:
prototype_key (str): The exact (and unique) prototype identifier to query for.
Returns:
matches (Queryset): All matching objects spawned from this prototype.
|
Retrieve all object instances created by a given prototype. | def search_objects_with_prototype(prototype_key):
"""
Retrieve all object instances created by a given prototype.
Args:
prototype_key (str): The exact (and unique) prototype identifier to query for.
Returns:
matches (Queryset): All matching objects spawned from this prototype.
"""... | [
"def",
"search_objects_with_prototype",
"(",
"prototype_key",
")",
":",
"return",
"ObjectDB",
".",
"objects",
".",
"get_by_tag",
"(",
"key",
"=",
"prototype_key",
",",
"category",
"=",
"_PROTOTYPE_TAG_CATEGORY",
")"
] | [
334,
0
] | [
345,
91
] | python | en | ['en', 'error', 'th'] | False |
list_prototypes | (caller, key=None, tags=None, show_non_use=False, show_non_edit=True) |
Collate a list of found prototypes based on search criteria and access.
Args:
caller (Account or Object): The object requesting the list.
key (str, optional): Exact or partial prototype key to query for.
tags (str or list, optional): Tag key or keys to query for.
show_non_use (... |
Collate a list of found prototypes based on search criteria and access. | def list_prototypes(caller, key=None, tags=None, show_non_use=False, show_non_edit=True):
"""
Collate a list of found prototypes based on search criteria and access.
Args:
caller (Account or Object): The object requesting the list.
key (str, optional): Exact or partial prototype key to quer... | [
"def",
"list_prototypes",
"(",
"caller",
",",
"key",
"=",
"None",
",",
"tags",
"=",
"None",
",",
"show_non_use",
"=",
"False",
",",
"show_non_edit",
"=",
"True",
")",
":",
"# this allows us to pass lists of empty strings",
"tags",
"=",
"[",
"tag",
"for",
"tag"... | [
348,
0
] | [
411,
16
] | python | en | ['en', 'error', 'th'] | False |
validate_prototype | (prototype, protkey=None, protparents=None,
is_prototype_base=True, strict=True, _flags=None) |
Run validation on a prototype, checking for inifinite regress.
Args:
prototype (dict): Prototype to validate.
protkey (str, optional): The name of the prototype definition. If not given, the prototype
dict needs to have the `prototype_key` field set.
protpartents (dict, opt... |
Run validation on a prototype, checking for inifinite regress. | def validate_prototype(prototype, protkey=None, protparents=None,
is_prototype_base=True, strict=True, _flags=None):
"""
Run validation on a prototype, checking for inifinite regress.
Args:
prototype (dict): Prototype to validate.
protkey (str, optional): The name of ... | [
"def",
"validate_prototype",
"(",
"prototype",
",",
"protkey",
"=",
"None",
",",
"protparents",
"=",
"None",
",",
"is_prototype_base",
"=",
"True",
",",
"strict",
"=",
"True",
",",
"_flags",
"=",
"None",
")",
":",
"assert",
"isinstance",
"(",
"prototype",
... | [
414,
0
] | [
519,
50
] | python | en | ['en', 'error', 'th'] | False |
protfunc_parser | (value, available_functions=None, testing=False, stacktrace=False, **kwargs) |
Parse a prototype value string for a protfunc and process it.
Available protfuncs are specified as callables in one of the modules of
`settings.PROTFUNC_MODULES`, or specified on the command line.
Args:
value (any): The value to test for a parseable protfunc. Only strings will be parsed for
... |
Parse a prototype value string for a protfunc and process it. | def protfunc_parser(value, available_functions=None, testing=False, stacktrace=False, **kwargs):
"""
Parse a prototype value string for a protfunc and process it.
Available protfuncs are specified as callables in one of the modules of
`settings.PROTFUNC_MODULES`, or specified on the command line.
... | [
"def",
"protfunc_parser",
"(",
"value",
",",
"available_functions",
"=",
"None",
",",
"testing",
"=",
"False",
",",
"stacktrace",
"=",
"False",
",",
"*",
"*",
"kwargs",
")",
":",
"if",
"not",
"isinstance",
"(",
"value",
",",
"basestring",
")",
":",
"try"... | [
533,
0
] | [
588,
17
] | python | en | ['en', 'error', 'th'] | False |
format_available_protfuncs | () |
Get all protfuncs in a pretty-formatted form.
Args:
clr (str, optional): What coloration tag to use.
|
Get all protfuncs in a pretty-formatted form. | def format_available_protfuncs():
"""
Get all protfuncs in a pretty-formatted form.
Args:
clr (str, optional): What coloration tag to use.
"""
out = []
for protfunc_name, protfunc in PROT_FUNCS.items():
out.append("- |c${name}|n - |W{docs}".format(
name=protfunc_name... | [
"def",
"format_available_protfuncs",
"(",
")",
":",
"out",
"=",
"[",
"]",
"for",
"protfunc_name",
",",
"protfunc",
"in",
"PROT_FUNCS",
".",
"items",
"(",
")",
":",
"out",
".",
"append",
"(",
"\"- |c${name}|n - |W{docs}\"",
".",
"format",
"(",
"name",
"=",
... | [
593,
0
] | [
604,
44
] | python | en | ['en', 'error', 'th'] | False |
prototype_to_str | (prototype) |
Format a prototype to a nice string representation.
Args:
prototype (dict): The prototype.
|
Format a prototype to a nice string representation. | def prototype_to_str(prototype):
"""
Format a prototype to a nice string representation.
Args:
prototype (dict): The prototype.
"""
prototype = homogenize_prototype(prototype)
header = """
|cprototype-key:|n {prototype_key}, |c-tags:|n {prototype_tags}, |c-locks:|n {prototype_locks}|n... | [
"def",
"prototype_to_str",
"(",
"prototype",
")",
":",
"prototype",
"=",
"homogenize_prototype",
"(",
"prototype",
")",
"header",
"=",
"\"\"\"\n|cprototype-key:|n {prototype_key}, |c-tags:|n {prototype_tags}, |c-locks:|n {prototype_locks}|n\n|c-desc|n: {prototype_desc}\n|cprototype-paren... | [
607,
0
] | [
678,
41
] | python | en | ['en', 'error', 'th'] | False |
check_permission | (prototype_key, action, default=True) |
Helper function to check access to actions on given prototype.
Args:
prototype_key (str): The prototype to affect.
action (str): One of "spawn" or "edit".
default (str): If action is unknown or prototype has no locks
Returns:
passes (bool): If permission for action is gran... |
Helper function to check access to actions on given prototype. | def check_permission(prototype_key, action, default=True):
"""
Helper function to check access to actions on given prototype.
Args:
prototype_key (str): The prototype to affect.
action (str): One of "spawn" or "edit".
default (str): If action is unknown or prototype has no locks
... | [
"def",
"check_permission",
"(",
"prototype_key",
",",
"action",
",",
"default",
"=",
"True",
")",
":",
"if",
"action",
"==",
"'edit'",
":",
"if",
"prototype_key",
"in",
"_MODULE_PROTOTYPES",
":",
"mod",
"=",
"_MODULE_PROTOTYPE_MODULES",
".",
"get",
"(",
"proto... | [
681,
0
] | [
711,
18
] | python | en | ['en', 'error', 'th'] | False |
init_spawn_value | (value, validator=None) |
Analyze the prototype value and produce a value useful at the point of spawning.
Args:
value (any): This can be:
callable - will be called as callable()
(callable, (args,)) - will be called as callable(*args)
other - will be assigned depending on the variable type
... |
Analyze the prototype value and produce a value useful at the point of spawning. | def init_spawn_value(value, validator=None):
"""
Analyze the prototype value and produce a value useful at the point of spawning.
Args:
value (any): This can be:
callable - will be called as callable()
(callable, (args,)) - will be called as callable(*args)
other... | [
"def",
"init_spawn_value",
"(",
"value",
",",
"validator",
"=",
"None",
")",
":",
"value",
"=",
"protfunc_parser",
"(",
"value",
")",
"validator",
"=",
"validator",
"if",
"validator",
"else",
"lambda",
"o",
":",
"o",
"if",
"callable",
"(",
"value",
")",
... | [
714,
0
] | [
739,
31
] | python | en | ['en', 'error', 'th'] | False |
value_to_obj_or_any | (value) | Convert value(s) to Object if possible, otherwise keep original value | Convert value(s) to Object if possible, otherwise keep original value | def value_to_obj_or_any(value):
"Convert value(s) to Object if possible, otherwise keep original value"
stype = type(value)
if is_iter(value):
if stype == dict:
return {value_to_obj_or_any(key):
value_to_obj_or_any(val) for key, val in value.items()}
else:
... | [
"def",
"value_to_obj_or_any",
"(",
"value",
")",
":",
"stype",
"=",
"type",
"(",
"value",
")",
"if",
"is_iter",
"(",
"value",
")",
":",
"if",
"stype",
"==",
"dict",
":",
"return",
"{",
"value_to_obj_or_any",
"(",
"key",
")",
":",
"value_to_obj_or_any",
"... | [
742,
0
] | [
752,
44
] | python | en | ['en', 'en', 'en'] | True |
value_to_obj | (value, force=True) | Always convert value(s) to Object, or None | Always convert value(s) to Object, or None | def value_to_obj(value, force=True):
"Always convert value(s) to Object, or None"
stype = type(value)
if is_iter(value):
if stype == dict:
return {value_to_obj_or_any(key): value_to_obj_or_any(val) for key, val in value.iter()}
else:
return stype([value_to_obj_or_any(... | [
"def",
"value_to_obj",
"(",
"value",
",",
"force",
"=",
"True",
")",
":",
"stype",
"=",
"type",
"(",
"value",
")",
"if",
"is_iter",
"(",
"value",
")",
":",
"if",
"stype",
"==",
"dict",
":",
"return",
"{",
"value_to_obj_or_any",
"(",
"key",
")",
":",
... | [
755,
0
] | [
763,
39
] | python | en | ['en', 'en', 'en'] | True |
DbPrototype.prototype | (self) | Make sure to decouple from db! | Make sure to decouple from db! | def prototype(self):
"Make sure to decouple from db!"
return dbserialize.deserialize(self.attributes.get('prototype', {})) | [
"def",
"prototype",
"(",
"self",
")",
":",
"return",
"dbserialize",
".",
"deserialize",
"(",
"self",
".",
"attributes",
".",
"get",
"(",
"'prototype'",
",",
"{",
"}",
")",
")"
] | [
137,
4
] | [
139,
76
] | python | en | ['en', 'en', 'en'] | True |
read_batchfile | (pythonpath, file_ending='.py') |
This reads the contents of a batch-file. Filename is considered
to be a python path to a batch file relative the directory
specified in `settings.py`.
file_ending specify which batchfile ending should be assumed (.ev
or .py). The ending should not be included in the python path.
Args:
... |
This reads the contents of a batch-file. Filename is considered
to be a python path to a batch file relative the directory
specified in `settings.py`. | def read_batchfile(pythonpath, file_ending='.py'):
"""
This reads the contents of a batch-file. Filename is considered
to be a python path to a batch file relative the directory
specified in `settings.py`.
file_ending specify which batchfile ending should be assumed (.ev
or .py). The ending sh... | [
"def",
"read_batchfile",
"(",
"pythonpath",
",",
"file_ending",
"=",
"'.py'",
")",
":",
"# find all possible absolute paths",
"abspaths",
"=",
"utils",
".",
"pypath_to_realpath",
"(",
"pythonpath",
",",
"file_ending",
",",
"settings",
".",
"BASE_BATCHPROCESS_PATHS",
"... | [
193,
0
] | [
236,
15
] | python | en | ['en', 'error', 'th'] | False |
tb_filename | (tb) | Helper to get filename from traceback | Helper to get filename from traceback | def tb_filename(tb):
"""Helper to get filename from traceback"""
return tb.tb_frame.f_code.co_filename | [
"def",
"tb_filename",
"(",
"tb",
")",
":",
"return",
"tb",
".",
"tb_frame",
".",
"f_code",
".",
"co_filename"
] | [
291,
0
] | [
293,
41
] | python | en | ['en', 'en', 'en'] | True |
tb_iter | (tb) | Traceback iterator. | Traceback iterator. | def tb_iter(tb):
"""Traceback iterator."""
while tb is not None:
yield tb
tb = tb.tb_next | [
"def",
"tb_iter",
"(",
"tb",
")",
":",
"while",
"tb",
"is",
"not",
"None",
":",
"yield",
"tb",
"tb",
"=",
"tb",
".",
"tb_next"
] | [
296,
0
] | [
300,
23
] | python | en | ['en', 'zh', 'it'] | False |
BatchCommandProcessor.parse_file | (self, pythonpath) |
This parses the lines of a batchfile according to the following
rules:
1) # at the beginning of a line marks the end of the command before
it. It is also a comment and any number of # can exist on
subsequent lines (but not inside comments).
2) #INSERT a... |
This parses the lines of a batchfile according to the following
rules:
1) # at the beginning of a line marks the end of the command before
it. It is also a comment and any number of # can exist on
subsequent lines (but not inside comments).
2) #INSERT a... | def parse_file(self, pythonpath):
"""
This parses the lines of a batchfile according to the following
rules:
1) # at the beginning of a line marks the end of the command before
it. It is also a comment and any number of # can exist on
subsequent lines (but... | [
"def",
"parse_file",
"(",
"self",
",",
"pythonpath",
")",
":",
"text",
"=",
"\"\"",
".",
"join",
"(",
"read_batchfile",
"(",
"pythonpath",
",",
"file_ending",
"=",
"'.ev'",
")",
")",
"def",
"replace_insert",
"(",
"match",
")",
":",
"\"\"\"Map replace entries... | [
251,
4
] | [
282,
23
] | python | en | ['en', 'error', 'th'] | False |
BatchCodeProcessor.parse_file | (self, pythonpath) |
This parses the lines of a batchfile according to the following
rules:
Args:
pythonpath (str): The dot-python path to the file.
Returns:
codeblocks (list): A list of all #CODE blocks, each with
prepended #HEADER data. If no #CODE blocks were fou... |
This parses the lines of a batchfile according to the following
rules: | def parse_file(self, pythonpath):
"""
This parses the lines of a batchfile according to the following
rules:
Args:
pythonpath (str): The dot-python path to the file.
Returns:
codeblocks (list): A list of all #CODE blocks, each with
prepen... | [
"def",
"parse_file",
"(",
"self",
",",
"pythonpath",
")",
":",
"text",
"=",
"\"\"",
".",
"join",
"(",
"read_batchfile",
"(",
"pythonpath",
",",
"file_ending",
"=",
"'.py'",
")",
")",
"def",
"replace_insert",
"(",
"match",
")",
":",
"\"\"\"Run parse_file on t... | [
309,
4
] | [
365,
20
] | python | en | ['en', 'error', 'th'] | False |
BatchCodeProcessor.code_exec | (self, code, extra_environ=None, debug=False) |
Execute a single code block, including imports and appending
global vars.
Args:
code (str): Code to run.
extra_environ (dict): Environment variables to run with code.
debug (bool, optional): Set the DEBUG variable in the execution
namespace.
... |
Execute a single code block, including imports and appending
global vars. | def code_exec(self, code, extra_environ=None, debug=False):
"""
Execute a single code block, including imports and appending
global vars.
Args:
code (str): Code to run.
extra_environ (dict): Environment variables to run with code.
debug (bool, optiona... | [
"def",
"code_exec",
"(",
"self",
",",
"code",
",",
"extra_environ",
"=",
"None",
",",
"debug",
"=",
"False",
")",
":",
"# define the execution environment",
"environdict",
"=",
"{",
"\"settings_module\"",
":",
"settings",
",",
"\"DEBUG\"",
":",
"debug",
"}",
"... | [
367,
4
] | [
413,
19
] | python | en | ['en', 'error', 'th'] | False |
AcceptResult.__init__ | (self, accepted: bool, retry: bool = False) | Initialize the `AcceptResult` instance. | Initialize the `AcceptResult` instance. | def __init__(self, accepted: bool, retry: bool = False):
"""Initialize the `AcceptResult` instance."""
self.accepted = accepted
self.retry = retry | [
"def",
"__init__",
"(",
"self",
",",
"accepted",
":",
"bool",
",",
"retry",
":",
"bool",
"=",
"False",
")",
":",
"self",
".",
"accepted",
"=",
"accepted",
"self",
".",
"retry",
"=",
"retry"
] | [
21,
4
] | [
24,
26
] | python | en | ['en', 'en', 'en'] | True |
AcceptResult.__bool__ | (self) | Check if the result is true. | Check if the result is true. | def __bool__(self) -> bool:
"""Check if the result is true."""
return self.accepted | [
"def",
"__bool__",
"(",
"self",
")",
"->",
"bool",
":",
"return",
"self",
".",
"accepted"
] | [
26,
4
] | [
28,
28
] | python | en | ['en', 'en', 'en'] | True |
InboundSession.__init__ | (
self,
*,
context: InjectionContext,
inbound_handler: Callable,
session_id: str,
wire_format: BaseWireFormat,
accept_undelivered: bool = False,
can_respond: bool = False,
client_info: dict = None,
close_handler: Callable = None,
re... | Initialize the inbound session. | Initialize the inbound session. | def __init__(
self,
*,
context: InjectionContext,
inbound_handler: Callable,
session_id: str,
wire_format: BaseWireFormat,
accept_undelivered: bool = False,
can_respond: bool = False,
client_info: dict = None,
close_handler: Callable = None... | [
"def",
"__init__",
"(",
"self",
",",
"*",
",",
"context",
":",
"InjectionContext",
",",
"inbound_handler",
":",
"Callable",
",",
"session_id",
":",
"str",
",",
"wire_format",
":",
"BaseWireFormat",
",",
"accept_undelivered",
":",
"bool",
"=",
"False",
",",
"... | [
34,
4
] | [
72,
36
] | python | en | ['en', 'en', 'en'] | True |
InboundSession.can_respond | (self) | Accessor for the session can-respond state. | Accessor for the session can-respond state. | def can_respond(self) -> bool:
"""Accessor for the session can-respond state."""
return self._can_respond and not self._closed | [
"def",
"can_respond",
"(",
"self",
")",
"->",
"bool",
":",
"return",
"self",
".",
"_can_respond",
"and",
"not",
"self",
".",
"_closed"
] | [
75,
4
] | [
77,
53
] | python | en | ['en', 'en', 'en'] | True |
InboundSession.can_respond | (self, can_respond: bool) | Setter for the session can-respond state. | Setter for the session can-respond state. | def can_respond(self, can_respond: bool):
"""Setter for the session can-respond state."""
self._can_respond = can_respond | [
"def",
"can_respond",
"(",
"self",
",",
"can_respond",
":",
"bool",
")",
":",
"self",
".",
"_can_respond",
"=",
"can_respond"
] | [
80,
4
] | [
82,
39
] | python | en | ['en', 'en', 'en'] | True |
InboundSession.closed | (self) | Accessor for the session closed state. | Accessor for the session closed state. | def closed(self) -> bool:
"""Accessor for the session closed state."""
return self._closed | [
"def",
"closed",
"(",
"self",
")",
"->",
"bool",
":",
"return",
"self",
".",
"_closed"
] | [
85,
4
] | [
87,
27
] | python | en | ['en', 'en', 'en'] | True |
InboundSession.close | (self) | Setter for the session closed state. | Setter for the session closed state. | def close(self):
"""Setter for the session closed state."""
self._closed = True
self.response_event.set() # end wait_response if blocked
if self.close_handler:
self.close_handler(self) | [
"def",
"close",
"(",
"self",
")",
":",
"self",
".",
"_closed",
"=",
"True",
"self",
".",
"response_event",
".",
"set",
"(",
")",
"# end wait_response if blocked",
"if",
"self",
".",
"close_handler",
":",
"self",
".",
"close_handler",
"(",
"self",
")"
] | [
89,
4
] | [
94,
36
] | python | en | ['en', 'en', 'en'] | True |
InboundSession.reply_mode | (self) | Accessor for the session reply mode. | Accessor for the session reply mode. | def reply_mode(self) -> str:
"""Accessor for the session reply mode."""
return self._reply_mode | [
"def",
"reply_mode",
"(",
"self",
")",
"->",
"str",
":",
"return",
"self",
".",
"_reply_mode"
] | [
97,
4
] | [
99,
31
] | python | en | ['en', 'en', 'en'] | True |
InboundSession.reply_mode | (self, mode: str) | Setter for the session reply mode. | Setter for the session reply mode. | def reply_mode(self, mode: str):
"""Setter for the session reply mode."""
if mode not in (
MessageReceipt.REPLY_MODE_ALL,
MessageReceipt.REPLY_MODE_THREAD,
):
mode = None
self._reply_mode = mode
if not mode:
# reset the tracked thre... | [
"def",
"reply_mode",
"(",
"self",
",",
"mode",
":",
"str",
")",
":",
"if",
"mode",
"not",
"in",
"(",
"MessageReceipt",
".",
"REPLY_MODE_ALL",
",",
"MessageReceipt",
".",
"REPLY_MODE_THREAD",
",",
")",
":",
"mode",
"=",
"None",
"self",
".",
"_reply_mode",
... | [
102,
4
] | [
112,
41
] | python | en | ['en', 'en', 'en'] | True |
InboundSession.reply_verkeys | (self) | Accessor for the reply verkeys. | Accessor for the reply verkeys. | def reply_verkeys(self):
"""Accessor for the reply verkeys."""
return self._reply_verkeys.copy() | [
"def",
"reply_verkeys",
"(",
"self",
")",
":",
"return",
"self",
".",
"_reply_verkeys",
".",
"copy",
"(",
")"
] | [
115,
4
] | [
117,
41
] | python | en | ['en', 'no', 'en'] | True |
InboundSession.reply_verkeys | (self, verkeys: Sequence[str]) | Setter for the reply verkeys. | Setter for the reply verkeys. | def reply_verkeys(self, verkeys: Sequence[str]):
"""Setter for the reply verkeys."""
self._reply_verkeys = set(verkeys) if verkeys else set() | [
"def",
"reply_verkeys",
"(",
"self",
",",
"verkeys",
":",
"Sequence",
"[",
"str",
"]",
")",
":",
"self",
".",
"_reply_verkeys",
"=",
"set",
"(",
"verkeys",
")",
"if",
"verkeys",
"else",
"set",
"(",
")"
] | [
120,
4
] | [
122,
64
] | python | en | ['en', 'no', 'en'] | True |
InboundSession.reply_thread_ids | (self) | Accessor for the reply thread IDs. | Accessor for the reply thread IDs. | def reply_thread_ids(self):
"""Accessor for the reply thread IDs."""
return self._reply_thread_ids.copy() | [
"def",
"reply_thread_ids",
"(",
"self",
")",
":",
"return",
"self",
".",
"_reply_thread_ids",
".",
"copy",
"(",
")"
] | [
125,
4
] | [
127,
44
] | python | en | ['en', 'en', 'en'] | True |
InboundSession.reply_thread_ids | (self, thread_ids: Sequence[str]) | Setter for the reply thread IDs. | Setter for the reply thread IDs. | def reply_thread_ids(self, thread_ids: Sequence[str]):
"""Setter for the reply thread IDs."""
self._reply_thread_ids = set(thread_ids) if thread_ids else set() | [
"def",
"reply_thread_ids",
"(",
"self",
",",
"thread_ids",
":",
"Sequence",
"[",
"str",
"]",
")",
":",
"self",
".",
"_reply_thread_ids",
"=",
"set",
"(",
"thread_ids",
")",
"if",
"thread_ids",
"else",
"set",
"(",
")"
] | [
130,
4
] | [
132,
73
] | python | en | ['en', 'en', 'en'] | True |
InboundSession.add_reply_thread_ids | (self, *thids) | Add a thread ID to the set of potential reply targets. | Add a thread ID to the set of potential reply targets. | def add_reply_thread_ids(self, *thids):
"""Add a thread ID to the set of potential reply targets."""
for thid in filter(None, thids):
self._reply_thread_ids.add(thid) | [
"def",
"add_reply_thread_ids",
"(",
"self",
",",
"*",
"thids",
")",
":",
"for",
"thid",
"in",
"filter",
"(",
"None",
",",
"thids",
")",
":",
"self",
".",
"_reply_thread_ids",
".",
"add",
"(",
"thid",
")"
] | [
134,
4
] | [
137,
44
] | python | en | ['en', 'en', 'en'] | True |
InboundSession.add_reply_verkeys | (self, *verkeys) | Add a verkey to the set of potential reply targets. | Add a verkey to the set of potential reply targets. | def add_reply_verkeys(self, *verkeys):
"""Add a verkey to the set of potential reply targets."""
for verkey in filter(None, verkeys):
self._reply_verkeys.add(verkey) | [
"def",
"add_reply_verkeys",
"(",
"self",
",",
"*",
"verkeys",
")",
":",
"for",
"verkey",
"in",
"filter",
"(",
"None",
",",
"verkeys",
")",
":",
"self",
".",
"_reply_verkeys",
".",
"add",
"(",
"verkey",
")"
] | [
139,
4
] | [
142,
43
] | python | en | ['en', 'en', 'en'] | True |
InboundSession.response_buffered | (self) | Check if a response is currently buffered. | Check if a response is currently buffered. | def response_buffered(self) -> bool:
"""Check if a response is currently buffered."""
return bool(self.response_buffer) | [
"def",
"response_buffered",
"(",
"self",
")",
"->",
"bool",
":",
"return",
"bool",
"(",
"self",
".",
"response_buffer",
")"
] | [
145,
4
] | [
147,
41
] | python | en | ['en', 'en', 'en'] | True |
InboundSession.process_inbound | (self, message: InboundMessage) |
Process an incoming message and update the session metadata as necessary.
Args:
message: The inbound message instance
|
Process an incoming message and update the session metadata as necessary. | def process_inbound(self, message: InboundMessage):
"""
Process an incoming message and update the session metadata as necessary.
Args:
message: The inbound message instance
"""
receipt = message.receipt
mode = self.reply_mode = (
receipt.direct_r... | [
"def",
"process_inbound",
"(",
"self",
",",
"message",
":",
"InboundMessage",
")",
":",
"receipt",
"=",
"message",
".",
"receipt",
"mode",
"=",
"self",
".",
"reply_mode",
"=",
"(",
"receipt",
".",
"direct_response_requested",
"and",
"receipt",
".",
"direct_res... | [
149,
4
] | [
162,
56
] | python | en | ['en', 'error', 'th'] | False |
InboundSession.parse_inbound | (self, payload_enc: Union[str, bytes]) | Convert a message payload and to an inbound message. | Convert a message payload and to an inbound message. | async def parse_inbound(self, payload_enc: Union[str, bytes]) -> InboundMessage:
"""Convert a message payload and to an inbound message."""
payload, receipt = await self.wire_format.parse_message(
self.context, payload_enc
)
return InboundMessage(
payload,
... | [
"async",
"def",
"parse_inbound",
"(",
"self",
",",
"payload_enc",
":",
"Union",
"[",
"str",
",",
"bytes",
"]",
")",
"->",
"InboundMessage",
":",
"payload",
",",
"receipt",
"=",
"await",
"self",
".",
"wire_format",
".",
"parse_message",
"(",
"self",
".",
... | [
164,
4
] | [
174,
9
] | python | en | ['en', 'en', 'en'] | True |
InboundSession.receive | (self, payload_enc: Union[str, bytes]) | Receive a new message payload and dispatch the message. | Receive a new message payload and dispatch the message. | async def receive(self, payload_enc: Union[str, bytes]) -> InboundMessage:
"""Receive a new message payload and dispatch the message."""
message = await self.parse_inbound(payload_enc)
self.receive_inbound(message)
return message | [
"async",
"def",
"receive",
"(",
"self",
",",
"payload_enc",
":",
"Union",
"[",
"str",
",",
"bytes",
"]",
")",
"->",
"InboundMessage",
":",
"message",
"=",
"await",
"self",
".",
"parse_inbound",
"(",
"payload_enc",
")",
"self",
".",
"receive_inbound",
"(",
... | [
176,
4
] | [
180,
22
] | python | en | ['en', 'en', 'en'] | True |
InboundSession.receive_inbound | (self, message: InboundMessage) | Deliver the inbound message to the conductor. | Deliver the inbound message to the conductor. | def receive_inbound(self, message: InboundMessage):
"""Deliver the inbound message to the conductor."""
self.process_inbound(message)
self.inbound_handler(message, can_respond=self.can_respond) | [
"def",
"receive_inbound",
"(",
"self",
",",
"message",
":",
"InboundMessage",
")",
":",
"self",
".",
"process_inbound",
"(",
"message",
")",
"self",
".",
"inbound_handler",
"(",
"message",
",",
"can_respond",
"=",
"self",
".",
"can_respond",
")"
] | [
182,
4
] | [
185,
67
] | python | en | ['en', 'en', 'en'] | True |
InboundSession.select_outbound | (self, message: OutboundMessage) | Determine if an outbound message should be sent to this session.
Args:
message: The outbound message to be checked
| Determine if an outbound message should be sent to this session. | def select_outbound(self, message: OutboundMessage) -> bool:
"""Determine if an outbound message should be sent to this session.
Args:
message: The outbound message to be checked
"""
if not self.can_respond:
return False
mode = self.reply_mode
r... | [
"def",
"select_outbound",
"(",
"self",
",",
"message",
":",
"OutboundMessage",
")",
"->",
"bool",
":",
"if",
"not",
"self",
".",
"can_respond",
":",
"return",
"False",
"mode",
"=",
"self",
".",
"reply_mode",
"reply_verkey",
"=",
"message",
".",
"reply_to_ver... | [
187,
4
] | [
211,
20
] | python | en | ['en', 'en', 'en'] | True |
InboundSession.encode_outbound | (self, outbound: OutboundMessage) | Apply wire formatting to an outbound message. | Apply wire formatting to an outbound message. | async def encode_outbound(self, outbound: OutboundMessage) -> OutboundMessage:
"""Apply wire formatting to an outbound message."""
if not outbound.payload:
raise WireFormatError("Message has no payload to encode")
if not outbound.reply_to_verkey:
raise WireFormatError("No... | [
"async",
"def",
"encode_outbound",
"(",
"self",
",",
"outbound",
":",
"OutboundMessage",
")",
"->",
"OutboundMessage",
":",
"if",
"not",
"outbound",
".",
"payload",
":",
"raise",
"WireFormatError",
"(",
"\"Message has no payload to encode\"",
")",
"if",
"not",
"ou... | [
213,
4
] | [
226,
9
] | python | en | ['en', 'en', 'en'] | True |
InboundSession.accept_response | (self, message: OutboundMessage) |
Try to queue an outbound message if it applies to this session.
Returns: a tuple of (message buffered, retry later)
|
Try to queue an outbound message if it applies to this session. | def accept_response(self, message: OutboundMessage) -> AcceptResult:
"""
Try to queue an outbound message if it applies to this session.
Returns: a tuple of (message buffered, retry later)
"""
if not self.select_outbound(message):
return AcceptResult(False, False)
... | [
"def",
"accept_response",
"(",
"self",
",",
"message",
":",
"OutboundMessage",
")",
"->",
"AcceptResult",
":",
"if",
"not",
"self",
".",
"select_outbound",
"(",
"message",
")",
":",
"return",
"AcceptResult",
"(",
"False",
",",
"False",
")",
"if",
"self",
"... | [
228,
4
] | [
239,
33
] | python | en | ['en', 'error', 'th'] | False |
InboundSession.set_response | (self, message: OutboundMessage) | Set the contents of the response message buffer. | Set the contents of the response message buffer. | def set_response(self, message: OutboundMessage):
"""Set the contents of the response message buffer."""
self.response_buffer = message
self.response_event.set() | [
"def",
"set_response",
"(",
"self",
",",
"message",
":",
"OutboundMessage",
")",
":",
"self",
".",
"response_buffer",
"=",
"message",
"self",
".",
"response_event",
".",
"set",
"(",
")"
] | [
241,
4
] | [
244,
33
] | python | en | ['en', 'en', 'en'] | True |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.