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 |
|---|---|---|---|---|---|---|---|---|---|---|---|
CacheKeyLock.set_result | (self, value: Any, ttl: int = None) | Set the result, updating the cache and any waiters. | Set the result, updating the cache and any waiters. | async def set_result(self, value: Any, ttl: int = None):
"""Set the result, updating the cache and any waiters."""
if self.done and value:
raise CacheError("Result already set")
self._future.set_result(value)
if not self._parent or self._parent.done:
await self.ca... | [
"async",
"def",
"set_result",
"(",
"self",
",",
"value",
":",
"Any",
",",
"ttl",
":",
"int",
"=",
"None",
")",
":",
"if",
"self",
".",
"done",
"and",
"value",
":",
"raise",
"CacheError",
"(",
"\"Result already set\"",
")",
"self",
".",
"_future",
".",
... | [
127,
4
] | [
133,
54
] | python | en | ['en', 'en', 'en'] | True |
CacheKeyLock.__await__ | (self) | Wait for a result to be produced. | Wait for a result to be produced. | def __await__(self):
"""Wait for a result to be produced."""
return (yield from self._future) | [
"def",
"__await__",
"(",
"self",
")",
":",
"return",
"(",
"yield",
"from",
"self",
".",
"_future",
")"
] | [
135,
4
] | [
137,
40
] | python | en | ['en', 'en', 'en'] | True |
CacheKeyLock.__aenter__ | (self) | Async context manager entry. | Async context manager entry. | async def __aenter__(self):
"""Async context manager entry."""
result = None
if self.parent:
result = await self.parent
if result:
await self # wait for parent's done handler to complete
if not result:
found = await self.cache.get(self... | [
"async",
"def",
"__aenter__",
"(",
"self",
")",
":",
"result",
"=",
"None",
"if",
"self",
".",
"parent",
":",
"result",
"=",
"await",
"self",
".",
"parent",
"if",
"result",
":",
"await",
"self",
"# wait for parent's done handler to complete",
"if",
"not",
"r... | [
139,
4
] | [
150,
19
] | python | en | ['fr', 'gl', 'en'] | False |
CacheKeyLock.release | (self) | Release the cache lock. | Release the cache lock. | def release(self):
"""Release the cache lock."""
if not self.parent and not self.released:
self.cache.release(self.key)
self.released = True | [
"def",
"release",
"(",
"self",
")",
":",
"if",
"not",
"self",
".",
"parent",
"and",
"not",
"self",
".",
"released",
":",
"self",
".",
"cache",
".",
"release",
"(",
"self",
".",
"key",
")",
"self",
".",
"released",
"=",
"True"
] | [
152,
4
] | [
156,
32
] | python | en | ['en', 'it', 'en'] | True |
CacheKeyLock.__aexit__ | (self, exc_type, exc_val, exc_tb) |
Async context manager exit.
`None` is returned to any waiters if no value is produced.
|
Async context manager exit. | async def __aexit__(self, exc_type, exc_val, exc_tb):
"""
Async context manager exit.
`None` is returned to any waiters if no value is produced.
"""
if exc_val:
self.exception = exc_val
if not self.done:
self._future.set_result(None)
self.... | [
"async",
"def",
"__aexit__",
"(",
"self",
",",
"exc_type",
",",
"exc_val",
",",
"exc_tb",
")",
":",
"if",
"exc_val",
":",
"self",
".",
"exception",
"=",
"exc_val",
"if",
"not",
"self",
".",
"done",
":",
"self",
".",
"_future",
".",
"set_result",
"(",
... | [
158,
4
] | [
168,
22
] | python | en | ['en', 'error', 'th'] | False |
CacheKeyLock.__del__ | (self) | Handle deletion. | Handle deletion. | def __del__(self):
"""Handle deletion."""
self.release() | [
"def",
"__del__",
"(",
"self",
")",
":",
"self",
".",
"release",
"(",
")"
] | [
170,
4
] | [
172,
22
] | python | en | ['it', 'es', 'en'] | False |
parse_ansi | (string, strip_ansi=False, parser=ANSI_PARSER, xterm256=False, mxp=False) |
Parses a string, subbing color codes as needed.
Args:
string (str): The string to parse.
strip_ansi (bool, optional): Strip all ANSI sequences.
parser (ansi.AnsiParser, optional): A parser instance to use.
xterm256 (bool, optional): Support xterm256 or not.
mxp (bool, o... |
Parses a string, subbing color codes as needed. | def parse_ansi(string, strip_ansi=False, parser=ANSI_PARSER, xterm256=False, mxp=False):
"""
Parses a string, subbing color codes as needed.
Args:
string (str): The string to parse.
strip_ansi (bool, optional): Strip all ANSI sequences.
parser (ansi.AnsiParser, optional): A parser i... | [
"def",
"parse_ansi",
"(",
"string",
",",
"strip_ansi",
"=",
"False",
",",
"parser",
"=",
"ANSI_PARSER",
",",
"xterm256",
"=",
"False",
",",
"mxp",
"=",
"False",
")",
":",
"return",
"parser",
".",
"parse_ansi",
"(",
"string",
",",
"strip_ansi",
"=",
"stri... | [
468,
0
] | [
483,
87
] | python | en | ['en', 'error', 'th'] | False |
strip_ansi | (string, parser=ANSI_PARSER) |
Strip all ansi from the string. This handles the Evennia-specific
markup.
Args:
string (str): The string to strip.
parser (ansi.AnsiParser, optional): The parser to use.
Returns:
string (str): The stripped string.
|
Strip all ansi from the string. This handles the Evennia-specific
markup. | def strip_ansi(string, parser=ANSI_PARSER):
"""
Strip all ansi from the string. This handles the Evennia-specific
markup.
Args:
string (str): The string to strip.
parser (ansi.AnsiParser, optional): The parser to use.
Returns:
string (str): The stripped string.
"""
... | [
"def",
"strip_ansi",
"(",
"string",
",",
"parser",
"=",
"ANSI_PARSER",
")",
":",
"return",
"parser",
".",
"parse_ansi",
"(",
"string",
",",
"strip_ansi",
"=",
"True",
")"
] | [
486,
0
] | [
499,
53
] | python | en | ['en', 'error', 'th'] | False |
strip_raw_ansi | (string, parser=ANSI_PARSER) |
Remove raw ansi codes from string. This assumes pure
ANSI-bytecodes in the string.
Args:
string (str): The string to parse.
parser (bool, optional): The parser to use.
Returns:
string (str): the stripped string.
|
Remove raw ansi codes from string. This assumes pure
ANSI-bytecodes in the string. | def strip_raw_ansi(string, parser=ANSI_PARSER):
"""
Remove raw ansi codes from string. This assumes pure
ANSI-bytecodes in the string.
Args:
string (str): The string to parse.
parser (bool, optional): The parser to use.
Returns:
string (str): the stripped string.
"""
... | [
"def",
"strip_raw_ansi",
"(",
"string",
",",
"parser",
"=",
"ANSI_PARSER",
")",
":",
"return",
"parser",
".",
"strip_raw_codes",
"(",
"string",
")"
] | [
502,
0
] | [
515,
41
] | python | en | ['en', 'error', 'th'] | False |
raw | (string) |
Escapes a string into a form which won't be colorized by the ansi
parser.
Returns:
string (str): The raw, escaped string.
|
Escapes a string into a form which won't be colorized by the ansi
parser. | def raw(string):
"""
Escapes a string into a form which won't be colorized by the ansi
parser.
Returns:
string (str): The raw, escaped string.
"""
return string.replace('{', '{{').replace('|', '||') | [
"def",
"raw",
"(",
"string",
")",
":",
"return",
"string",
".",
"replace",
"(",
"'{'",
",",
"'{{'",
")",
".",
"replace",
"(",
"'|'",
",",
"'||'",
")"
] | [
518,
0
] | [
527,
55
] | python | en | ['en', 'error', 'th'] | False |
_spacing_preflight | (func) |
This wrapper function is used to do some preflight checks on
functions used for padding ANSIStrings.
|
This wrapper function is used to do some preflight checks on
functions used for padding ANSIStrings. | def _spacing_preflight(func):
"""
This wrapper function is used to do some preflight checks on
functions used for padding ANSIStrings.
"""
def wrapped(self, width, fillchar=None):
if fillchar is None:
fillchar = " "
if (len(fillchar) != 1) or (not isinstance(fillchar, b... | [
"def",
"_spacing_preflight",
"(",
"func",
")",
":",
"def",
"wrapped",
"(",
"self",
",",
"width",
",",
"fillchar",
"=",
"None",
")",
":",
"if",
"fillchar",
"is",
"None",
":",
"fillchar",
"=",
"\" \"",
"if",
"(",
"len",
"(",
"fillchar",
")",
"!=",
"1",... | [
530,
0
] | [
548,
18
] | python | en | ['en', 'error', 'th'] | False |
_query_super | (func_name) |
Have the string class handle this with the cleaned string instead
of ANSIString.
|
Have the string class handle this with the cleaned string instead
of ANSIString. | def _query_super(func_name):
"""
Have the string class handle this with the cleaned string instead
of ANSIString.
"""
def wrapped(self, *args, **kwargs):
return getattr(self.clean(), func_name)(*args, **kwargs)
return wrapped | [
"def",
"_query_super",
"(",
"func_name",
")",
":",
"def",
"wrapped",
"(",
"self",
",",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"return",
"getattr",
"(",
"self",
".",
"clean",
"(",
")",
",",
"func_name",
")",
"(",
"*",
"args",
",",
"*",
"*... | [
551,
0
] | [
560,
18
] | python | en | ['en', 'error', 'th'] | False |
_on_raw | (func_name) |
Like query_super, but makes the operation run on the raw string.
|
Like query_super, but makes the operation run on the raw string. | def _on_raw(func_name):
"""
Like query_super, but makes the operation run on the raw string.
"""
def wrapped(self, *args, **kwargs):
args = list(args)
try:
string = args.pop(0)
if hasattr(string, '_raw_string'):
args.insert(0, string.raw())
... | [
"def",
"_on_raw",
"(",
"func_name",
")",
":",
"def",
"wrapped",
"(",
"self",
",",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"args",
"=",
"list",
"(",
"args",
")",
"try",
":",
"string",
"=",
"args",
".",
"pop",
"(",
"0",
")",
"if",
"hasatt... | [
563,
0
] | [
584,
18
] | python | en | ['en', 'error', 'th'] | False |
_transform | (func_name) |
Some string functions, like those manipulating capital letters,
return a string the same length as the original. This function
allows us to do the same, replacing all the non-coded characters
with the resulting string.
|
Some string functions, like those manipulating capital letters,
return a string the same length as the original. This function
allows us to do the same, replacing all the non-coded characters
with the resulting string. | def _transform(func_name):
"""
Some string functions, like those manipulating capital letters,
return a string the same length as the original. This function
allows us to do the same, replacing all the non-coded characters
with the resulting string.
"""
def wrapped(self, *args, **kwargs):
... | [
"def",
"_transform",
"(",
"func_name",
")",
":",
"def",
"wrapped",
"(",
"self",
",",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"replacement_string",
"=",
"_query_super",
"(",
"func_name",
")",
"(",
"self",
",",
"*",
"args",
",",
"*",
"*",
"kwar... | [
587,
0
] | [
610,
18
] | python | en | ['en', 'error', 'th'] | False |
ANSIParser.sub_ansi | (self, ansimatch) |
Replacer used by `re.sub` to replace ANSI
markers with correct ANSI sequences
Args:
ansimatch (re.matchobject): The match.
Returns:
processed (str): The processed match string.
|
Replacer used by `re.sub` to replace ANSI
markers with correct ANSI sequences | def sub_ansi(self, ansimatch):
"""
Replacer used by `re.sub` to replace ANSI
markers with correct ANSI sequences
Args:
ansimatch (re.matchobject): The match.
Returns:
processed (str): The processed match string.
"""
return self.ansi_map_... | [
"def",
"sub_ansi",
"(",
"self",
",",
"ansimatch",
")",
":",
"return",
"self",
".",
"ansi_map_dict",
".",
"get",
"(",
"ansimatch",
".",
"group",
"(",
")",
",",
"\"\"",
")"
] | [
210,
4
] | [
222,
60
] | python | en | ['en', 'error', 'th'] | False |
ANSIParser.sub_brightbg | (self, ansimatch) |
Replacer used by `re.sub` to replace ANSI
bright background markers with Xterm256 replacement
Args:
ansimatch (re.matchobject): The match.
Returns:
processed (str): The processed match string.
|
Replacer used by `re.sub` to replace ANSI
bright background markers with Xterm256 replacement | def sub_brightbg(self, ansimatch):
"""
Replacer used by `re.sub` to replace ANSI
bright background markers with Xterm256 replacement
Args:
ansimatch (re.matchobject): The match.
Returns:
processed (str): The processed match string.
"""
r... | [
"def",
"sub_brightbg",
"(",
"self",
",",
"ansimatch",
")",
":",
"return",
"self",
".",
"ansi_xterm256_bright_bg_map_dict",
".",
"get",
"(",
"ansimatch",
".",
"group",
"(",
")",
",",
"\"\"",
")"
] | [
224,
4
] | [
236,
79
] | python | en | ['en', 'error', 'th'] | False |
ANSIParser.sub_xterm256 | (self, rgbmatch, use_xterm256=False, color_type="fg") |
This is a replacer method called by `re.sub` with the matched
tag. It must return the correct ansi sequence.
It checks `self.do_xterm256` to determine if conversion
to standard ANSI should be done or not.
Args:
rgbmatch (re.matchobject): The match.
use_... |
This is a replacer method called by `re.sub` with the matched
tag. It must return the correct ansi sequence. | def sub_xterm256(self, rgbmatch, use_xterm256=False, color_type="fg"):
"""
This is a replacer method called by `re.sub` with the matched
tag. It must return the correct ansi sequence.
It checks `self.do_xterm256` to determine if conversion
to standard ANSI should be done or not.... | [
"def",
"sub_xterm256",
"(",
"self",
",",
"rgbmatch",
",",
"use_xterm256",
"=",
"False",
",",
"color_type",
"=",
"\"fg\"",
")",
":",
"if",
"not",
"rgbmatch",
":",
"return",
"\"\"",
"# get tag, stripping the initial marker",
"#rgbtag = rgbmatch.group()[1:]",
"background... | [
238,
4
] | [
357,
50
] | python | en | ['en', 'error', 'th'] | False |
ANSIParser.strip_raw_codes | (self, string) |
Strips raw ANSI codes from a string.
Args:
string (str): The string to strip.
Returns:
string (str): The processed string.
|
Strips raw ANSI codes from a string. | def strip_raw_codes(self, string):
"""
Strips raw ANSI codes from a string.
Args:
string (str): The string to strip.
Returns:
string (str): The processed string.
"""
return self.ansi_regex.sub("", string) | [
"def",
"strip_raw_codes",
"(",
"self",
",",
"string",
")",
":",
"return",
"self",
".",
"ansi_regex",
".",
"sub",
"(",
"\"\"",
",",
"string",
")"
] | [
359,
4
] | [
370,
46
] | python | en | ['en', 'error', 'th'] | False |
ANSIParser.strip_mxp | (self, string) |
Strips all MXP codes from a string.
Args:
string (str): The string to strip.
Returns:
string (str): The processed string.
|
Strips all MXP codes from a string. | def strip_mxp(self, string):
"""
Strips all MXP codes from a string.
Args:
string (str): The string to strip.
Returns:
string (str): The processed string.
"""
return self.mxp_sub.sub(r'\2', string) | [
"def",
"strip_mxp",
"(",
"self",
",",
"string",
")",
":",
"return",
"self",
".",
"mxp_sub",
".",
"sub",
"(",
"r'\\2'",
",",
"string",
")"
] | [
372,
4
] | [
383,
46
] | python | en | ['en', 'error', 'th'] | False |
ANSIParser.parse_ansi | (self, string, strip_ansi=False, xterm256=False, mxp=False) |
Parses a string, subbing color codes according to the stored
mapping.
Args:
string (str): The string to parse.
strip_ansi (boolean, optional): Strip all found ansi markup.
xterm256 (boolean, optional): If actually using xterm256 or if
these v... |
Parses a string, subbing color codes according to the stored
mapping. | def parse_ansi(self, string, strip_ansi=False, xterm256=False, mxp=False):
"""
Parses a string, subbing color codes according to the stored
mapping.
Args:
string (str): The string to parse.
strip_ansi (boolean, optional): Strip all found ansi markup.
... | [
"def",
"parse_ansi",
"(",
"self",
",",
"string",
",",
"strip_ansi",
"=",
"False",
",",
"xterm256",
"=",
"False",
",",
"mxp",
"=",
"False",
")",
":",
"if",
"hasattr",
"(",
"string",
",",
"'_raw_string'",
")",
":",
"if",
"strip_ansi",
":",
"return",
"str... | [
385,
4
] | [
458,
28
] | python | en | ['en', 'error', 'th'] | False |
ANSIString.__new__ | (cls, *args, **kwargs) |
When creating a new ANSIString, you may use a custom parser that has
the same attributes as the standard one, and you may declare the
string to be handled as already decoded. It is important not to double
decode strings, as escapes can only be respected once.
Internally, ANSISt... |
When creating a new ANSIString, you may use a custom parser that has
the same attributes as the standard one, and you may declare the
string to be handled as already decoded. It is important not to double
decode strings, as escapes can only be respected once. | def __new__(cls, *args, **kwargs):
"""
When creating a new ANSIString, you may use a custom parser that has
the same attributes as the standard one, and you may declare the
string to be handled as already decoded. It is important not to double
decode strings, as escapes can only ... | [
"def",
"__new__",
"(",
"cls",
",",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"string",
"=",
"args",
"[",
"0",
"]",
"if",
"not",
"isinstance",
"(",
"string",
",",
"basestring",
")",
":",
"string",
"=",
"to_str",
"(",
"string",
",",
"force_stri... | [
663,
4
] | [
715,
26
] | python | en | ['en', 'error', 'th'] | False |
ANSIString.__unicode__ | (self) |
Unfortunately, this is not called during print() statements
due to a bug in the Python interpreter. You can always do
unicode() or str() around the resulting ANSIString and print
that.
|
Unfortunately, this is not called during print() statements
due to a bug in the Python interpreter. You can always do
unicode() or str() around the resulting ANSIString and print
that. | def __unicode__(self):
"""
Unfortunately, this is not called during print() statements
due to a bug in the Python interpreter. You can always do
unicode() or str() around the resulting ANSIString and print
that.
"""
return self._raw_string | [
"def",
"__unicode__",
"(",
"self",
")",
":",
"return",
"self",
".",
"_raw_string"
] | [
720,
4
] | [
728,
31
] | python | en | ['en', 'error', 'th'] | False |
ANSIString.__repr__ | (self) |
Let's make the repr the command that would actually be used to
construct this object, for convenience and reference.
|
Let's make the repr the command that would actually be used to
construct this object, for convenience and reference. | def __repr__(self):
"""
Let's make the repr the command that would actually be used to
construct this object, for convenience and reference.
"""
return "ANSIString(%s, decoded=True)" % repr(self._raw_string) | [
"def",
"__repr__",
"(",
"self",
")",
":",
"return",
"\"ANSIString(%s, decoded=True)\"",
"%",
"repr",
"(",
"self",
".",
"_raw_string",
")"
] | [
730,
4
] | [
736,
70
] | python | en | ['en', 'error', 'th'] | False |
ANSIString.__init__ | (self, *_, **kwargs) |
When the ANSIString is first initialized, a few internal variables
have to be set.
The first is the parser. It is possible to replace Evennia's standard
ANSI parser with one of your own syntax if you wish, so long as it
implements the same interface.
The second is the ... |
When the ANSIString is first initialized, a few internal variables
have to be set. | def __init__(self, *_, **kwargs):
"""
When the ANSIString is first initialized, a few internal variables
have to be set.
The first is the parser. It is possible to replace Evennia's standard
ANSI parser with one of your own syntax if you wish, so long as it
implements th... | [
"def",
"__init__",
"(",
"self",
",",
"*",
"_",
",",
"*",
"*",
"kwargs",
")",
":",
"self",
".",
"parser",
"=",
"kwargs",
".",
"pop",
"(",
"'parser'",
",",
"ANSI_PARSER",
")",
"super",
"(",
"ANSIString",
",",
"self",
")",
".",
"__init__",
"(",
")",
... | [
738,
4
] | [
768,
72
] | python | en | ['en', 'error', 'th'] | False |
ANSIString._shifter | (iterable, offset) |
Takes a list of integers, and produces a new one incrementing all
by a number.
|
Takes a list of integers, and produces a new one incrementing all
by a number. | def _shifter(iterable, offset):
"""
Takes a list of integers, and produces a new one incrementing all
by a number.
"""
return [i + offset for i in iterable] | [
"def",
"_shifter",
"(",
"iterable",
",",
"offset",
")",
":",
"return",
"[",
"i",
"+",
"offset",
"for",
"i",
"in",
"iterable",
"]"
] | [
771,
4
] | [
777,
45
] | python | en | ['en', 'error', 'th'] | False |
ANSIString._adder | (cls, first, second) |
Joins two ANSIStrings, preserving calculated info.
|
Joins two ANSIStrings, preserving calculated info. | def _adder(cls, first, second):
"""
Joins two ANSIStrings, preserving calculated info.
"""
raw_string = first._raw_string + second._raw_string
clean_string = first._clean_string + second._clean_string
code_indexes = first._code_indexes[:]
char_indexes = first._c... | [
"def",
"_adder",
"(",
"cls",
",",
"first",
",",
"second",
")",
":",
"raw_string",
"=",
"first",
".",
"_raw_string",
"+",
"second",
".",
"_raw_string",
"clean_string",
"=",
"first",
".",
"_clean_string",
"+",
"second",
".",
"_clean_string",
"code_indexes",
"=... | [
780,
4
] | [
796,
52
] | python | en | ['en', 'error', 'th'] | False |
ANSIString.__add__ | (self, other) |
We have to be careful when adding two strings not to reprocess things
that don't need to be reprocessed, lest we end up with escapes being
interpreted literally.
|
We have to be careful when adding two strings not to reprocess things
that don't need to be reprocessed, lest we end up with escapes being
interpreted literally. | def __add__(self, other):
"""
We have to be careful when adding two strings not to reprocess things
that don't need to be reprocessed, lest we end up with escapes being
interpreted literally.
"""
if not isinstance(other, basestring):
return NotImplemented
... | [
"def",
"__add__",
"(",
"self",
",",
"other",
")",
":",
"if",
"not",
"isinstance",
"(",
"other",
",",
"basestring",
")",
":",
"return",
"NotImplemented",
"if",
"not",
"isinstance",
"(",
"other",
",",
"ANSIString",
")",
":",
"other",
"=",
"ANSIString",
"("... | [
798,
4
] | [
809,
39
] | python | en | ['en', 'error', 'th'] | False |
ANSIString.__radd__ | (self, other) |
Likewise, if we're on the other end.
|
Likewise, if we're on the other end. | def __radd__(self, other):
"""
Likewise, if we're on the other end.
"""
if not isinstance(other, basestring):
return NotImplemented
if not isinstance(other, ANSIString):
other = ANSIString(other)
return self._adder(other, self) | [
"def",
"__radd__",
"(",
"self",
",",
"other",
")",
":",
"if",
"not",
"isinstance",
"(",
"other",
",",
"basestring",
")",
":",
"return",
"NotImplemented",
"if",
"not",
"isinstance",
"(",
"other",
",",
"ANSIString",
")",
":",
"other",
"=",
"ANSIString",
"(... | [
811,
4
] | [
820,
39
] | python | en | ['en', 'error', 'th'] | False |
ANSIString.__getslice__ | (self, i, j) |
This function is deprecated, so we just make it call the proper
function.
|
This function is deprecated, so we just make it call the proper
function. | def __getslice__(self, i, j):
"""
This function is deprecated, so we just make it call the proper
function.
"""
return self.__getitem__(slice(i, j)) | [
"def",
"__getslice__",
"(",
"self",
",",
"i",
",",
"j",
")",
":",
"return",
"self",
".",
"__getitem__",
"(",
"slice",
"(",
"i",
",",
"j",
")",
")"
] | [
822,
4
] | [
828,
44
] | python | en | ['en', 'error', 'th'] | False |
ANSIString._slice | (self, slc) |
This function takes a slice() object.
Slices have to be handled specially. Not only are they able to specify
a start and end with [x:y], but many forget that they can also specify
an interval with [x:y:z]. As a result, not only do we have to track
the ANSI Escapes that have pla... |
This function takes a slice() object. | def _slice(self, slc):
"""
This function takes a slice() object.
Slices have to be handled specially. Not only are they able to specify
a start and end with [x:y], but many forget that they can also specify
an interval with [x:y:z]. As a result, not only do we have to track
... | [
"def",
"_slice",
"(",
"self",
",",
"slc",
")",
":",
"slice_indexes",
"=",
"self",
".",
"_char_indexes",
"[",
"slc",
"]",
"# If it's the end of the string, we need to append final color codes.",
"if",
"not",
"slice_indexes",
":",
"return",
"ANSIString",
"(",
"''",
")... | [
830,
4
] | [
871,
61
] | python | en | ['en', 'error', 'th'] | False |
ANSIString.__getitem__ | (self, item) |
Gateway for slices and getting specific indexes in the ANSIString. If
this is a regexable ANSIString, it will get the data from the raw
string instead, bypassing ANSIString's intelligent escape skipping,
for reasons explained in the __new__ method's docstring.
|
Gateway for slices and getting specific indexes in the ANSIString. If
this is a regexable ANSIString, it will get the data from the raw
string instead, bypassing ANSIString's intelligent escape skipping,
for reasons explained in the __new__ method's docstring. | def __getitem__(self, item):
"""
Gateway for slices and getting specific indexes in the ANSIString. If
this is a regexable ANSIString, it will get the data from the raw
string instead, bypassing ANSIString's intelligent escape skipping,
for reasons explained in the __new__ method... | [
"def",
"__getitem__",
"(",
"self",
",",
"item",
")",
":",
"if",
"isinstance",
"(",
"item",
",",
"slice",
")",
":",
"# Slices must be handled specially.",
"return",
"self",
".",
"_slice",
"(",
"item",
")",
"try",
":",
"self",
".",
"_char_indexes",
"[",
"ite... | [
873,
4
] | [
902,
69
] | python | en | ['en', 'error', 'th'] | False |
ANSIString.clean | (self) |
Return a unicode object without the ANSI escapes.
Returns:
clean_string (unicode): A unicode object with no ANSI escapes.
|
Return a unicode object without the ANSI escapes. | def clean(self):
"""
Return a unicode object without the ANSI escapes.
Returns:
clean_string (unicode): A unicode object with no ANSI escapes.
"""
return self._clean_string | [
"def",
"clean",
"(",
"self",
")",
":",
"return",
"self",
".",
"_clean_string"
] | [
904,
4
] | [
912,
33
] | python | en | ['en', 'error', 'th'] | False |
ANSIString.raw | (self) |
Return a unicode object with the ANSI escapes.
Returns:
raw (unicode): A unicode object with the raw ANSI escape sequences.
|
Return a unicode object with the ANSI escapes. | def raw(self):
"""
Return a unicode object with the ANSI escapes.
Returns:
raw (unicode): A unicode object with the raw ANSI escape sequences.
"""
return self._raw_string | [
"def",
"raw",
"(",
"self",
")",
":",
"return",
"self",
".",
"_raw_string"
] | [
914,
4
] | [
922,
31
] | python | en | ['en', 'error', 'th'] | False |
ANSIString.partition | (self, sep, reverse=False) |
Splits once into three sections (with the separator being the middle section)
We use the same techniques we used in split() to make sure each are
colored.
Args:
sep (str): The separator to split the string on.
reverse (boolean): Whether to split the string on t... |
Splits once into three sections (with the separator being the middle section) | def partition(self, sep, reverse=False):
"""
Splits once into three sections (with the separator being the middle section)
We use the same techniques we used in split() to make sure each are
colored.
Args:
sep (str): The separator to split the string on.
... | [
"def",
"partition",
"(",
"self",
",",
"sep",
",",
"reverse",
"=",
"False",
")",
":",
"if",
"hasattr",
"(",
"sep",
",",
"'_clean_string'",
")",
":",
"sep",
"=",
"sep",
".",
"clean",
"(",
")",
"if",
"reverse",
":",
"parent_result",
"=",
"self",
".",
... | [
924,
4
] | [
955,
21
] | python | en | ['en', 'error', 'th'] | False |
ANSIString._get_indexes | (self) |
Two tables need to be made, one which contains the indexes of all
readable characters, and one which contains the indexes of all ANSI
escapes. It's important to remember that ANSI escapes require more
that one character at a time, though no readable character needs more
than one... |
Two tables need to be made, one which contains the indexes of all
readable characters, and one which contains the indexes of all ANSI
escapes. It's important to remember that ANSI escapes require more
that one character at a time, though no readable character needs more
than one... | def _get_indexes(self):
"""
Two tables need to be made, one which contains the indexes of all
readable characters, and one which contains the indexes of all ANSI
escapes. It's important to remember that ANSI escapes require more
that one character at a time, though no readable ch... | [
"def",
"_get_indexes",
"(",
"self",
")",
":",
"code_indexes",
"=",
"[",
"]",
"for",
"match",
"in",
"self",
".",
"parser",
".",
"ansi_regex",
".",
"finditer",
"(",
"self",
".",
"_raw_string",
")",
":",
"code_indexes",
".",
"extend",
"(",
"range",
"(",
"... | [
957,
4
] | [
984,
41
] | python | en | ['en', 'error', 'th'] | False |
ANSIString._get_interleving | (self, index) |
Get the code characters from the given slice end to the next
character.
|
Get the code characters from the given slice end to the next
character. | def _get_interleving(self, index):
"""
Get the code characters from the given slice end to the next
character.
"""
try:
index = self._char_indexes[index - 1]
except IndexError:
return ''
s = ''
while True:
index += 1
... | [
"def",
"_get_interleving",
"(",
"self",
",",
"index",
")",
":",
"try",
":",
"index",
"=",
"self",
".",
"_char_indexes",
"[",
"index",
"-",
"1",
"]",
"except",
"IndexError",
":",
"return",
"''",
"s",
"=",
"''",
"while",
"True",
":",
"index",
"+=",
"1"... | [
986,
4
] | [
1005,
16
] | python | en | ['en', 'error', 'th'] | False |
ANSIString.__mul__ | (self, other) |
Multiplication method. Implemented for performance reasons.
|
Multiplication method. Implemented for performance reasons. | def __mul__(self, other):
"""
Multiplication method. Implemented for performance reasons.
"""
if not isinstance(other, int):
return NotImplemented
raw_string = self._raw_string * other
clean_string = self._clean_string * other
code_indexes = self._cod... | [
"def",
"__mul__",
"(",
"self",
",",
"other",
")",
":",
"if",
"not",
"isinstance",
"(",
"other",
",",
"int",
")",
":",
"return",
"NotImplemented",
"raw_string",
"=",
"self",
".",
"_raw_string",
"*",
"other",
"clean_string",
"=",
"self",
".",
"_clean_string"... | [
1007,
4
] | [
1025,
38
] | python | en | ['en', 'error', 'th'] | False |
ANSIString.split | (self, by=None, maxsplit=-1) |
Splits a string based on a separator.
Stolen from PyPy's pure Python string implementation, tweaked for
ANSIString.
PyPy is distributed under the MIT licence.
http://opensource.org/licenses/MIT
Args:
by (str): A string to search for which will be used to s... |
Splits a string based on a separator. | def split(self, by=None, maxsplit=-1):
"""
Splits a string based on a separator.
Stolen from PyPy's pure Python string implementation, tweaked for
ANSIString.
PyPy is distributed under the MIT licence.
http://opensource.org/licenses/MIT
Args:
by (st... | [
"def",
"split",
"(",
"self",
",",
"by",
"=",
"None",
",",
"maxsplit",
"=",
"-",
"1",
")",
":",
"drop_spaces",
"=",
"by",
"is",
"None",
"if",
"drop_spaces",
":",
"by",
"=",
"\" \"",
"bylen",
"=",
"len",
"(",
"by",
")",
"if",
"bylen",
"==",
"0",
... | [
1030,
4
] | [
1075,
18
] | python | en | ['en', 'error', 'th'] | False |
ANSIString.rsplit | (self, by=None, maxsplit=-1) |
Like split, but starts from the end of the string rather than the
beginning.
Stolen from PyPy's pure Python string implementation, tweaked for
ANSIString.
PyPy is distributed under the MIT licence.
http://opensource.org/licenses/MIT
Args:
by (str):... |
Like split, but starts from the end of the string rather than the
beginning. | def rsplit(self, by=None, maxsplit=-1):
"""
Like split, but starts from the end of the string rather than the
beginning.
Stolen from PyPy's pure Python string implementation, tweaked for
ANSIString.
PyPy is distributed under the MIT licence.
http://opensource.or... | [
"def",
"rsplit",
"(",
"self",
",",
"by",
"=",
"None",
",",
"maxsplit",
"=",
"-",
"1",
")",
":",
"res",
"=",
"[",
"]",
"end",
"=",
"len",
"(",
"self",
")",
"drop_spaces",
"=",
"by",
"is",
"None",
"if",
"drop_spaces",
":",
"by",
"=",
"\" \"",
"by... | [
1077,
4
] | [
1123,
18
] | python | en | ['en', 'error', 'th'] | False |
ANSIString.strip | (self, chars=None) |
Strip from both ends, taking ANSI markers into account.
Args:
chars (str, optional): A string containing individual characters
to strip off of both ends of the string. By default, any blank
spaces are trimmed.
Returns:
result (ANSIString)... |
Strip from both ends, taking ANSI markers into account. | def strip(self, chars=None):
"""
Strip from both ends, taking ANSI markers into account.
Args:
chars (str, optional): A string containing individual characters
to strip off of both ends of the string. By default, any blank
spaces are trimmed.
... | [
"def",
"strip",
"(",
"self",
",",
"chars",
"=",
"None",
")",
":",
"clean",
"=",
"self",
".",
"_clean_string",
"raw",
"=",
"self",
".",
"_raw_string",
"# count continuous sequence of chars from left and right",
"nlen",
"=",
"len",
"(",
"clean",
")",
"nlstripped",... | [
1125,
4
] | [
1169,
67
] | python | en | ['en', 'error', 'th'] | False |
ANSIString.lstrip | (self, chars=None) |
Strip from the left, taking ANSI markers into account.
Args:
chars (str, optional): A string containing individual characters
to strip off of the left end of the string. By default, any
blank spaces are trimmed.
Returns:
result (ANSIStrin... |
Strip from the left, taking ANSI markers into account. | def lstrip(self, chars=None):
"""
Strip from the left, taking ANSI markers into account.
Args:
chars (str, optional): A string containing individual characters
to strip off of the left end of the string. By default, any
blank spaces are trimmed.
... | [
"def",
"lstrip",
"(",
"self",
",",
"chars",
"=",
"None",
")",
":",
"clean",
"=",
"self",
".",
"_clean_string",
"raw",
"=",
"self",
".",
"_raw_string",
"# count continuous sequence of chars from left and right",
"nlen",
"=",
"len",
"(",
"clean",
")",
"nlstripped"... | [
1171,
4
] | [
1202,
48
] | python | en | ['en', 'error', 'th'] | False |
ANSIString.rstrip | (self, chars=None) |
Strip from the right, taking ANSI markers into account.
Args:
chars (str, optional): A string containing individual characters
to strip off of the right end of the string. By default, any
blank spaces are trimmed.
Returns:
result (ANSIStr... |
Strip from the right, taking ANSI markers into account. | def rstrip(self, chars=None):
"""
Strip from the right, taking ANSI markers into account.
Args:
chars (str, optional): A string containing individual characters
to strip off of the right end of the string. By default, any
blank spaces are trimmed.
... | [
"def",
"rstrip",
"(",
"self",
",",
"chars",
"=",
"None",
")",
":",
"clean",
"=",
"self",
".",
"_clean_string",
"raw",
"=",
"self",
".",
"_raw_string",
"nlen",
"=",
"len",
"(",
"clean",
")",
"nrstripped",
"=",
"nlen",
"-",
"len",
"(",
"clean",
".",
... | [
1204,
4
] | [
1232,
52
] | python | en | ['en', 'error', 'th'] | False |
ANSIString.join | (self, iterable) |
Joins together strings in an iterable, using this string between each
one.
NOTE: This should always be used for joining strings when ANSIStrings
are involved. Otherwise color information will be discarded by
python, due to details in the C implementation of unicode stri... |
Joins together strings in an iterable, using this string between each
one. | def join(self, iterable):
"""
Joins together strings in an iterable, using this string between each
one.
NOTE: This should always be used for joining strings when ANSIStrings
are involved. Otherwise color information will be discarded by
python, due to details in... | [
"def",
"join",
"(",
"self",
",",
"iterable",
")",
":",
"result",
"=",
"ANSIString",
"(",
"''",
")",
"last_item",
"=",
"None",
"for",
"item",
"in",
"iterable",
":",
"if",
"last_item",
"is",
"not",
"None",
":",
"result",
"+=",
"self",
".",
"_raw_string",... | [
1234,
4
] | [
1263,
21
] | python | en | ['en', 'error', 'th'] | False |
ANSIString._filler | (self, char, amount) |
Generate a line of characters in a more efficient way than just adding
ANSIStrings.
|
Generate a line of characters in a more efficient way than just adding
ANSIStrings. | def _filler(self, char, amount):
"""
Generate a line of characters in a more efficient way than just adding
ANSIStrings.
"""
if not isinstance(char, ANSIString):
line = char * amount
return ANSIString(
char * amount, code_indexes=[], char_... | [
"def",
"_filler",
"(",
"self",
",",
"char",
",",
"amount",
")",
":",
"if",
"not",
"isinstance",
"(",
"char",
",",
"ANSIString",
")",
":",
"line",
"=",
"char",
"*",
"amount",
"return",
"ANSIString",
"(",
"char",
"*",
"amount",
",",
"code_indexes",
"=",
... | [
1265,
4
] | [
1291,
38
] | python | en | ['en', 'error', 'th'] | False |
ANSIString.center | (self, width, fillchar, _difference) |
Center some text with some spaces padding both sides.
Args:
width (int): The target width of the output string.
fillchar (str): A single character string to pad the output string
with.
Returns:
result (ANSIString): A string padded on both end... |
Center some text with some spaces padding both sides. | def center(self, width, fillchar, _difference):
"""
Center some text with some spaces padding both sides.
Args:
width (int): The target width of the output string.
fillchar (str): A single character string to pad the output string
with.
Returns:
... | [
"def",
"center",
"(",
"self",
",",
"width",
",",
"fillchar",
",",
"_difference",
")",
":",
"remainder",
"=",
"_difference",
"%",
"2",
"_difference",
"/=",
"2",
"spacing",
"=",
"self",
".",
"_filler",
"(",
"fillchar",
",",
"_difference",
")",
"result",
"=... | [
1296,
4
] | [
1312,
21
] | python | en | ['en', 'error', 'th'] | False |
ANSIString.ljust | (self, width, fillchar, _difference) |
Left justify some text.
Args:
width (int): The target width of the output string.
fillchar (str): A single character string to pad the output string
with.
Returns:
result (ANSIString): A string padded on the right with fillchar.
|
Left justify some text. | def ljust(self, width, fillchar, _difference):
"""
Left justify some text.
Args:
width (int): The target width of the output string.
fillchar (str): A single character string to pad the output string
with.
Returns:
result (ANSIString):... | [
"def",
"ljust",
"(",
"self",
",",
"width",
",",
"fillchar",
",",
"_difference",
")",
":",
"return",
"self",
"+",
"self",
".",
"_filler",
"(",
"fillchar",
",",
"_difference",
")"
] | [
1315,
4
] | [
1327,
57
] | python | en | ['en', 'error', 'th'] | False |
ANSIString.rjust | (self, width, fillchar, _difference) |
Right justify some text.
Args:
width (int): The target width of the output string.
fillchar (str): A single character string to pad the output string
with.
Returns:
result (ANSIString): A string padded on the left with fillchar.
|
Right justify some text. | def rjust(self, width, fillchar, _difference):
"""
Right justify some text.
Args:
width (int): The target width of the output string.
fillchar (str): A single character string to pad the output string
with.
Returns:
result (ANSIString)... | [
"def",
"rjust",
"(",
"self",
",",
"width",
",",
"fillchar",
",",
"_difference",
")",
":",
"return",
"self",
".",
"_filler",
"(",
"fillchar",
",",
"_difference",
")",
"+",
"self"
] | [
1330,
4
] | [
1342,
57
] | python | en | ['en', 'error', 'th'] | False |
IndyErrorHandler.__init__ | (self, message: str = None, error_cls: Type[LedgerError] = LedgerError) | Init the context manager. | Init the context manager. | def __init__(self, message: str = None, error_cls: Type[LedgerError] = LedgerError):
"""Init the context manager."""
self.error_cls = error_cls
self.message = message | [
"def",
"__init__",
"(",
"self",
",",
"message",
":",
"str",
"=",
"None",
",",
"error_cls",
":",
"Type",
"[",
"LedgerError",
"]",
"=",
"LedgerError",
")",
":",
"self",
".",
"error_cls",
"=",
"error_cls",
"self",
".",
"message",
"=",
"message"
] | [
46,
4
] | [
49,
30
] | python | en | ['en', 'en', 'en'] | True |
IndyErrorHandler.__enter__ | (self) | Enter the context manager. | Enter the context manager. | def __enter__(self):
"""Enter the context manager."""
return self | [
"def",
"__enter__",
"(",
"self",
")",
":",
"return",
"self"
] | [
51,
4
] | [
53,
19
] | python | en | ['en', 'gl', 'en'] | True |
IndyErrorHandler.__exit__ | (self, err_type, err_value, err_traceback) | Exit the context manager. | Exit the context manager. | def __exit__(self, err_type, err_value, err_traceback):
"""Exit the context manager."""
if err_type is IndyError:
raise self.wrap_error(
err_value, self.message, self.error_cls
) from err_value | [
"def",
"__exit__",
"(",
"self",
",",
"err_type",
",",
"err_value",
",",
"err_traceback",
")",
":",
"if",
"err_type",
"is",
"IndyError",
":",
"raise",
"self",
".",
"wrap_error",
"(",
"err_value",
",",
"self",
".",
"message",
",",
"self",
".",
"error_cls",
... | [
55,
4
] | [
60,
28
] | python | en | ['en', 'en', 'en'] | True |
IndyErrorHandler.wrap_error | (
cls,
err_value: IndyError,
message: str = None,
error_cls: Type[LedgerError] = LedgerError,
) | Create an instance of LedgerError from an IndyError. | Create an instance of LedgerError from an IndyError. | def wrap_error(
cls,
err_value: IndyError,
message: str = None,
error_cls: Type[LedgerError] = LedgerError,
) -> LedgerError:
"""Create an instance of LedgerError from an IndyError."""
err_msg = message or "Exception while performing ledger operation"
indy_mes... | [
"def",
"wrap_error",
"(",
"cls",
",",
"err_value",
":",
"IndyError",
",",
"message",
":",
"str",
"=",
"None",
",",
"error_cls",
":",
"Type",
"[",
"LedgerError",
"]",
"=",
"LedgerError",
",",
")",
"->",
"LedgerError",
":",
"err_msg",
"=",
"message",
"or",... | [
63,
4
] | [
75,
33
] | python | en | ['en', 'lb', 'en'] | True |
IndyLedger.__init__ | (
self,
pool_name: str,
wallet: BaseWallet,
*,
keepalive: int = 0,
cache: BaseCache = None,
cache_duration: int = 600,
) |
Initialize an IndyLedger instance.
Args:
pool_name: The Indy pool ledger configuration name
wallet: IndyWallet instance
keepalive: How many seconds to keep the ledger open
cache: The cache instance to use
cache_duration: The TTL for ledger ca... |
Initialize an IndyLedger instance. | def __init__(
self,
pool_name: str,
wallet: BaseWallet,
*,
keepalive: int = 0,
cache: BaseCache = None,
cache_duration: int = 600,
):
"""
Initialize an IndyLedger instance.
Args:
pool_name: The Indy pool ledger configuratio... | [
"def",
"__init__",
"(",
"self",
",",
"pool_name",
":",
"str",
",",
"wallet",
":",
"BaseWallet",
",",
"*",
",",
"keepalive",
":",
"int",
"=",
"0",
",",
"cache",
":",
"BaseCache",
"=",
"None",
",",
"cache_duration",
":",
"int",
"=",
"600",
",",
")",
... | [
83,
4
] | [
118,
64
] | python | en | ['en', 'error', 'th'] | False |
IndyLedger.create_pool_config | (
self, genesis_transactions: str, recreate: bool = False
) | Create the pool ledger configuration. | Create the pool ledger configuration. | async def create_pool_config(
self, genesis_transactions: str, recreate: bool = False
):
"""Create the pool ledger configuration."""
# indy-sdk requires a file but it's only used once to bootstrap
# the connection so we take a string instead of create a tmp file
txn_path = G... | [
"async",
"def",
"create_pool_config",
"(",
"self",
",",
"genesis_transactions",
":",
"str",
",",
"recreate",
":",
"bool",
"=",
"False",
")",
":",
"# indy-sdk requires a file but it's only used once to bootstrap",
"# the connection so we take a string instead of create a tmp file"... | [
120,
4
] | [
145,
82
] | python | en | ['en', 'sm', 'en'] | True |
IndyLedger.check_pool_config | (self) | Check if a pool config has been created. | Check if a pool config has been created. | async def check_pool_config(self) -> bool:
"""Check if a pool config has been created."""
pool_names = {cfg["pool"] for cfg in await indy.pool.list_pools()}
return self.pool_name in pool_names | [
"async",
"def",
"check_pool_config",
"(",
"self",
")",
"->",
"bool",
":",
"pool_names",
"=",
"{",
"cfg",
"[",
"\"pool\"",
"]",
"for",
"cfg",
"in",
"await",
"indy",
".",
"pool",
".",
"list_pools",
"(",
")",
"}",
"return",
"self",
".",
"pool_name",
"in",... | [
147,
4
] | [
150,
43
] | python | en | ['en', 'en', 'en'] | True |
IndyLedger.open | (self) | Open the pool ledger, creating it if necessary. | Open the pool ledger, creating it if necessary. | async def open(self):
"""Open the pool ledger, creating it if necessary."""
# We only support proto ver 2
with IndyErrorHandler(
"Exception when setting ledger protocol version", LedgerConfigError
):
await indy.pool.set_protocol_version(2)
with IndyErrorH... | [
"async",
"def",
"open",
"(",
"self",
")",
":",
"# We only support proto ver 2",
"with",
"IndyErrorHandler",
"(",
"\"Exception when setting ledger protocol version\"",
",",
"LedgerConfigError",
")",
":",
"await",
"indy",
".",
"pool",
".",
"set_protocol_version",
"(",
"2"... | [
152,
4
] | [
162,
26
] | python | en | ['en', 'en', 'en'] | True |
IndyLedger.close | (self) | Close the pool ledger. | Close the pool ledger. | async def close(self):
"""Close the pool ledger."""
if self.opened:
with IndyErrorHandler("Exception when closing pool ledger"):
await indy.pool.close_pool_ledger(self.pool_handle)
self.pool_handle = None
self.opened = False | [
"async",
"def",
"close",
"(",
"self",
")",
":",
"if",
"self",
".",
"opened",
":",
"with",
"IndyErrorHandler",
"(",
"\"Exception when closing pool ledger\"",
")",
":",
"await",
"indy",
".",
"pool",
".",
"close_pool_ledger",
"(",
"self",
".",
"pool_handle",
")",... | [
164,
4
] | [
170,
31
] | python | en | ['en', 'sq', 'en'] | True |
IndyLedger._context_open | (self) | Open the wallet if necessary and increase the number of active references. | Open the wallet if necessary and increase the number of active references. | async def _context_open(self):
"""Open the wallet if necessary and increase the number of active references."""
async with self.ref_lock:
if self.close_task:
self.close_task.cancel()
if not self.opened:
self.logger.debug("Opening the pool ledger")
... | [
"async",
"def",
"_context_open",
"(",
"self",
")",
":",
"async",
"with",
"self",
".",
"ref_lock",
":",
"if",
"self",
".",
"close_task",
":",
"self",
".",
"close_task",
".",
"cancel",
"(",
")",
"if",
"not",
"self",
".",
"opened",
":",
"self",
".",
"lo... | [
172,
4
] | [
180,
31
] | python | en | ['en', 'en', 'en'] | True |
IndyLedger._context_close | (self) | Release the wallet reference and schedule closing of the pool ledger. | Release the wallet reference and schedule closing of the pool ledger. | async def _context_close(self):
"""Release the wallet reference and schedule closing of the pool ledger."""
async def closer(timeout: int):
"""Close the pool ledger after a timeout."""
await asyncio.sleep(timeout)
async with self.ref_lock:
if not self... | [
"async",
"def",
"_context_close",
"(",
"self",
")",
":",
"async",
"def",
"closer",
"(",
"timeout",
":",
"int",
")",
":",
"\"\"\"Close the pool ledger after a timeout.\"\"\"",
"await",
"asyncio",
".",
"sleep",
"(",
"timeout",
")",
"async",
"with",
"self",
".",
... | [
182,
4
] | [
199,
38
] | python | en | ['en', 'en', 'en'] | True |
IndyLedger.__aenter__ | (self) |
Context manager entry.
Returns:
The current instance
|
Context manager entry. | async def __aenter__(self) -> "IndyLedger":
"""
Context manager entry.
Returns:
The current instance
"""
await self._context_open()
return self | [
"async",
"def",
"__aenter__",
"(",
"self",
")",
"->",
"\"IndyLedger\"",
":",
"await",
"self",
".",
"_context_open",
"(",
")",
"return",
"self"
] | [
201,
4
] | [
210,
19
] | python | en | ['en', 'error', 'th'] | False |
IndyLedger.__aexit__ | (self, exc_type, exc, tb) | Context manager exit. | Context manager exit. | async def __aexit__(self, exc_type, exc, tb):
"""Context manager exit."""
await self._context_close() | [
"async",
"def",
"__aexit__",
"(",
"self",
",",
"exc_type",
",",
"exc",
",",
"tb",
")",
":",
"await",
"self",
".",
"_context_close",
"(",
")"
] | [
212,
4
] | [
214,
35
] | python | en | ['da', 'en', 'en'] | True |
IndyLedger._submit | (
self,
request_json: str,
sign: bool = None,
taa_accept: bool = False,
public_did: str = "",
) |
Sign and submit request to ledger.
Args:
request_json: The json string to submit
sign: whether or not to sign the request
taa_accept: whether to apply TAA acceptance to the (signed, write) request
public_did: override the public DID used to sign the requ... |
Sign and submit request to ledger. | async def _submit(
self,
request_json: str,
sign: bool = None,
taa_accept: bool = False,
public_did: str = "",
) -> str:
"""
Sign and submit request to ledger.
Args:
request_json: The json string to submit
sign: whether or not ... | [
"async",
"def",
"_submit",
"(",
"self",
",",
"request_json",
":",
"str",
",",
"sign",
":",
"bool",
"=",
"None",
",",
"taa_accept",
":",
"bool",
"=",
"False",
",",
"public_did",
":",
"str",
"=",
"\"\"",
",",
")",
"->",
"str",
":",
"if",
"not",
"self... | [
216,
4
] | [
290,
13
] | python | en | ['en', 'error', 'th'] | False |
IndyLedger.send_schema | (
self, schema_name: str, schema_version: str, attribute_names: Sequence[str]
) |
Send schema to ledger.
Args:
schema_name: The schema name
schema_version: The schema version
attribute_names: A list of schema attributes
|
Send schema to ledger. | async def send_schema(
self, schema_name: str, schema_version: str, attribute_names: Sequence[str]
):
"""
Send schema to ledger.
Args:
schema_name: The schema name
schema_version: The schema version
attribute_names: A list of schema attributes
... | [
"async",
"def",
"send_schema",
"(",
"self",
",",
"schema_name",
":",
"str",
",",
"schema_version",
":",
"str",
",",
"attribute_names",
":",
"Sequence",
"[",
"str",
"]",
")",
":",
"public_info",
"=",
"await",
"self",
".",
"wallet",
".",
"get_public_did",
"(... | [
292,
4
] | [
361,
24
] | python | en | ['en', 'error', 'th'] | False |
IndyLedger.check_existing_schema | (
self,
public_did: str,
schema_name: str,
schema_version: str,
attribute_names: Sequence[str],
) | Check if a schema has already been published. | Check if a schema has already been published. | async def check_existing_schema(
self,
public_did: str,
schema_name: str,
schema_version: str,
attribute_names: Sequence[str],
) -> str:
"""Check if a schema has already been published."""
fetch_schema_id = f"{public_did}:2:{schema_name}:{schema_version}"
... | [
"async",
"def",
"check_existing_schema",
"(",
"self",
",",
"public_did",
":",
"str",
",",
"schema_name",
":",
"str",
",",
"schema_version",
":",
"str",
",",
"attribute_names",
":",
"Sequence",
"[",
"str",
"]",
",",
")",
"->",
"str",
":",
"fetch_schema_id",
... | [
363,
4
] | [
383,
34
] | python | en | ['en', 'en', 'en'] | True |
IndyLedger.get_schema | (self, schema_id: str) |
Get a schema from the cache if available, otherwise fetch from the ledger.
Args:
schema_id: The schema id (or stringified sequence number) to retrieve
|
Get a schema from the cache if available, otherwise fetch from the ledger. | async def get_schema(self, schema_id: str):
"""
Get a schema from the cache if available, otherwise fetch from the ledger.
Args:
schema_id: The schema id (or stringified sequence number) to retrieve
"""
if self.cache:
result = await self.cache.get(f"sche... | [
"async",
"def",
"get_schema",
"(",
"self",
",",
"schema_id",
":",
"str",
")",
":",
"if",
"self",
".",
"cache",
":",
"result",
"=",
"await",
"self",
".",
"cache",
".",
"get",
"(",
"f\"schema::{schema_id}\"",
")",
"if",
"result",
":",
"return",
"result",
... | [
385,
4
] | [
401,
59
] | python | en | ['en', 'error', 'th'] | False |
IndyLedger.fetch_schema_by_id | (self, schema_id: str) |
Get schema from ledger.
Args:
schema_id: The schema id (or stringified sequence number) to retrieve
Returns:
Indy schema dict
|
Get schema from ledger. | async def fetch_schema_by_id(self, schema_id: str):
"""
Get schema from ledger.
Args:
schema_id: The schema id (or stringified sequence number) to retrieve
Returns:
Indy schema dict
"""
public_info = await self.wallet.get_public_did()
p... | [
"async",
"def",
"fetch_schema_by_id",
"(",
"self",
",",
"schema_id",
":",
"str",
")",
":",
"public_info",
"=",
"await",
"self",
".",
"wallet",
".",
"get_public_did",
"(",
")",
"public_did",
"=",
"public_info",
".",
"did",
"if",
"public_info",
"else",
"None",... | [
403,
4
] | [
442,
30
] | python | en | ['en', 'error', 'th'] | False |
IndyLedger.fetch_schema_by_seq_no | (self, seq_no: int) |
Fetch a schema by its sequence number.
Args:
seq_no: schema ledger sequence number
Returns:
Indy schema dict
|
Fetch a schema by its sequence number. | async def fetch_schema_by_seq_no(self, seq_no: int):
"""
Fetch a schema by its sequence number.
Args:
seq_no: schema ledger sequence number
Returns:
Indy schema dict
"""
# get txn by sequence number, retrieve schema identifier components
... | [
"async",
"def",
"fetch_schema_by_seq_no",
"(",
"self",
",",
"seq_no",
":",
"int",
")",
":",
"# get txn by sequence number, retrieve schema identifier components",
"request_json",
"=",
"await",
"indy",
".",
"ledger",
".",
"build_get_txn_request",
"(",
"None",
",",
"None"... | [
444,
4
] | [
474,
9
] | python | en | ['en', 'error', 'th'] | False |
IndyLedger.send_credential_definition | (self, schema_id: str, tag: str = None) |
Send credential definition to ledger and store relevant key matter in wallet.
Args:
schema_id: The schema id of the schema to create cred def for
tag: Option tag to distinguish multiple credential definitions
|
Send credential definition to ledger and store relevant key matter in wallet. | async def send_credential_definition(self, schema_id: str, tag: str = None):
"""
Send credential definition to ledger and store relevant key matter in wallet.
Args:
schema_id: The schema id of the schema to create cred def for
tag: Option tag to distinguish multiple cred... | [
"async",
"def",
"send_credential_definition",
"(",
"self",
",",
"schema_id",
":",
"str",
",",
"tag",
":",
"str",
"=",
"None",
")",
":",
"public_info",
"=",
"await",
"self",
".",
"wallet",
".",
"get_public_did",
"(",
")",
"if",
"not",
"public_info",
":",
... | [
476,
4
] | [
565,
39
] | python | en | ['en', 'error', 'th'] | False |
IndyLedger.get_credential_definition | (self, credential_definition_id: str) |
Get a credential definition from the cache if available, otherwise the ledger.
Args:
credential_definition_id: The schema id of the schema to fetch cred def for
|
Get a credential definition from the cache if available, otherwise the ledger. | async def get_credential_definition(self, credential_definition_id: str):
"""
Get a credential definition from the cache if available, otherwise the ledger.
Args:
credential_definition_id: The schema id of the schema to fetch cred def for
"""
if self.cache:
... | [
"async",
"def",
"get_credential_definition",
"(",
"self",
",",
"credential_definition_id",
":",
"str",
")",
":",
"if",
"self",
".",
"cache",
":",
"result",
"=",
"await",
"self",
".",
"cache",
".",
"get",
"(",
"f\"credential_definition::{credential_definition_id}\"",... | [
567,
4
] | [
582,
79
] | python | en | ['en', 'error', 'th'] | False |
IndyLedger.fetch_credential_definition | (self, credential_definition_id: str) |
Get a credential definition from the ledger by id.
Args:
credential_definition_id: The cred def id of the cred def to fetch
|
Get a credential definition from the ledger by id. | async def fetch_credential_definition(self, credential_definition_id: str):
"""
Get a credential definition from the ledger by id.
Args:
credential_definition_id: The cred def id of the cred def to fetch
"""
public_info = await self.wallet.get_public_did()
... | [
"async",
"def",
"fetch_credential_definition",
"(",
"self",
",",
"credential_definition_id",
":",
"str",
")",
":",
"public_info",
"=",
"await",
"self",
".",
"wallet",
".",
"get_public_did",
"(",
")",
"public_did",
"=",
"public_info",
".",
"did",
"if",
"public_in... | [
584,
4
] | [
621,
30
] | python | en | ['en', 'error', 'th'] | False |
IndyLedger.credential_definition_id2schema_id | (self, credential_definition_id) |
From a credential definition, get the identifier for its schema.
Args:
credential_definition_id: The identifier of the credential definition
from which to identify a schema
|
From a credential definition, get the identifier for its schema. | async def credential_definition_id2schema_id(self, credential_definition_id):
"""
From a credential definition, get the identifier for its schema.
Args:
credential_definition_id: The identifier of the credential definition
from which to identify a schema
"""
... | [
"async",
"def",
"credential_definition_id2schema_id",
"(",
"self",
",",
"credential_definition_id",
")",
":",
"# scrape schema id or sequence number from cred def id",
"tokens",
"=",
"credential_definition_id",
".",
"split",
"(",
"\":\"",
")",
"if",
"len",
"(",
"tokens",
... | [
623,
4
] | [
639,
52
] | python | en | ['en', 'error', 'th'] | False |
IndyLedger.get_key_for_did | (self, did: str) | Fetch the verkey for a ledger DID.
Args:
did: The DID to look up on the ledger or in the cache
| Fetch the verkey for a ledger DID. | async def get_key_for_did(self, did: str) -> str:
"""Fetch the verkey for a ledger DID.
Args:
did: The DID to look up on the ledger or in the cache
"""
nym = self.did_to_nym(did)
public_info = await self.wallet.get_public_did()
public_did = public_info.did if... | [
"async",
"def",
"get_key_for_did",
"(",
"self",
",",
"did",
":",
"str",
")",
"->",
"str",
":",
"nym",
"=",
"self",
".",
"did_to_nym",
"(",
"did",
")",
"public_info",
"=",
"await",
"self",
".",
"wallet",
".",
"get_public_did",
"(",
")",
"public_did",
"=... | [
641,
4
] | [
654,
46
] | python | en | ['en', 'en', 'en'] | True |
IndyLedger.get_endpoint_for_did | (self, did: str) | Fetch the endpoint for a ledger DID.
Args:
did: The DID to look up on the ledger or in the cache
| Fetch the endpoint for a ledger DID. | async def get_endpoint_for_did(self, did: str) -> str:
"""Fetch the endpoint for a ledger DID.
Args:
did: The DID to look up on the ledger or in the cache
"""
nym = self.did_to_nym(did)
public_info = await self.wallet.get_public_did()
public_did = public_info... | [
"async",
"def",
"get_endpoint_for_did",
"(",
"self",
",",
"did",
":",
"str",
")",
"->",
"str",
":",
"nym",
"=",
"self",
".",
"did_to_nym",
"(",
"did",
")",
"public_info",
"=",
"await",
"self",
".",
"wallet",
".",
"get_public_did",
"(",
")",
"public_did",... | [
656,
4
] | [
676,
22
] | python | en | ['en', 'en', 'en'] | True |
IndyLedger.update_endpoint_for_did | (self, did: str, endpoint: str) | Check and update the endpoint on the ledger.
Args:
did: The ledger DID
endpoint: The endpoint address
transport_vk: The endpoint transport verkey
| Check and update the endpoint on the ledger. | async def update_endpoint_for_did(self, did: str, endpoint: str) -> bool:
"""Check and update the endpoint on the ledger.
Args:
did: The ledger DID
endpoint: The endpoint address
transport_vk: The endpoint transport verkey
"""
exist_endpoint = await s... | [
"async",
"def",
"update_endpoint_for_did",
"(",
"self",
",",
"did",
":",
"str",
",",
"endpoint",
":",
"str",
")",
"->",
"bool",
":",
"exist_endpoint",
"=",
"await",
"self",
".",
"get_endpoint_for_did",
"(",
"did",
")",
"if",
"exist_endpoint",
"!=",
"endpoint... | [
678,
4
] | [
696,
20
] | python | en | ['en', 'en', 'en'] | True |
IndyLedger.register_nym | (
self, did: str, verkey: str, alias: str = None, role: str = None
) |
Register a nym on the ledger.
Args:
did: DID to register on the ledger.
verkey: The verification key of the keypair.
alias: Human-friendly alias to assign to the DID.
role: For permissioned ledgers, what role should the new DID have.
|
Register a nym on the ledger. | async def register_nym(
self, did: str, verkey: str, alias: str = None, role: str = None
):
"""
Register a nym on the ledger.
Args:
did: DID to register on the ledger.
verkey: The verification key of the keypair.
alias: Human-friendly alias to ass... | [
"async",
"def",
"register_nym",
"(",
"self",
",",
"did",
":",
"str",
",",
"verkey",
":",
"str",
",",
"alias",
":",
"str",
"=",
"None",
",",
"role",
":",
"str",
"=",
"None",
")",
":",
"public_info",
"=",
"await",
"self",
".",
"wallet",
".",
"get_pub... | [
698,
4
] | [
713,
64
] | python | en | ['en', 'error', 'th'] | False |
IndyLedger.nym_to_did | (self, nym: str) | Format a nym with the ledger's DID prefix. | Format a nym with the ledger's DID prefix. | def nym_to_did(self, nym: str) -> str:
"""Format a nym with the ledger's DID prefix."""
if nym:
# remove any existing prefix
nym = self.did_to_nym(nym)
return f"did:sov:{nym}" | [
"def",
"nym_to_did",
"(",
"self",
",",
"nym",
":",
"str",
")",
"->",
"str",
":",
"if",
"nym",
":",
"# remove any existing prefix",
"nym",
"=",
"self",
".",
"did_to_nym",
"(",
"nym",
")",
"return",
"f\"did:sov:{nym}\""
] | [
715,
4
] | [
720,
35
] | python | en | ['en', 'en', 'en'] | True |
IndyLedger.get_txn_author_agreement | (self, reload: bool = False) | Get the current transaction author agreement, fetching it if necessary. | Get the current transaction author agreement, fetching it if necessary. | async def get_txn_author_agreement(self, reload: bool = False):
"""Get the current transaction author agreement, fetching it if necessary."""
if not self.taa_cache or reload:
self.taa_cache = await self.fetch_txn_author_agreement()
return self.taa_cache | [
"async",
"def",
"get_txn_author_agreement",
"(",
"self",
",",
"reload",
":",
"bool",
"=",
"False",
")",
":",
"if",
"not",
"self",
".",
"taa_cache",
"or",
"reload",
":",
"self",
".",
"taa_cache",
"=",
"await",
"self",
".",
"fetch_txn_author_agreement",
"(",
... | [
722,
4
] | [
726,
29
] | python | en | ['en', 'en', 'en'] | True |
IndyLedger.fetch_txn_author_agreement | (self) | Fetch the current AML and TAA from the ledger. | Fetch the current AML and TAA from the ledger. | async def fetch_txn_author_agreement(self):
"""Fetch the current AML and TAA from the ledger."""
public_info = await self.wallet.get_public_did()
public_did = public_info.did if public_info else None
get_aml_req = await indy.ledger.build_get_acceptance_mechanisms_request(
pu... | [
"async",
"def",
"fetch_txn_author_agreement",
"(",
"self",
")",
":",
"public_info",
"=",
"await",
"self",
".",
"wallet",
".",
"get_public_did",
"(",
")",
"public_did",
"=",
"public_info",
".",
"did",
"if",
"public_info",
"else",
"None",
"get_aml_req",
"=",
"aw... | [
728,
4
] | [
753,
9
] | python | en | ['en', 'en', 'en'] | True |
IndyLedger.get_indy_storage | (self) | Get an IndyStorage instance for the current wallet. | Get an IndyStorage instance for the current wallet. | def get_indy_storage(self) -> IndyStorage:
"""Get an IndyStorage instance for the current wallet."""
return IndyStorage(self.wallet) | [
"def",
"get_indy_storage",
"(",
"self",
")",
"->",
"IndyStorage",
":",
"return",
"IndyStorage",
"(",
"self",
".",
"wallet",
")"
] | [
755,
4
] | [
757,
39
] | python | en | ['en', 'en', 'en'] | True |
IndyLedger.taa_rough_timestamp | (self) | Get a timestamp accurate to the day.
Anything more accurate is a privacy concern.
| Get a timestamp accurate to the day. | def taa_rough_timestamp(self) -> int:
"""Get a timestamp accurate to the day.
Anything more accurate is a privacy concern.
"""
return int(datetime.combine(date.today(), datetime.min.time()).timestamp()) | [
"def",
"taa_rough_timestamp",
"(",
"self",
")",
"->",
"int",
":",
"return",
"int",
"(",
"datetime",
".",
"combine",
"(",
"date",
".",
"today",
"(",
")",
",",
"datetime",
".",
"min",
".",
"time",
"(",
")",
")",
".",
"timestamp",
"(",
")",
")"
] | [
759,
4
] | [
764,
83
] | python | en | ['en', 'en', 'en'] | True |
IndyLedger.accept_txn_author_agreement | (
self,
taa_record: dict,
mechanism: str,
accept_time: int = None,
store: bool = False,
) | Save a new record recording the acceptance of the TAA. | Save a new record recording the acceptance of the TAA. | async def accept_txn_author_agreement(
self,
taa_record: dict,
mechanism: str,
accept_time: int = None,
store: bool = False,
):
"""Save a new record recording the acceptance of the TAA."""
if not accept_time:
accept_time = self.taa_rough_timestamp(... | [
"async",
"def",
"accept_txn_author_agreement",
"(",
"self",
",",
"taa_record",
":",
"dict",
",",
"mechanism",
":",
"str",
",",
"accept_time",
":",
"int",
"=",
"None",
",",
"store",
":",
"bool",
"=",
"False",
",",
")",
":",
"if",
"not",
"accept_time",
":"... | [
766,
4
] | [
791,
72
] | python | en | ['en', 'en', 'en'] | True |
IndyLedger.get_latest_txn_author_acceptance | (self) | Look up the latest TAA acceptance. | Look up the latest TAA acceptance. | async def get_latest_txn_author_acceptance(self):
"""Look up the latest TAA acceptance."""
cache_key = TAA_ACCEPTED_RECORD_TYPE + "::" + self.pool_name
acceptance = await self.cache.get(cache_key)
if acceptance is None:
storage = self.get_indy_storage()
tag_filter... | [
"async",
"def",
"get_latest_txn_author_acceptance",
"(",
"self",
")",
":",
"cache_key",
"=",
"TAA_ACCEPTED_RECORD_TYPE",
"+",
"\"::\"",
"+",
"self",
".",
"pool_name",
"acceptance",
"=",
"await",
"self",
".",
"cache",
".",
"get",
"(",
"cache_key",
")",
"if",
"a... | [
793,
4
] | [
810,
25
] | python | en | ['en', 'en', 'en'] | True |
Marker.color | (self) |
Sets the marker color of all increasing values.
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(... |
Sets the marker color of all increasing values.
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):
"""
Sets the marker color of all increasing values.
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... | [
"def",
"color",
"(",
"self",
")",
":",
"return",
"self",
"[",
"\"color\"",
"]"
] | [
15,
4
] | [
65,
28
] | 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.waterfall.increasing.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.waterfall.increasing.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.waterfall.increasing.marker.Line`
- A dict of string/value properties that will be passed
to the Line constructor
S... | [
"def",
"line",
"(",
"self",
")",
":",
"return",
"self",
"[",
"\"line\"",
"]"
] | [
74,
4
] | [
93,
27
] | python | en | ['en', 'error', 'th'] | False |
Marker.__init__ | (self, arg=None, color=None, line=None, **kwargs) |
Construct a new Marker object
Parameters
----------
arg
dict of properties compatible with this constructor or
an instance of
:class:`plotly.graph_objs.waterfall.increasing.Marker`
color
Sets the marker color of all increa... |
Construct a new Marker object
Parameters
----------
arg
dict of properties compatible with this constructor or
an instance of
:class:`plotly.graph_objs.waterfall.increasing.Marker`
color
Sets the marker color of all increa... | def __init__(self, arg=None, color=None, line=None, **kwargs):
"""
Construct a new Marker object
Parameters
----------
arg
dict of properties compatible with this constructor or
an instance of
:class:`plotly.graph_objs.waterfall.increa... | [
"def",
"__init__",
"(",
"self",
",",
"arg",
"=",
"None",
",",
"color",
"=",
"None",
",",
"line",
"=",
"None",
",",
"*",
"*",
"kwargs",
")",
":",
"super",
"(",
"Marker",
",",
"self",
")",
".",
"__init__",
"(",
"\"marker\"",
")",
"if",
"\"_parent\"",... | [
111,
4
] | [
175,
34
] | python | en | ['en', 'error', 'th'] | False |
Font.color | (self) |
The 'color' property is a color and may be specified as:
- A hex string (e.g. '#ff0000')
- An rgb/rgba string (e.g. 'rgb(255,0,0)')
- An hsl/hsla string (e.g. 'hsl(0,100%,50%)')
- An hsv/hsva string (e.g. 'hsv(0,100%,100%)')
- A named CSS color:
... |
The 'color' property is a color and may be specified as:
- A hex string (e.g. '#ff0000')
- An rgb/rgba string (e.g. 'rgb(255,0,0)')
- An hsl/hsla string (e.g. 'hsl(0,100%,50%)')
- An hsv/hsva string (e.g. 'hsv(0,100%,100%)')
- A named CSS color:
... | def color(self):
"""
The 'color' property is a color and may be specified as:
- A hex string (e.g. '#ff0000')
- An rgb/rgba string (e.g. 'rgb(255,0,0)')
- An hsl/hsla string (e.g. 'hsl(0,100%,50%)')
- An hsv/hsva string (e.g. 'hsv(0,100%,100%)')
- A name... | [
"def",
"color",
"(",
"self",
")",
":",
"return",
"self",
"[",
"\"color\"",
"]"
] | [
15,
4
] | [
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.scatterpolargl
.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 |
ChatServiceAgent.data | (self) |
ChatServiceAgent data property.
|
ChatServiceAgent data property.
| def data(self):
"""
ChatServiceAgent data property.
"""
return self._data | [
"def",
"data",
"(",
"self",
")",
":",
"return",
"self",
".",
"_data"
] | [
33,
4
] | [
37,
25
] | python | en | ['en', 'error', 'th'] | False |
ChatServiceAgent.data | (self, value) |
Setter for ChatServiceAgent.data.
The data within a ChatServiceAgent is persistent, in the sense that keys
_cannot_ be removed from the data. This is important to ensure persistence
of agent state across various parts of the ChatService pipeline.
To ensure this property, we ca... |
Setter for ChatServiceAgent.data. | def data(self, value):
"""
Setter for ChatServiceAgent.data.
The data within a ChatServiceAgent is persistent, in the sense that keys
_cannot_ be removed from the data. This is important to ensure persistence
of agent state across various parts of the ChatService pipeline.
... | [
"def",
"data",
"(",
"self",
",",
"value",
")",
":",
"self",
".",
"_data",
".",
"update",
"(",
"value",
")"
] | [
40,
4
] | [
53,
32
] | python | en | ['en', 'error', 'th'] | False |
ChatServiceAgent.observe | (self, act) |
Send an agent a message through the manager.
|
Send an agent a message through the manager.
| def observe(self, act):
"""
Send an agent a message through the manager.
"""
pass | [
"def",
"observe",
"(",
"self",
",",
"act",
")",
":",
"pass"
] | [
56,
4
] | [
60,
12
] | python | en | ['en', 'error', 'th'] | False |
ChatServiceAgent._send_payload | (self, receiver_id, data, quick_replies=None, persona_id=None) |
Send a payload through the message manager.
:param receiver_id:
int identifier for agent to send message to
:param data:
object data to send
:param quick_replies:
list of quick replies
:param persona_id:
identifier of persona
... |
Send a payload through the message manager. | def _send_payload(self, receiver_id, data, quick_replies=None, persona_id=None):
"""
Send a payload through the message manager.
:param receiver_id:
int identifier for agent to send message to
:param data:
object data to send
:param quick_replies:
... | [
"def",
"_send_payload",
"(",
"self",
",",
"receiver_id",
",",
"data",
",",
"quick_replies",
"=",
"None",
",",
"persona_id",
"=",
"None",
")",
":",
"return",
"self",
".",
"manager",
".",
"observe_payload",
"(",
"receiver_id",
",",
"data",
",",
"quick_replies"... | [
62,
4
] | [
79,
9
] | python | en | ['en', 'error', 'th'] | False |
ChatServiceAgent.put_data | (self, message) |
Put data into the message queue if it hasn't already been seen.
|
Put data into the message queue if it hasn't already been seen.
| def put_data(self, message):
"""
Put data into the message queue if it hasn't already been seen.
"""
pass | [
"def",
"put_data",
"(",
"self",
",",
"message",
")",
":",
"pass"
] | [
82,
4
] | [
86,
12
] | python | en | ['en', 'error', 'th'] | False |
ChatServiceAgent._queue_action | (self, action, act_id, act_data=None) |
Add an action to the queue with given id and info if it hasn't already been
seen.
:param action:
action to be added to message queue
:param act_id:
an identifier to check if the action has been seen or to
mark the action as seen
:param act_da... |
Add an action to the queue with given id and info if it hasn't already been
seen. | def _queue_action(self, action, act_id, act_data=None):
"""
Add an action to the queue with given id and info if it hasn't already been
seen.
:param action:
action to be added to message queue
:param act_id:
an identifier to check if the action has been s... | [
"def",
"_queue_action",
"(",
"self",
",",
"action",
",",
"act_id",
",",
"act_data",
"=",
"None",
")",
":",
"if",
"act_id",
"not",
"in",
"self",
".",
"acted_packets",
":",
"self",
".",
"acted_packets",
"[",
"act_id",
"]",
"=",
"act_data",
"self",
".",
"... | [
88,
4
] | [
104,
38
] | python | en | ['en', 'error', 'th'] | False |
ChatServiceAgent.set_stored_data | (self) |
Gets agent state data from manager.
|
Gets agent state data from manager.
| def set_stored_data(self):
"""
Gets agent state data from manager.
"""
agent_state = self.manager.get_agent_state(self.id)
if agent_state is not None and hasattr(agent_state, 'stored_data'):
self.stored_data = agent_state.stored_data | [
"def",
"set_stored_data",
"(",
"self",
")",
":",
"agent_state",
"=",
"self",
".",
"manager",
".",
"get_agent_state",
"(",
"self",
".",
"id",
")",
"if",
"agent_state",
"is",
"not",
"None",
"and",
"hasattr",
"(",
"agent_state",
",",
"'stored_data'",
")",
":"... | [
106,
4
] | [
112,
54
] | python | en | ['en', 'error', 'th'] | False |
ChatServiceAgent.get_new_act_message | (self) |
Get a new act message if one exists, return None otherwise.
|
Get a new act message if one exists, return None otherwise.
| def get_new_act_message(self):
"""
Get a new act message if one exists, return None otherwise.
"""
if not self.msg_queue.empty():
return self.msg_queue.get()
return None | [
"def",
"get_new_act_message",
"(",
"self",
")",
":",
"if",
"not",
"self",
".",
"msg_queue",
".",
"empty",
"(",
")",
":",
"return",
"self",
".",
"msg_queue",
".",
"get",
"(",
")",
"return",
"None"
] | [
114,
4
] | [
120,
19
] | python | en | ['en', 'error', 'th'] | False |
ChatServiceAgent.act | (self) |
Pulls a message from the message queue.
If none exist returns None.
|
Pulls a message from the message queue. | def act(self):
"""
Pulls a message from the message queue.
If none exist returns None.
"""
msg = self.get_new_act_message()
return msg | [
"def",
"act",
"(",
"self",
")",
":",
"msg",
"=",
"self",
".",
"get_new_act_message",
"(",
")",
"return",
"msg"
] | [
122,
4
] | [
129,
18
] | 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.