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 |
|---|---|---|---|---|---|---|---|---|---|---|---|
BaseFigure._get_child_props | (self, child) |
Return the properties dict for a child trace or child layout
Note: this method must match the name/signature of one on
BasePlotlyType
Parameters
----------
child : BaseTraceType | BaseLayoutType
Returns
-------
dict
|
Return the properties dict for a child trace or child layout | def _get_child_props(self, child):
"""
Return the properties dict for a child trace or child layout
Note: this method must match the name/signature of one on
BasePlotlyType
Parameters
----------
child : BaseTraceType | BaseLayoutType
Returns
---... | [
"def",
"_get_child_props",
"(",
"self",
",",
"child",
")",
":",
"# Try to find index of child as a trace",
"# -------------------------------------",
"if",
"isinstance",
"(",
"child",
",",
"BaseTraceType",
")",
":",
"# ### Child is a trace ###",
"trace_index",
"=",
"child",... | [
1907,
4
] | [
1937,
62
] | python | en | ['en', 'error', 'th'] | False |
BaseFigure._get_child_prop_defaults | (self, child) |
Return the default properties dict for a child trace or child layout
Note: this method must match the name/signature of one on
BasePlotlyType
Parameters
----------
child : BaseTraceType | BaseLayoutType
Returns
-------
dict
|
Return the default properties dict for a child trace or child layout | def _get_child_prop_defaults(self, child):
"""
Return the default properties dict for a child trace or child layout
Note: this method must match the name/signature of one on
BasePlotlyType
Parameters
----------
child : BaseTraceType | BaseLayoutType
Ret... | [
"def",
"_get_child_prop_defaults",
"(",
"self",
",",
"child",
")",
":",
"# Child is a trace",
"# ----------------",
"if",
"isinstance",
"(",
"child",
",",
"BaseTraceType",
")",
":",
"trace_index",
"=",
"child",
".",
"_trace_ind",
"return",
"self",
".",
"_data_defa... | [
1939,
4
] | [
1968,
62
] | python | en | ['en', 'error', 'th'] | False |
BaseFigure._init_child_props | (self, child) |
Initialize the properites dict for a child trace or layout
Note: this method must match the name/signature of one on
BasePlotlyType
Parameters
----------
child : BaseTraceType | BaseLayoutType
Returns
-------
None
|
Initialize the properites dict for a child trace or layout | def _init_child_props(self, child):
"""
Initialize the properites dict for a child trace or layout
Note: this method must match the name/signature of one on
BasePlotlyType
Parameters
----------
child : BaseTraceType | BaseLayoutType
Returns
----... | [
"def",
"_init_child_props",
"(",
"self",
",",
"child",
")",
":",
"# layout and traces dict are initialize when figure is constructed",
"# and when new traces are added to the figure",
"pass"
] | [
1970,
4
] | [
1987,
12
] | python | en | ['en', 'error', 'th'] | False |
BaseFigure.layout | (self) |
The `layout` property of the figure
Returns
-------
plotly.graph_objs.Layout
|
The `layout` property of the figure | def layout(self):
"""
The `layout` property of the figure
Returns
-------
plotly.graph_objs.Layout
"""
return self["layout"] | [
"def",
"layout",
"(",
"self",
")",
":",
"return",
"self",
"[",
"\"layout\"",
"]"
] | [
2012,
4
] | [
2020,
29
] | python | en | ['en', 'error', 'th'] | False |
BaseFigure.plotly_relayout | (self, relayout_data, **kwargs) |
Perform a Plotly relayout operation on the figure's layout
Parameters
----------
relayout_data : dict
Dict of layout updates
dict keys are strings that specify the properties to be updated.
Nested properties are expressed by joining successive keys ... |
Perform a Plotly relayout operation on the figure's layout | def plotly_relayout(self, relayout_data, **kwargs):
"""
Perform a Plotly relayout operation on the figure's layout
Parameters
----------
relayout_data : dict
Dict of layout updates
dict keys are strings that specify the properties to be updated.
... | [
"def",
"plotly_relayout",
"(",
"self",
",",
"relayout_data",
",",
"*",
"*",
"kwargs",
")",
":",
"# Handle source_view_id",
"# ---------------------",
"# If not None, the source_view_id is the UID of the frontend",
"# Plotly.js view that initially triggered this relayout operation",
"... | [
2051,
4
] | [
2093,
68
] | python | en | ['en', 'error', 'th'] | False |
BaseFigure._perform_plotly_relayout | (self, relayout_data) |
Perform a relayout operation on the figure's layout data and return
the changes that were applied
Parameters
----------
relayout_data : dict[str, any]
See the docstring for plotly_relayout
Returns
-------
relayout_changes: dict[str, any]
... |
Perform a relayout operation on the figure's layout data and return
the changes that were applied | def _perform_plotly_relayout(self, relayout_data):
"""
Perform a relayout operation on the figure's layout data and return
the changes that were applied
Parameters
----------
relayout_data : dict[str, any]
See the docstring for plotly_relayout
Returns... | [
"def",
"_perform_plotly_relayout",
"(",
"self",
",",
"relayout_data",
")",
":",
"# Initialize relayout changes",
"# ---------------------------",
"# This will be a subset of the relayout_data including only the",
"# keys / values that are changed in the figure's layout data",
"relayout_chang... | [
2095,
4
] | [
2136,
31
] | python | en | ['en', 'error', 'th'] | False |
BaseFigure._is_key_path_compatible | (key_path_str, plotly_obj) |
Return whether the specifieid key path string is compatible with
the specified plotly object for the purpose of relayout/restyle
operation
|
Return whether the specifieid key path string is compatible with
the specified plotly object for the purpose of relayout/restyle
operation
| def _is_key_path_compatible(key_path_str, plotly_obj):
"""
Return whether the specifieid key path string is compatible with
the specified plotly object for the purpose of relayout/restyle
operation
"""
# Convert string to tuple of path components
# e.g. 'foo[0].b... | [
"def",
"_is_key_path_compatible",
"(",
"key_path_str",
",",
"plotly_obj",
")",
":",
"# Convert string to tuple of path components",
"# e.g. 'foo[0].bar[1]' -> ('foo', 0, 'bar', 1)",
"key_path_tuple",
"=",
"BaseFigure",
".",
"_str_to_dict_path",
"(",
"key_path_str",
")",
"# Remove... | [
2139,
4
] | [
2158,
43
] | python | en | ['en', 'error', 'th'] | False |
BaseFigure._relayout_child | (self, child, key_path_str, val) |
Process relayout operation on child layout object
Parameters
----------
child : BaseLayoutType
The figure's layout
key_path_str :
A key path string (e.g. 'foo.bar[0]')
val
Relayout value
Returns
-------
None
... |
Process relayout operation on child layout object | def _relayout_child(self, child, key_path_str, val):
"""
Process relayout operation on child layout object
Parameters
----------
child : BaseLayoutType
The figure's layout
key_path_str :
A key path string (e.g. 'foo.bar[0]')
val
... | [
"def",
"_relayout_child",
"(",
"self",
",",
"child",
",",
"key_path_str",
",",
"val",
")",
":",
"# Validate input",
"# --------------",
"assert",
"child",
"is",
"self",
".",
"layout",
"# Not in batch mode",
"# -------------",
"# Dispatch change callbacks and send relayout... | [
2160,
4
] | [
2194,
56
] | python | en | ['en', 'error', 'th'] | False |
BaseFigure._build_dispatch_plan | (key_path_strs) |
Build a dispatch plan for a list of key path strings
A dispatch plan is a dict:
- *from* path tuples that reference an object that has descendants
that are referenced in `key_path_strs`.
- *to* sets of tuples that correspond to descendants of the object
... |
Build a dispatch plan for a list of key path strings | def _build_dispatch_plan(key_path_strs):
"""
Build a dispatch plan for a list of key path strings
A dispatch plan is a dict:
- *from* path tuples that reference an object that has descendants
that are referenced in `key_path_strs`.
- *to* sets of tuples that c... | [
"def",
"_build_dispatch_plan",
"(",
"key_path_strs",
")",
":",
"dispatch_plan",
"=",
"{",
"}",
"for",
"key_path_str",
"in",
"key_path_strs",
":",
"key_path",
"=",
"BaseFigure",
".",
"_str_to_dict_path",
"(",
"key_path_str",
")",
"key_path_so_far",
"=",
"(",
")",
... | [
2199,
4
] | [
2260,
28
] | python | en | ['en', 'error', 'th'] | False |
BaseFigure._dispatch_layout_change_callbacks | (self, relayout_data) |
Dispatch property change callbacks given relayout_data
Parameters
----------
relayout_data : dict[str, any]
See docstring for plotly_relayout.
Returns
-------
None
|
Dispatch property change callbacks given relayout_data | def _dispatch_layout_change_callbacks(self, relayout_data):
"""
Dispatch property change callbacks given relayout_data
Parameters
----------
relayout_data : dict[str, any]
See docstring for plotly_relayout.
Returns
-------
None
"""
... | [
"def",
"_dispatch_layout_change_callbacks",
"(",
"self",
",",
"relayout_data",
")",
":",
"# Build dispatch plan",
"# -------------------",
"key_path_strs",
"=",
"list",
"(",
"relayout_data",
".",
"keys",
"(",
")",
")",
"dispatch_plan",
"=",
"BaseFigure",
".",
"_build_... | [
2262,
4
] | [
2286,
74
] | python | en | ['en', 'error', 'th'] | False |
BaseFigure._dispatch_trace_change_callbacks | (self, restyle_data, trace_indexes) |
Dispatch property change callbacks given restyle_data
Parameters
----------
restyle_data : dict[str, any]
See docstring for plotly_restyle.
trace_indexes : list[int]
List of trace indexes that restyle operation applied to
Returns
------... |
Dispatch property change callbacks given restyle_data | def _dispatch_trace_change_callbacks(self, restyle_data, trace_indexes):
"""
Dispatch property change callbacks given restyle_data
Parameters
----------
restyle_data : dict[str, any]
See docstring for plotly_restyle.
trace_indexes : list[int]
Lis... | [
"def",
"_dispatch_trace_change_callbacks",
"(",
"self",
",",
"restyle_data",
",",
"trace_indexes",
")",
":",
"# Build dispatch plan",
"# -------------------",
"key_path_strs",
"=",
"list",
"(",
"restyle_data",
".",
"keys",
"(",
")",
")",
"dispatch_plan",
"=",
"BaseFig... | [
2288,
4
] | [
2318,
78
] | python | en | ['en', 'error', 'th'] | False |
BaseFigure.frames | (self) |
The `frames` property is a tuple of the figure's frame objects
Returns
-------
tuple[plotly.graph_objs.Frame]
|
The `frames` property is a tuple of the figure's frame objects | def frames(self):
"""
The `frames` property is a tuple of the figure's frame objects
Returns
-------
tuple[plotly.graph_objs.Frame]
"""
return self["frames"] | [
"def",
"frames",
"(",
"self",
")",
":",
"return",
"self",
"[",
"\"frames\"",
"]"
] | [
2323,
4
] | [
2331,
29
] | python | en | ['en', 'error', 'th'] | False |
BaseFigure.plotly_update | (
self, restyle_data=None, relayout_data=None, trace_indexes=None, **kwargs
) |
Perform a Plotly update operation on the figure.
Note: This operation both mutates and returns the figure
Parameters
----------
restyle_data : dict
Traces update specification. See the docstring for the
`plotly_restyle` method for details
relayo... |
Perform a Plotly update operation on the figure. | def plotly_update(
self, restyle_data=None, relayout_data=None, trace_indexes=None, **kwargs
):
"""
Perform a Plotly update operation on the figure.
Note: This operation both mutates and returns the figure
Parameters
----------
restyle_data : dict
... | [
"def",
"plotly_update",
"(",
"self",
",",
"restyle_data",
"=",
"None",
",",
"relayout_data",
"=",
"None",
",",
"trace_indexes",
"=",
"None",
",",
"*",
"*",
"kwargs",
")",
":",
"# Handle source_view_id",
"# ---------------------",
"# If not None, the source_view_id is ... | [
2344,
4
] | [
2416,
68
] | python | en | ['en', 'error', 'th'] | False |
BaseFigure.batch_update | (self) |
A context manager that batches up trace and layout assignment
operations into a singe plotly_update message that is executed when
the context exits.
Examples
--------
For example, suppose we have a figure widget, `fig`, with a single
trace.
>>> import p... |
A context manager that batches up trace and layout assignment
operations into a singe plotly_update message that is executed when
the context exits. | def batch_update(self):
"""
A context manager that batches up trace and layout assignment
operations into a singe plotly_update message that is executed when
the context exits.
Examples
--------
For example, suppose we have a figure widget, `fig`, with a single
... | [
"def",
"batch_update",
"(",
"self",
")",
":",
"if",
"self",
".",
"_in_batch_mode",
"is",
"True",
":",
"yield",
"else",
":",
"try",
":",
"self",
".",
"_in_batch_mode",
"=",
"True",
"yield",
"finally",
":",
"# ### Disable batch mode ###",
"self",
".",
"_in_bat... | [
2480,
4
] | [
2546,
47
] | python | en | ['en', 'error', 'th'] | False |
BaseFigure._build_update_params_from_batch | (self) |
Convert `_batch_trace_edits` and `_batch_layout_edits` into the
`restyle_data`, `relayout_data`, and `trace_indexes` params accepted
by the `plotly_update` method.
Returns
-------
(dict, dict, list[int])
|
Convert `_batch_trace_edits` and `_batch_layout_edits` into the
`restyle_data`, `relayout_data`, and `trace_indexes` params accepted
by the `plotly_update` method. | def _build_update_params_from_batch(self):
"""
Convert `_batch_trace_edits` and `_batch_layout_edits` into the
`restyle_data`, `relayout_data`, and `trace_indexes` params accepted
by the `plotly_update` method.
Returns
-------
(dict, dict, list[int])
"""
... | [
"def",
"_build_update_params_from_batch",
"(",
"self",
")",
":",
"# Handle Style / Trace Indexes",
"# ----------------------------",
"batch_style_commands",
"=",
"self",
".",
"_batch_trace_edits",
"trace_indexes",
"=",
"sorted",
"(",
"set",
"(",
"[",
"trace_ind",
"for",
"... | [
2548,
4
] | [
2591,
57
] | python | en | ['en', 'error', 'th'] | False |
BaseFigure.batch_animate | (self, duration=500, easing="cubic-in-out") |
Context manager to animate trace / layout updates
Parameters
----------
duration : number
The duration of the transition, in milliseconds.
If equal to zero, updates are synchronous.
easing : string
The easing function used for the transition.... |
Context manager to animate trace / layout updates | def batch_animate(self, duration=500, easing="cubic-in-out"):
"""
Context manager to animate trace / layout updates
Parameters
----------
duration : number
The duration of the transition, in milliseconds.
If equal to zero, updates are synchronous.
... | [
"def",
"batch_animate",
"(",
"self",
",",
"duration",
"=",
"500",
",",
"easing",
"=",
"\"cubic-in-out\"",
")",
":",
"# Validate inputs",
"# ---------------",
"duration",
"=",
"self",
".",
"_animation_duration_validator",
".",
"validate_coerce",
"(",
"duration",
")",... | [
2594,
4
] | [
2688,
17
] | python | en | ['en', 'error', 'th'] | False |
BaseFigure._perform_batch_animate | (self, animation_opts) |
Perform the batch animate operation
This method should be called with the batch_animate() context
manager exits.
Parameters
----------
animation_opts : dict
Animation options as accepted by frontend Plotly.animation command
Returns
-------
... |
Perform the batch animate operation | def _perform_batch_animate(self, animation_opts):
"""
Perform the batch animate operation
This method should be called with the batch_animate() context
manager exits.
Parameters
----------
animation_opts : dict
Animation options as accepted by fronte... | [
"def",
"_perform_batch_animate",
"(",
"self",
",",
"animation_opts",
")",
":",
"# Apply commands to internal dictionaries as an update",
"# ----------------------------------------------------",
"(",
"restyle_data",
",",
"relayout_data",
",",
"trace_indexes",
",",
")",
"=",
"se... | [
2690,
4
] | [
2757,
68
] | python | en | ['en', 'error', 'th'] | False |
BaseFigure.to_dict | (self) |
Convert figure to a dictionary
Note: the dictionary includes the properties explicitly set by the
user, it does not include default values of unspecified properties
Returns
-------
dict
|
Convert figure to a dictionary | def to_dict(self):
"""
Convert figure to a dictionary
Note: the dictionary includes the properties explicitly set by the
user, it does not include default values of unspecified properties
Returns
-------
dict
"""
# Handle data
# ---------... | [
"def",
"to_dict",
"(",
"self",
")",
":",
"# Handle data",
"# -----------",
"data",
"=",
"deepcopy",
"(",
"self",
".",
"_data",
")",
"# Handle layout",
"# -------------",
"layout",
"=",
"deepcopy",
"(",
"self",
".",
"_layout",
")",
"# Handle frames",
"# ---------... | [
2761,
4
] | [
2788,
18
] | python | en | ['en', 'error', 'th'] | False |
BaseFigure.to_plotly_json | (self) |
Convert figure to a JSON representation as a Python dict
Returns
-------
dict
|
Convert figure to a JSON representation as a Python dict | def to_plotly_json(self):
"""
Convert figure to a JSON representation as a Python dict
Returns
-------
dict
"""
return self.to_dict() | [
"def",
"to_plotly_json",
"(",
"self",
")",
":",
"return",
"self",
".",
"to_dict",
"(",
")"
] | [
2790,
4
] | [
2798,
29
] | python | en | ['en', 'error', 'th'] | False |
BaseFigure._to_ordered_dict | (d, skip_uid=False) |
Static helper for converting dict or list to structure of ordered
dictionaries
|
Static helper for converting dict or list to structure of ordered
dictionaries
| def _to_ordered_dict(d, skip_uid=False):
"""
Static helper for converting dict or list to structure of ordered
dictionaries
"""
if isinstance(d, dict):
# d is a dict
result = collections.OrderedDict()
for key in sorted(d.keys()):
... | [
"def",
"_to_ordered_dict",
"(",
"d",
",",
"skip_uid",
"=",
"False",
")",
":",
"if",
"isinstance",
"(",
"d",
",",
"dict",
")",
":",
"# d is a dict",
"result",
"=",
"collections",
".",
"OrderedDict",
"(",
")",
"for",
"key",
"in",
"sorted",
"(",
"d",
".",... | [
2801,
4
] | [
2821,
21
] | python | en | ['en', 'error', 'th'] | False |
remove_first_sv | (emb, first_sv) |
Projects out the first singular value (first_sv) from the embedding (emb).
Inputs:
emb: torch Tensor shape (glove_dim)
first_sv: torch Tensor shape (glove_dim)
Returns:
new emb: torch Tensor shape (glove_dim)
|
Projects out the first singular value (first_sv) from the embedding (emb). | def remove_first_sv(emb, first_sv):
"""
Projects out the first singular value (first_sv) from the embedding (emb).
Inputs:
emb: torch Tensor shape (glove_dim)
first_sv: torch Tensor shape (glove_dim)
Returns:
new emb: torch Tensor shape (glove_dim)
"""
# Calculate dot prod of... | [
"def",
"remove_first_sv",
"(",
"emb",
",",
"first_sv",
")",
":",
"# Calculate dot prod of emb and first_sv using torch.mm:",
"# (1, glove_dim) x (glove_dim, 1) -> (1,1) -> float",
"dot_prod",
"=",
"torch",
".",
"mm",
"(",
"torch",
".",
"unsqueeze",
"(",
"emb",
",",
"0",
... | [
222,
0
] | [
236,
36
] | python | en | ['en', 'error', 'th'] | False |
get_word_counts | (opt, count_inputs) |
Goes through the dataset specified in opt, returns word counts and all utterances.
Inputs:
count_inputs: If True, include both input and reply when counting words and
utterances. Otherwise, only include reply text.
Returns:
word_counter: a Counter mapping each word to the total number... |
Goes through the dataset specified in opt, returns word counts and all utterances. | def get_word_counts(opt, count_inputs):
"""
Goes through the dataset specified in opt, returns word counts and all utterances.
Inputs:
count_inputs: If True, include both input and reply when counting words and
utterances. Otherwise, only include reply text.
Returns:
word_counter: ... | [
"def",
"get_word_counts",
"(",
"opt",
",",
"count_inputs",
")",
":",
"# Create repeat label agent and assign it to the specified task",
"agent",
"=",
"RepeatLabelAgent",
"(",
"opt",
")",
"world",
"=",
"create_task",
"(",
"opt",
",",
"agent",
")",
"# Count word frequency... | [
239,
0
] | [
290,
46
] | python | en | ['en', 'error', 'th'] | False |
learn_arora | (opt) |
Go through ConvAI2 data and collect word counts, thus compute the unigram
probability distribution. Use those probs to compute weighted sentence embeddings
for all utterances, thus compute first principal component.
Save all info to arora.pkl file.
|
Go through ConvAI2 data and collect word counts, thus compute the unigram
probability distribution. Use those probs to compute weighted sentence embeddings
for all utterances, thus compute first principal component. | def learn_arora(opt):
"""
Go through ConvAI2 data and collect word counts, thus compute the unigram
probability distribution. Use those probs to compute weighted sentence embeddings
for all utterances, thus compute first principal component.
Save all info to arora.pkl file.
"""
arora_file =... | [
"def",
"learn_arora",
"(",
"opt",
")",
":",
"arora_file",
"=",
"os",
".",
"path",
".",
"join",
"(",
"opt",
"[",
"'datapath'",
"]",
",",
"'controllable_dialogue'",
",",
"'arora.pkl'",
")",
"opt",
"[",
"'task'",
"]",
"=",
"'fromfile:parlaiformat'",
"opt",
"[... | [
293,
0
] | [
395,
9
] | python | en | ['en', 'error', 'th'] | False |
load_arora | (opt) |
Load the data in the arora.pkl file in data/controllable_dialogue.
|
Load the data in the arora.pkl file in data/controllable_dialogue.
| def load_arora(opt):
"""
Load the data in the arora.pkl file in data/controllable_dialogue.
"""
arora_fp = os.path.join(opt['datapath'], CONTROLLABLE_DIR, 'arora.pkl')
print("Loading Arora embedding info from %s..." % arora_fp)
with PathManager.open(arora_fp, "rb") as f:
data = pickle.lo... | [
"def",
"load_arora",
"(",
"opt",
")",
":",
"arora_fp",
"=",
"os",
".",
"path",
".",
"join",
"(",
"opt",
"[",
"'datapath'",
"]",
",",
"CONTROLLABLE_DIR",
",",
"'arora.pkl'",
")",
"print",
"(",
"\"Loading Arora embedding info from %s...\"",
"%",
"arora_fp",
")",... | [
398,
0
] | [
407,
15
] | python | en | ['en', 'error', 'th'] | False |
SentenceEmbedder.__init__ | (self, word2prob, arora_a, glove_name, glove_dim, first_sv, data_path) |
Inputs:
word2prob: dict mapping words to their unigram probs
arora_a: a float. Is the constant (called "a" in the paper)
used to compute Arora sentence embeddings.
glove_name: the version of GloVe to use, e.g. '840B'
glove_dim: the dimension of the GloVe embe... |
Inputs:
word2prob: dict mapping words to their unigram probs
arora_a: a float. Is the constant (called "a" in the paper)
used to compute Arora sentence embeddings.
glove_name: the version of GloVe to use, e.g. '840B'
glove_dim: the dimension of the GloVe embe... | def __init__(self, word2prob, arora_a, glove_name, glove_dim, first_sv, data_path):
"""
Inputs:
word2prob: dict mapping words to their unigram probs
arora_a: a float. Is the constant (called "a" in the paper)
used to compute Arora sentence embeddings.
glove_name... | [
"def",
"__init__",
"(",
"self",
",",
"word2prob",
",",
"arora_a",
",",
"glove_name",
",",
"glove_dim",
",",
"first_sv",
",",
"data_path",
")",
":",
"self",
".",
"word2prob",
"=",
"word2prob",
"self",
".",
"arora_a",
"=",
"arora_a",
"self",
".",
"glove_name... | [
37,
4
] | [
68,
38
] | python | en | ['en', 'error', 'th'] | False |
SentenceEmbedder.get_glove_embs | (self) |
Loads torchtext GloVe embs from file and stores in self.tt_embs.
|
Loads torchtext GloVe embs from file and stores in self.tt_embs.
| def get_glove_embs(self):
"""
Loads torchtext GloVe embs from file and stores in self.tt_embs.
"""
if not hasattr(self, 'glove_cache'):
self.glove_cache = modelzoo_path(self.data_path, 'models:glove_vectors')
print('Loading torchtext GloVe embs (for Arora sentence emb... | [
"def",
"get_glove_embs",
"(",
"self",
")",
":",
"if",
"not",
"hasattr",
"(",
"self",
",",
"'glove_cache'",
")",
":",
"self",
".",
"glove_cache",
"=",
"modelzoo_path",
"(",
"self",
".",
"data_path",
",",
"'models:glove_vectors'",
")",
"print",
"(",
"'Loading ... | [
70,
4
] | [
80,
54
] | python | en | ['en', 'error', 'th'] | False |
SentenceEmbedder.get_emb_matrix | (self, dictionary) |
Construct an embedding matrix containing pretrained GloVe vectors for all words
in dictionary, and store in self.emb_matrix. This is needed for response-
relatedness weighted decoding.
Inputs:
dictionary: ParlAI dictionary
|
Construct an embedding matrix containing pretrained GloVe vectors for all words
in dictionary, and store in self.emb_matrix. This is needed for response-
relatedness weighted decoding. | def get_emb_matrix(self, dictionary):
"""
Construct an embedding matrix containing pretrained GloVe vectors for all words
in dictionary, and store in self.emb_matrix. This is needed for response-
relatedness weighted decoding.
Inputs:
dictionary: ParlAI dictionary
... | [
"def",
"get_emb_matrix",
"(",
"self",
",",
"dictionary",
")",
":",
"print",
"(",
"'Constructing GloVe emb matrix for response-relatedness weighted '",
"'decoding...'",
")",
"self",
".",
"emb_matrix",
"=",
"[",
"]",
"oov_indices",
"=",
"[",
"]",
"# list of dictionary ind... | [
82,
4
] | [
120,
43
] | python | en | ['en', 'error', 'th'] | False |
SentenceEmbedder.get_word_sims | (self, sent, sent_emb, dictionary) |
Given a sentence and its Arora-style sentence embedding, compute the cosine
similarities to it, for all words in the dictionary.
Inputs:
sent: string. Used only for caching lookup purposes.
sent_emb: torch Tensor shape (glove_dim).
dictionary: ParlAI dictionary
... |
Given a sentence and its Arora-style sentence embedding, compute the cosine
similarities to it, for all words in the dictionary. | def get_word_sims(self, sent, sent_emb, dictionary):
"""
Given a sentence and its Arora-style sentence embedding, compute the cosine
similarities to it, for all words in the dictionary.
Inputs:
sent: string. Used only for caching lookup purposes.
sent_emb: torch Tens... | [
"def",
"get_word_sims",
"(",
"self",
",",
"sent",
",",
"sent_emb",
",",
"dictionary",
")",
":",
"# If we haven't initialized the GloVe emb matrix yet, do so",
"if",
"self",
".",
"emb_matrix",
"is",
"None",
":",
"self",
".",
"get_emb_matrix",
"(",
"dictionary",
")",
... | [
122,
4
] | [
161,
19
] | python | en | ['en', 'error', 'th'] | False |
SentenceEmbedder.embed_sent | (self, sent, rem_first_sv=True) |
Produce a Arora-style sentence embedding for a given sentence.
Inputs:
sent: tokenized sentence; a list of strings
rem_first_sv: If True, remove the first singular value when you compute the
sentence embddings. Otherwise, don't remove it.
Returns:
sent... |
Produce a Arora-style sentence embedding for a given sentence. | def embed_sent(self, sent, rem_first_sv=True):
"""
Produce a Arora-style sentence embedding for a given sentence.
Inputs:
sent: tokenized sentence; a list of strings
rem_first_sv: If True, remove the first singular value when you compute the
sentence embddings. O... | [
"def",
"embed_sent",
"(",
"self",
",",
"sent",
",",
"rem_first_sv",
"=",
"True",
")",
":",
"# If we haven't loaded the torchtext GloVe embeddings, do so",
"if",
"self",
".",
"tt_embs",
"is",
"None",
":",
"self",
".",
"get_glove_embs",
"(",
")",
"# Lookup glove embed... | [
163,
4
] | [
219,
23
] | python | en | ['en', 'error', 'th'] | False |
TestPing.test_init | (self) | Test initialization. | Test initialization. | def test_init(self):
"""Test initialization."""
assert self.test_ping.comment == self.test_comment
assert self.test_ping.response_requested == self.test_response_requested | [
"def",
"test_init",
"(",
"self",
")",
":",
"assert",
"self",
".",
"test_ping",
".",
"comment",
"==",
"self",
".",
"test_comment",
"assert",
"self",
".",
"test_ping",
".",
"response_requested",
"==",
"self",
".",
"test_response_requested"
] | [
16,
4
] | [
19,
80
] | python | co | ['es', 'co', 'en'] | False |
TestPing.test_deserialize | (self, mock_ping_schema_load) |
Test deserialization.
|
Test deserialization.
| def test_deserialize(self, mock_ping_schema_load):
"""
Test deserialization.
"""
obj = {"obj": "obj"}
msg = Ping.deserialize(obj)
mock_ping_schema_load.assert_called_once_with(obj)
assert msg is mock_ping_schema_load.return_value | [
"def",
"test_deserialize",
"(",
"self",
",",
"mock_ping_schema_load",
")",
":",
"obj",
"=",
"{",
"\"obj\"",
":",
"\"obj\"",
"}",
"msg",
"=",
"Ping",
".",
"deserialize",
"(",
"obj",
")",
"mock_ping_schema_load",
".",
"assert_called_once_with",
"(",
"obj",
")",
... | [
26,
4
] | [
35,
56
] | python | en | ['en', 'error', 'th'] | False |
TestPing.test_serialize | (self, mock_ping_schema_load) |
Test serialization.
|
Test serialization.
| def test_serialize(self, mock_ping_schema_load):
"""
Test serialization.
"""
msg_dict = self.test_ping.serialize()
mock_ping_schema_load.assert_called_once_with(self.test_ping)
assert msg_dict is mock_ping_schema_load.return_value | [
"def",
"test_serialize",
"(",
"self",
",",
"mock_ping_schema_load",
")",
":",
"msg_dict",
"=",
"self",
".",
"test_ping",
".",
"serialize",
"(",
")",
"mock_ping_schema_load",
".",
"assert_called_once_with",
"(",
"self",
".",
"test_ping",
")",
"assert",
"msg_dict",
... | [
38,
4
] | [
45,
61
] | 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(GeneralDebugCog(bot)) | [
"def",
"setup",
"(",
"bot",
")",
":",
"bot",
".",
"add_cog",
"(",
"GeneralDebugCog",
"(",
"bot",
")",
")"
] | [
579,
0
] | [
583,
37
] | python | en | ['en', 'error', 'th'] | False |
ErrorY.array | (self) |
Sets the data corresponding the length of each error bar.
Values are plotted relative to the underlying data.
The 'array' property is an array that may be specified as a tuple,
list, numpy array, or pandas Series
Returns
-------
numpy.ndarray
|
Sets the data corresponding the length of each error bar.
Values are plotted relative to the underlying data.
The 'array' property is an array that may be specified as a tuple,
list, numpy array, or pandas Series | def array(self):
"""
Sets the data corresponding the length of each error bar.
Values are plotted relative to the underlying data.
The 'array' property is an array that may be specified as a tuple,
list, numpy array, or pandas Series
Returns
-------
... | [
"def",
"array",
"(",
"self",
")",
":",
"return",
"self",
"[",
"\"array\"",
"]"
] | [
30,
4
] | [
42,
28
] | python | en | ['en', 'error', 'th'] | False |
ErrorY.arrayminus | (self) |
Sets the data corresponding the length of each error bar in the
bottom (left) direction for vertical (horizontal) bars Values
are plotted relative to the underlying data.
The 'arrayminus' property is an array that may be specified as a tuple,
list, numpy array, or pandas Se... |
Sets the data corresponding the length of each error bar in the
bottom (left) direction for vertical (horizontal) bars Values
are plotted relative to the underlying data.
The 'arrayminus' property is an array that may be specified as a tuple,
list, numpy array, or pandas Se... | def arrayminus(self):
"""
Sets the data corresponding the length of each error bar in the
bottom (left) direction for vertical (horizontal) bars Values
are plotted relative to the underlying data.
The 'arrayminus' property is an array that may be specified as a tuple,
... | [
"def",
"arrayminus",
"(",
"self",
")",
":",
"return",
"self",
"[",
"\"arrayminus\"",
"]"
] | [
51,
4
] | [
64,
33
] | python | en | ['en', 'error', 'th'] | False |
ErrorY.arrayminussrc | (self) |
Sets the source reference on Chart Studio Cloud for arrayminus
.
The 'arrayminussrc' 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 arrayminus
.
The 'arrayminussrc' property must be specified as a string or
as a plotly.grid_objs.Column object | def arrayminussrc(self):
"""
Sets the source reference on Chart Studio Cloud for arrayminus
.
The 'arrayminussrc' property must be specified as a string or
as a plotly.grid_objs.Column object
Returns
-------
str
"""
return self["arra... | [
"def",
"arrayminussrc",
"(",
"self",
")",
":",
"return",
"self",
"[",
"\"arrayminussrc\"",
"]"
] | [
73,
4
] | [
85,
36
] | python | en | ['en', 'error', 'th'] | False |
ErrorY.arraysrc | (self) |
Sets the source reference on Chart Studio Cloud for array .
The 'arraysrc' 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 array .
The 'arraysrc' property must be specified as a string or
as a plotly.grid_objs.Column object | def arraysrc(self):
"""
Sets the source reference on Chart Studio Cloud for array .
The 'arraysrc' property must be specified as a string or
as a plotly.grid_objs.Column object
Returns
-------
str
"""
return self["arraysrc"] | [
"def",
"arraysrc",
"(",
"self",
")",
":",
"return",
"self",
"[",
"\"arraysrc\"",
"]"
] | [
94,
4
] | [
105,
31
] | python | en | ['en', 'error', 'th'] | False |
ErrorY.color | (self) |
Sets the stoke color of the error bars.
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%,1... |
Sets the stoke color of the error bars.
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%,1... | def color(self):
"""
Sets the stoke color of the error bars.
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/hsv... | [
"def",
"color",
"(",
"self",
")",
":",
"return",
"self",
"[",
"\"color\"",
"]"
] | [
114,
4
] | [
164,
28
] | python | en | ['en', 'error', 'th'] | False |
ErrorY.symmetric | (self) |
Determines whether or not the error bars have the same length
in both direction (top/bottom for vertical bars, left/right for
horizontal bars.
The 'symmetric' property must be specified as a bool
(either True, or False)
Returns
-------
bool
|
Determines whether or not the error bars have the same length
in both direction (top/bottom for vertical bars, left/right for
horizontal bars.
The 'symmetric' property must be specified as a bool
(either True, or False) | def symmetric(self):
"""
Determines whether or not the error bars have the same length
in both direction (top/bottom for vertical bars, left/right for
horizontal bars.
The 'symmetric' property must be specified as a bool
(either True, or False)
Returns
... | [
"def",
"symmetric",
"(",
"self",
")",
":",
"return",
"self",
"[",
"\"symmetric\"",
"]"
] | [
173,
4
] | [
186,
32
] | python | en | ['en', 'error', 'th'] | False |
ErrorY.thickness | (self) |
Sets the thickness (in px) of the error bars.
The 'thickness' property is a number and may be specified as:
- An int or float in the interval [0, inf]
Returns
-------
int|float
|
Sets the thickness (in px) of the error bars.
The 'thickness' property is a number and may be specified as:
- An int or float in the interval [0, inf] | def thickness(self):
"""
Sets the thickness (in px) of the error bars.
The 'thickness' property is a number and may be specified as:
- An int or float in the interval [0, inf]
Returns
-------
int|float
"""
return self["thickness"] | [
"def",
"thickness",
"(",
"self",
")",
":",
"return",
"self",
"[",
"\"thickness\"",
"]"
] | [
195,
4
] | [
206,
32
] | python | en | ['en', 'error', 'th'] | False |
ErrorY.traceref | (self) |
The 'traceref' property is a integer and may be specified as:
- An int (or float that will be cast to an int)
in the interval [0, 9223372036854775807]
Returns
-------
int
|
The 'traceref' property is a integer and may be specified as:
- An int (or float that will be cast to an int)
in the interval [0, 9223372036854775807] | def traceref(self):
"""
The 'traceref' property is a integer and may be specified as:
- An int (or float that will be cast to an int)
in the interval [0, 9223372036854775807]
Returns
-------
int
"""
return self["traceref"] | [
"def",
"traceref",
"(",
"self",
")",
":",
"return",
"self",
"[",
"\"traceref\"",
"]"
] | [
215,
4
] | [
225,
31
] | python | en | ['en', 'error', 'th'] | False |
ErrorY.tracerefminus | (self) |
The 'tracerefminus' property is a integer and may be specified as:
- An int (or float that will be cast to an int)
in the interval [0, 9223372036854775807]
Returns
-------
int
|
The 'tracerefminus' property is a integer and may be specified as:
- An int (or float that will be cast to an int)
in the interval [0, 9223372036854775807] | def tracerefminus(self):
"""
The 'tracerefminus' property is a integer and may be specified as:
- An int (or float that will be cast to an int)
in the interval [0, 9223372036854775807]
Returns
-------
int
"""
return self["tracerefminus"] | [
"def",
"tracerefminus",
"(",
"self",
")",
":",
"return",
"self",
"[",
"\"tracerefminus\"",
"]"
] | [
234,
4
] | [
244,
36
] | python | en | ['en', 'error', 'th'] | False |
ErrorY.type | (self) |
Determines the rule used to generate the error bars. If
*constant`, the bar lengths are of a constant value. Set this
constant in `value`. If "percent", the bar lengths correspond
to a percentage of underlying data. Set this percentage in
`value`. If "sqrt", the bar lengths corr... |
Determines the rule used to generate the error bars. If
*constant`, the bar lengths are of a constant value. Set this
constant in `value`. If "percent", the bar lengths correspond
to a percentage of underlying data. Set this percentage in
`value`. If "sqrt", the bar lengths corr... | def type(self):
"""
Determines the rule used to generate the error bars. If
*constant`, the bar lengths are of a constant value. Set this
constant in `value`. If "percent", the bar lengths correspond
to a percentage of underlying data. Set this percentage in
`value`. If "... | [
"def",
"type",
"(",
"self",
")",
":",
"return",
"self",
"[",
"\"type\"",
"]"
] | [
253,
4
] | [
271,
27
] | python | en | ['en', 'error', 'th'] | False |
ErrorY.value | (self) |
Sets the value of either the percentage (if `type` is set to
"percent") or the constant (if `type` is set to "constant")
corresponding to the lengths of the error bars.
The 'value' property is a number and may be specified as:
- An int or float in the interval [0, inf]
... |
Sets the value of either the percentage (if `type` is set to
"percent") or the constant (if `type` is set to "constant")
corresponding to the lengths of the error bars.
The 'value' property is a number and may be specified as:
- An int or float in the interval [0, inf] | def value(self):
"""
Sets the value of either the percentage (if `type` is set to
"percent") or the constant (if `type` is set to "constant")
corresponding to the lengths of the error bars.
The 'value' property is a number and may be specified as:
- An int or float... | [
"def",
"value",
"(",
"self",
")",
":",
"return",
"self",
"[",
"\"value\"",
"]"
] | [
280,
4
] | [
293,
28
] | python | en | ['en', 'error', 'th'] | False |
ErrorY.valueminus | (self) |
Sets the value of either the percentage (if `type` is set to
"percent") or the constant (if `type` is set to "constant")
corresponding to the lengths of the error bars in the bottom
(left) direction for vertical (horizontal) bars
The 'valueminus' property is a number and ma... |
Sets the value of either the percentage (if `type` is set to
"percent") or the constant (if `type` is set to "constant")
corresponding to the lengths of the error bars in the bottom
(left) direction for vertical (horizontal) bars
The 'valueminus' property is a number and ma... | def valueminus(self):
"""
Sets the value of either the percentage (if `type` is set to
"percent") or the constant (if `type` is set to "constant")
corresponding to the lengths of the error bars in the bottom
(left) direction for vertical (horizontal) bars
The 'valuem... | [
"def",
"valueminus",
"(",
"self",
")",
":",
"return",
"self",
"[",
"\"valueminus\"",
"]"
] | [
302,
4
] | [
316,
33
] | python | en | ['en', 'error', 'th'] | False |
ErrorY.visible | (self) |
Determines whether or not this set of error bars is visible.
The 'visible' property must be specified as a bool
(either True, or False)
Returns
-------
bool
|
Determines whether or not this set of error bars is visible.
The 'visible' property must be specified as a bool
(either True, or False) | def visible(self):
"""
Determines whether or not this set of error bars is visible.
The 'visible' property must be specified as a bool
(either True, or False)
Returns
-------
bool
"""
return self["visible"] | [
"def",
"visible",
"(",
"self",
")",
":",
"return",
"self",
"[",
"\"visible\"",
"]"
] | [
325,
4
] | [
336,
30
] | python | en | ['en', 'error', 'th'] | False |
ErrorY.width | (self) |
Sets the width (in px) of the cross-bar at both ends of the
error bars.
The 'width' property is a number and may be specified as:
- An int or float in the interval [0, inf]
Returns
-------
int|float
|
Sets the width (in px) of the cross-bar at both ends of the
error bars.
The 'width' property is a number and may be specified as:
- An int or float in the interval [0, inf] | def width(self):
"""
Sets the width (in px) of the cross-bar at both ends of the
error bars.
The 'width' property is a number and may be specified as:
- An int or float in the interval [0, inf]
Returns
-------
int|float
"""
return s... | [
"def",
"width",
"(",
"self",
")",
":",
"return",
"self",
"[",
"\"width\"",
"]"
] | [
345,
4
] | [
357,
28
] | python | en | ['en', 'error', 'th'] | False |
ErrorY.__init__ | (
self,
arg=None,
array=None,
arrayminus=None,
arrayminussrc=None,
arraysrc=None,
color=None,
symmetric=None,
thickness=None,
traceref=None,
tracerefminus=None,
type=None,
value=None,
valueminus=None,
... |
Construct a new ErrorY object
Parameters
----------
arg
dict of properties compatible with this constructor or
an instance of :class:`plotly.graph_objs.bar.ErrorY`
array
Sets the data corresponding the length of each error
... |
Construct a new ErrorY object
Parameters
----------
arg
dict of properties compatible with this constructor or
an instance of :class:`plotly.graph_objs.bar.ErrorY`
array
Sets the data corresponding the length of each error
... | def __init__(
self,
arg=None,
array=None,
arrayminus=None,
arrayminussrc=None,
arraysrc=None,
color=None,
symmetric=None,
thickness=None,
traceref=None,
tracerefminus=None,
type=None,
value=None,
valueminus=N... | [
"def",
"__init__",
"(",
"self",
",",
"arg",
"=",
"None",
",",
"array",
"=",
"None",
",",
"arrayminus",
"=",
"None",
",",
"arrayminussrc",
"=",
"None",
",",
"arraysrc",
"=",
"None",
",",
"color",
"=",
"None",
",",
"symmetric",
"=",
"None",
",",
"thick... | [
423,
4
] | [
600,
34
] | python | en | ['en', 'error', 'th'] | False |
MessageSocketHandler.open | (self) |
Opens a websocket and assigns a random UUID that is stored in the class-level
`subs` variable.
|
Opens a websocket and assigns a random UUID that is stored in the class-level
`subs` variable.
| def open(self):
"""
Opens a websocket and assigns a random UUID that is stored in the class-level
`subs` variable.
"""
if self.sid not in self.subs.values():
self.subs[self.sid] = self
self.set_nodelay(True) | [
"def",
"open",
"(",
"self",
")",
":",
"if",
"self",
".",
"sid",
"not",
"in",
"self",
".",
"subs",
".",
"values",
"(",
")",
":",
"self",
".",
"subs",
"[",
"self",
".",
"sid",
"]",
"=",
"self",
"self",
".",
"set_nodelay",
"(",
"True",
")"
] | [
31,
4
] | [
38,
34
] | python | en | ['en', 'error', 'th'] | False |
MessageSocketHandler.on_close | (self) |
Runs when a socket is closed.
|
Runs when a socket is closed.
| def on_close(self):
"""
Runs when a socket is closed.
"""
if self.sid in self.subs:
del self.subs[self.sid] | [
"def",
"on_close",
"(",
"self",
")",
":",
"if",
"self",
".",
"sid",
"in",
"self",
".",
"subs",
":",
"del",
"self",
".",
"subs",
"[",
"self",
".",
"sid",
"]"
] | [
40,
4
] | [
45,
35
] | python | en | ['en', 'error', 'th'] | False |
MessageSocketHandler.on_message | (self, message_text) |
Callback that runs when a new message is received from a client See the
chat_service README for the resultant message structure.
Args:
message_text: A stringified JSON object with a text or attachment key.
`text` should contain a string message and `attachment` is a... |
Callback that runs when a new message is received from a client See the
chat_service README for the resultant message structure. | def on_message(self, message_text):
"""
Callback that runs when a new message is received from a client See the
chat_service README for the resultant message structure.
Args:
message_text: A stringified JSON object with a text or attachment key.
`text` should... | [
"def",
"on_message",
"(",
"self",
",",
"message_text",
")",
":",
"logging",
".",
"info",
"(",
"'websocket message from client: {}'",
".",
"format",
"(",
"message_text",
")",
")",
"message",
"=",
"json",
".",
"loads",
"(",
"message_text",
")",
"message_history",
... | [
47,
4
] | [
72,
38
] | python | en | ['en', 'error', 'th'] | False |
run_migrations_offline | () | Run migrations in 'offline' mode.ec
This configures the context with just a URL
and not an Engine, though an Engine is acceptable
here as well. By skipping the Engine creation
we don't even need a DBAPI to be available.
Calls to context.execute() here emit the given string to the
script outpu... | Run migrations in 'offline' mode.ec | def run_migrations_offline():
"""Run migrations in 'offline' mode.ec
This configures the context with just a URL
and not an Engine, though an Engine is acceptable
here as well. By skipping the Engine creation
we don't even need a DBAPI to be available.
Calls to context.execute() here emit the... | [
"def",
"run_migrations_offline",
"(",
")",
":",
"url",
"=",
"config",
".",
"get_main_option",
"(",
"\"sqlalchemy.url\"",
")",
"context",
".",
"configure",
"(",
"url",
"=",
"url",
",",
"target_metadata",
"=",
"target_metadata",
",",
"literal_binds",
"=",
"True",
... | [
37,
0
] | [
59,
32
] | python | en | ['en', 'nl', 'it'] | False |
run_migrations_online | () | Run migrations in 'online' mode.
In this scenario we need to create an Engine
and associate a connection with the context.
| Run migrations in 'online' mode. | def run_migrations_online():
"""Run migrations in 'online' mode.
In this scenario we need to create an Engine
and associate a connection with the context.
"""
connectable = engine_from_config(
config.get_section(config.config_ini_section),
prefix="sqlalchemy.",
poolclass=po... | [
"def",
"run_migrations_online",
"(",
")",
":",
"connectable",
"=",
"engine_from_config",
"(",
"config",
".",
"get_section",
"(",
"config",
".",
"config_ini_section",
")",
",",
"prefix",
"=",
"\"sqlalchemy.\"",
",",
"poolclass",
"=",
"pool",
".",
"NullPool",
",",... | [
62,
0
] | [
81,
36
] | python | en | ['en', 'nl', 'it'] | False |
Projection.type | (self) |
Sets the projection type. The projection type could be either
"perspective" or "orthographic". The default is "perspective".
The 'type' property is an enumeration that may be specified as:
- One of the following enumeration values:
['perspective', 'orthographic']
... |
Sets the projection type. The projection type could be either
"perspective" or "orthographic". The default is "perspective".
The 'type' property is an enumeration that may be specified as:
- One of the following enumeration values:
['perspective', 'orthographic'] | def type(self):
"""
Sets the projection type. The projection type could be either
"perspective" or "orthographic". The default is "perspective".
The 'type' property is an enumeration that may be specified as:
- One of the following enumeration values:
['per... | [
"def",
"type",
"(",
"self",
")",
":",
"return",
"self",
"[",
"\"type\"",
"]"
] | [
15,
4
] | [
28,
27
] | python | en | ['en', 'error', 'th'] | False |
Projection.__init__ | (self, arg=None, type=None, **kwargs) |
Construct a new Projection object
Parameters
----------
arg
dict of properties compatible with this constructor or
an instance of :class:`plotly.graph_objs.layout.scene.c
amera.Projection`
type
Sets the projection type. Th... |
Construct a new Projection object
Parameters
----------
arg
dict of properties compatible with this constructor or
an instance of :class:`plotly.graph_objs.layout.scene.c
amera.Projection`
type
Sets the projection type. Th... | def __init__(self, arg=None, type=None, **kwargs):
"""
Construct a new Projection object
Parameters
----------
arg
dict of properties compatible with this constructor or
an instance of :class:`plotly.graph_objs.layout.scene.c
amera.Pro... | [
"def",
"__init__",
"(",
"self",
",",
"arg",
"=",
"None",
",",
"type",
"=",
"None",
",",
"*",
"*",
"kwargs",
")",
":",
"super",
"(",
"Projection",
",",
"self",
")",
".",
"__init__",
"(",
"\"projection\"",
")",
"if",
"\"_parent\"",
"in",
"kwargs",
":",... | [
45,
4
] | [
104,
34
] | python | en | ['en', 'error', 'th'] | False |
Stream.maxpoints | (self) |
Sets the maximum number of points to keep on the plots from an
incoming stream. If `maxpoints` is set to 50, only the newest
50 points will be displayed on the plot.
The 'maxpoints' property is a number and may be specified as:
- An int or float in the interval [0, 10000]... |
Sets the maximum number of points to keep on the plots from an
incoming stream. If `maxpoints` is set to 50, only the newest
50 points will be displayed on the plot.
The 'maxpoints' property is a number and may be specified as:
- An int or float in the interval [0, 10000] | def maxpoints(self):
"""
Sets the maximum number of points to keep on the plots from an
incoming stream. If `maxpoints` is set to 50, only the newest
50 points will be displayed on the plot.
The 'maxpoints' property is a number and may be specified as:
- An int or ... | [
"def",
"maxpoints",
"(",
"self",
")",
":",
"return",
"self",
"[",
"\"maxpoints\"",
"]"
] | [
15,
4
] | [
28,
32
] | python | en | ['en', 'error', 'th'] | False |
Stream.token | (self) |
The stream id number links a data trace on a plot with a
stream. See https://chart-studio.plotly.com/settings for more
details.
The 'token' property is a string and must be specified as:
- A non-empty string
Returns
-------
str
|
The stream id number links a data trace on a plot with a
stream. See https://chart-studio.plotly.com/settings for more
details.
The 'token' property is a string and must be specified as:
- A non-empty string | def token(self):
"""
The stream id number links a data trace on a plot with a
stream. See https://chart-studio.plotly.com/settings for more
details.
The 'token' property is a string and must be specified as:
- A non-empty string
Returns
-------
... | [
"def",
"token",
"(",
"self",
")",
":",
"return",
"self",
"[",
"\"token\"",
"]"
] | [
37,
4
] | [
50,
28
] | python | en | ['en', 'error', 'th'] | False |
Stream.__init__ | (self, arg=None, maxpoints=None, token=None, **kwargs) |
Construct a new Stream object
Parameters
----------
arg
dict of properties compatible with this constructor or
an instance of :class:`plotly.graph_objs.funnel.Stream`
maxpoints
Sets the maximum number of points to keep on the plots
... |
Construct a new Stream object
Parameters
----------
arg
dict of properties compatible with this constructor or
an instance of :class:`plotly.graph_objs.funnel.Stream`
maxpoints
Sets the maximum number of points to keep on the plots
... | def __init__(self, arg=None, maxpoints=None, token=None, **kwargs):
"""
Construct a new Stream object
Parameters
----------
arg
dict of properties compatible with this constructor or
an instance of :class:`plotly.graph_objs.funnel.Stream`
... | [
"def",
"__init__",
"(",
"self",
",",
"arg",
"=",
"None",
",",
"maxpoints",
"=",
"None",
",",
"token",
"=",
"None",
",",
"*",
"*",
"kwargs",
")",
":",
"super",
"(",
"Stream",
",",
"self",
")",
".",
"__init__",
"(",
"\"stream\"",
")",
"if",
"\"_paren... | [
72,
4
] | [
139,
34
] | python | en | ['en', 'error', 'th'] | False |
Title.font | (self) |
Sets this axis' title font. Note that the title's font used to
be customized by the now deprecated `titlefont` attribute.
The 'font' property is an instance of Font
that may be specified as:
- An instance of :class:`plotly.graph_objs.layout.scene.yaxis.title.Font`
... |
Sets this axis' title font. Note that the title's font used to
be customized by the now deprecated `titlefont` attribute.
The 'font' property is an instance of Font
that may be specified as:
- An instance of :class:`plotly.graph_objs.layout.scene.yaxis.title.Font`
... | def font(self):
"""
Sets this axis' title font. Note that the title's font used to
be customized by the now deprecated `titlefont` attribute.
The 'font' property is an instance of Font
that may be specified as:
- An instance of :class:`plotly.graph_objs.layout.scen... | [
"def",
"font",
"(",
"self",
")",
":",
"return",
"self",
"[",
"\"font\"",
"]"
] | [
15,
4
] | [
53,
27
] | python | en | ['en', 'error', 'th'] | False |
Title.text | (self) |
Sets the title of this axis. Note that before the existence of
`title.text`, the title's contents used to be defined as the
`title` attribute itself. This behavior has been deprecated.
The 'text' property is a string and must be specified as:
- A string
- A numb... |
Sets the title of this axis. Note that before the existence of
`title.text`, the title's contents used to be defined as the
`title` attribute itself. This behavior has been deprecated.
The 'text' property is a string and must be specified as:
- A string
- A numb... | def text(self):
"""
Sets the title of this axis. Note that before the existence of
`title.text`, the title's contents used to be defined as the
`title` attribute itself. This behavior has been deprecated.
The 'text' property is a string and must be specified as:
- ... | [
"def",
"text",
"(",
"self",
")",
":",
"return",
"self",
"[",
"\"text\"",
"]"
] | [
62,
4
] | [
76,
27
] | python | en | ['en', 'error', 'th'] | False |
Title.__init__ | (self, arg=None, font=None, text=None, **kwargs) |
Construct a new Title object
Parameters
----------
arg
dict of properties compatible with this constructor or
an instance of
:class:`plotly.graph_objs.layout.scene.yaxis.Title`
font
Sets this axis' title font. Note that th... |
Construct a new Title object
Parameters
----------
arg
dict of properties compatible with this constructor or
an instance of
:class:`plotly.graph_objs.layout.scene.yaxis.Title`
font
Sets this axis' title font. Note that th... | def __init__(self, arg=None, font=None, text=None, **kwargs):
"""
Construct a new Title object
Parameters
----------
arg
dict of properties compatible with this constructor or
an instance of
:class:`plotly.graph_objs.layout.scene.yaxis... | [
"def",
"__init__",
"(",
"self",
",",
"arg",
"=",
"None",
",",
"font",
"=",
"None",
",",
"text",
"=",
"None",
",",
"*",
"*",
"kwargs",
")",
":",
"super",
"(",
"Title",
",",
"self",
")",
".",
"__init__",
"(",
"\"title\"",
")",
"if",
"\"_parent\"",
... | [
98,
4
] | [
166,
34
] | python | en | ['en', 'error', 'th'] | False |
SelfChatWorld.init_contexts | (self, shared=None) |
Override to load or instantiate contexts to be used to seed the self chat.
|
Override to load or instantiate contexts to be used to seed the self chat.
| def init_contexts(self, shared=None) -> None:
"""
Override to load or instantiate contexts to be used to seed the self chat.
"""
pass | [
"def",
"init_contexts",
"(",
"self",
",",
"shared",
"=",
"None",
")",
"->",
"None",
":",
"pass"
] | [
61,
4
] | [
65,
12
] | python | en | ['en', 'error', 'th'] | False |
SelfChatWorld.get_contexts | (self) |
Override to return a pair of contexts with which to seed the self chat episode.
This function will be called before the first turn of every episode.
|
Override to return a pair of contexts with which to seed the self chat episode. | def get_contexts(self):
"""
Override to return a pair of contexts with which to seed the self chat episode.
This function will be called before the first turn of every episode.
"""
return ['Hi!', ''] | [
"def",
"get_contexts",
"(",
"self",
")",
":",
"return",
"[",
"'Hi!'",
",",
"''",
"]"
] | [
67,
4
] | [
73,
26
] | python | en | ['en', 'error', 'th'] | False |
SelfChatWorld.init_openers | (self) |
Override to load or instantiate opening messages to be used to seed the self
chat.
|
Override to load or instantiate opening messages to be used to seed the self
chat.
| def init_openers(self) -> None:
"""
Override to load or instantiate opening messages to be used to seed the self
chat.
"""
if self.opt.get('seed_messages_from_task'):
self._openers = load_openers(self.opt) | [
"def",
"init_openers",
"(",
"self",
")",
"->",
"None",
":",
"if",
"self",
".",
"opt",
".",
"get",
"(",
"'seed_messages_from_task'",
")",
":",
"self",
".",
"_openers",
"=",
"load_openers",
"(",
"self",
".",
"opt",
")"
] | [
75,
4
] | [
81,
50
] | python | en | ['en', 'error', 'th'] | False |
SelfChatWorld.get_openers | (self, episode_num: int) |
Override to return one or more opening messages with which to seed the self chat
episode.
The return value should be an array of strings, each string being a message in
response to the string before it.
|
Override to return one or more opening messages with which to seed the self chat
episode. | def get_openers(self, episode_num: int) -> Optional[List[str]]:
"""
Override to return one or more opening messages with which to seed the self chat
episode.
The return value should be an array of strings, each string being a message in
response to the string before it.
... | [
"def",
"get_openers",
"(",
"self",
",",
"episode_num",
":",
"int",
")",
"->",
"Optional",
"[",
"List",
"[",
"str",
"]",
"]",
":",
"if",
"self",
".",
"_openers",
":",
"return",
"[",
"random",
".",
"choice",
"(",
"self",
".",
"_openers",
")",
"]",
"r... | [
83,
4
] | [
93,
19
] | python | en | ['en', 'error', 'th'] | False |
Textfont.color | (self) |
Sets the text font color of selected points.
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,1... |
Sets the text font color of selected points.
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,1... | def color(self):
"""
Sets the text font color of selected points.
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 hs... | [
"def",
"color",
"(",
"self",
")",
":",
"return",
"self",
"[",
"\"color\"",
"]"
] | [
15,
4
] | [
65,
28
] | python | en | ['en', 'error', 'th'] | False |
Textfont.__init__ | (self, arg=None, color=None, **kwargs) |
Construct a new Textfont object
Parameters
----------
arg
dict of properties compatible with this constructor or
an instance of :class:`plotly.graph_objs.scatterternary
.selected.Textfont`
color
Sets the text font color of... |
Construct a new Textfont object
Parameters
----------
arg
dict of properties compatible with this constructor or
an instance of :class:`plotly.graph_objs.scatterternary
.selected.Textfont`
color
Sets the text font color of... | def __init__(self, arg=None, color=None, **kwargs):
"""
Construct a new Textfont object
Parameters
----------
arg
dict of properties compatible with this constructor or
an instance of :class:`plotly.graph_objs.scatterternary
.selected.... | [
"def",
"__init__",
"(",
"self",
",",
"arg",
"=",
"None",
",",
"color",
"=",
"None",
",",
"*",
"*",
"kwargs",
")",
":",
"super",
"(",
"Textfont",
",",
"self",
")",
".",
"__init__",
"(",
"\"textfont\"",
")",
"if",
"\"_parent\"",
"in",
"kwargs",
":",
... | [
80,
4
] | [
137,
34
] | python | en | ['en', 'error', 'th'] | False |
parse_requirements | (fname='requirements.txt', with_version=True) | Parse the package dependencies listed in a requirements file but strips
specific versioning information.
Args:
fname (str): path to requirements file
with_version (bool, default=False): if True include version specs
Returns:
List[str]: list of requirements items
CommandLine:
... | Parse the package dependencies listed in a requirements file but strips
specific versioning information. | def parse_requirements(fname='requirements.txt', with_version=True):
"""Parse the package dependencies listed in a requirements file but strips
specific versioning information.
Args:
fname (str): path to requirements file
with_version (bool, default=False): if True include version specs
... | [
"def",
"parse_requirements",
"(",
"fname",
"=",
"'requirements.txt'",
",",
"with_version",
"=",
"True",
")",
":",
"import",
"sys",
"from",
"os",
".",
"path",
"import",
"exists",
"import",
"re",
"require_fpath",
"=",
"fname",
"def",
"parse_line",
"(",
"line",
... | [
114,
0
] | [
189,
19
] | python | en | ['en', 'en', 'en'] | True |
Line.color | (self) |
Sets the color of the contour level. Has no effect if
`contours.coloring` is set to "lines".
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,1... |
Sets the color of the contour level. Has no effect if
`contours.coloring` is set to "lines".
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,1... | def color(self):
"""
Sets the color of the contour level. Has no effect if
`contours.coloring` is set to "lines".
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 hs... | [
"def",
"color",
"(",
"self",
")",
":",
"return",
"self",
"[",
"\"color\"",
"]"
] | [
15,
4
] | [
66,
28
] | python | en | ['en', 'error', 'th'] | False |
Line.dash | (self) |
Sets the dash style of lines. Set to a dash type string
("solid", "dot", "dash", "longdash", "dashdot", or
"longdashdot") or a dash length list in px (eg
"5px,10px,2px,2px").
The 'dash' property is an enumeration that may be specified as:
- One of the following da... |
Sets the dash style of lines. Set to a dash type string
("solid", "dot", "dash", "longdash", "dashdot", or
"longdashdot") or a dash length list in px (eg
"5px,10px,2px,2px").
The 'dash' property is an enumeration that may be specified as:
- One of the following da... | def dash(self):
"""
Sets the dash style of lines. Set to a dash type string
("solid", "dot", "dash", "longdash", "dashdot", or
"longdashdot") or a dash length list in px (eg
"5px,10px,2px,2px").
The 'dash' property is an enumeration that may be specified as:
... | [
"def",
"dash",
"(",
"self",
")",
":",
"return",
"self",
"[",
"\"dash\"",
"]"
] | [
75,
4
] | [
92,
27
] | python | en | ['en', 'error', 'th'] | False |
Line.smoothing | (self) |
Sets the amount of smoothing for the contour lines, where 0
corresponds to no smoothing.
The 'smoothing' property is a number and may be specified as:
- An int or float in the interval [0, 1.3]
Returns
-------
int|float
|
Sets the amount of smoothing for the contour lines, where 0
corresponds to no smoothing.
The 'smoothing' property is a number and may be specified as:
- An int or float in the interval [0, 1.3] | def smoothing(self):
"""
Sets the amount of smoothing for the contour lines, where 0
corresponds to no smoothing.
The 'smoothing' property is a number and may be specified as:
- An int or float in the interval [0, 1.3]
Returns
-------
int|float
... | [
"def",
"smoothing",
"(",
"self",
")",
":",
"return",
"self",
"[",
"\"smoothing\"",
"]"
] | [
101,
4
] | [
113,
32
] | python | en | ['en', 'error', 'th'] | False |
Line.width | (self) |
Sets the contour line width in (in px) Defaults to 0.5 when
`contours.type` is "levels". Defaults to 2 when `contour.type`
is "constraint".
The 'width' property is a number and may be specified as:
- An int or float in the interval [0, inf]
Returns
------... |
Sets the contour line width in (in px) Defaults to 0.5 when
`contours.type` is "levels". Defaults to 2 when `contour.type`
is "constraint".
The 'width' property is a number and may be specified as:
- An int or float in the interval [0, inf] | def width(self):
"""
Sets the contour line width in (in px) Defaults to 0.5 when
`contours.type` is "levels". Defaults to 2 when `contour.type`
is "constraint".
The 'width' property is a number and may be specified as:
- An int or float in the interval [0, inf]
... | [
"def",
"width",
"(",
"self",
")",
":",
"return",
"self",
"[",
"\"width\"",
"]"
] | [
122,
4
] | [
135,
28
] | python | en | ['en', 'error', 'th'] | False |
Line.__init__ | (
self, arg=None, color=None, dash=None, smoothing=None, width=None, **kwargs
) |
Construct a new Line object
Parameters
----------
arg
dict of properties compatible with this constructor or
an instance of :class:`plotly.graph_objs.contour.Line`
color
Sets the color of the contour level. Has no effect if
... |
Construct a new Line object
Parameters
----------
arg
dict of properties compatible with this constructor or
an instance of :class:`plotly.graph_objs.contour.Line`
color
Sets the color of the contour level. Has no effect if
... | def __init__(
self, arg=None, color=None, dash=None, smoothing=None, width=None, **kwargs
):
"""
Construct a new Line object
Parameters
----------
arg
dict of properties compatible with this constructor or
an instance of :class:`plotly... | [
"def",
"__init__",
"(",
"self",
",",
"arg",
"=",
"None",
",",
"color",
"=",
"None",
",",
"dash",
"=",
"None",
",",
"smoothing",
"=",
"None",
",",
"width",
"=",
"None",
",",
"*",
"*",
"kwargs",
")",
":",
"super",
"(",
"Line",
",",
"self",
")",
"... | [
163,
4
] | [
246,
34
] | python | en | ['en', 'error', 'th'] | False |
MenuRequest.__init__ | (self, **kwargs) | Initialize a menu request object. | Initialize a menu request object. | def __init__(self, **kwargs):
"""Initialize a menu request object."""
super(MenuRequest, self).__init__(**kwargs) | [
"def",
"__init__",
"(",
"self",
",",
"*",
"*",
"kwargs",
")",
":",
"super",
"(",
"MenuRequest",
",",
"self",
")",
".",
"__init__",
"(",
"*",
"*",
"kwargs",
")"
] | [
19,
4
] | [
21,
51
] | python | en | ['en', 'co', 'en'] | True |
set_mapbox_access_token | (token) |
Arguments:
token: A Mapbox token to be used in `plotly.express.scatter_mapbox` and \
`plotly.express.line_mapbox` figures. See \
https://docs.mapbox.com/help/how-mapbox-works/access-tokens/ for more details
|
Arguments:
token: A Mapbox token to be used in `plotly.express.scatter_mapbox` and \
`plotly.express.line_mapbox` figures. See \
https://docs.mapbox.com/help/how-mapbox-works/access-tokens/ for more details
| def set_mapbox_access_token(token):
"""
Arguments:
token: A Mapbox token to be used in `plotly.express.scatter_mapbox` and \
`plotly.express.line_mapbox` figures. See \
https://docs.mapbox.com/help/how-mapbox-works/access-tokens/ for more details
"""
global MAPBOX_TOKEN
MAPBO... | [
"def",
"set_mapbox_access_token",
"(",
"token",
")",
":",
"global",
"MAPBOX_TOKEN",
"MAPBOX_TOKEN",
"=",
"token"
] | [
71,
0
] | [
79,
24
] | python | en | ['en', 'error', 'th'] | False |
get_trendline_results | (fig) |
Extracts fit statistics for trendlines (when applied to figures generated with
the `trendline` argument set to `"ols"`).
Arguments:
fig: the output of a `plotly.express` charting call
Returns:
A `pandas.DataFrame` with a column "px_fit_results" containing the `statsmodels`
resu... |
Extracts fit statistics for trendlines (when applied to figures generated with
the `trendline` argument set to `"ols"`). | def get_trendline_results(fig):
"""
Extracts fit statistics for trendlines (when applied to figures generated with
the `trendline` argument set to `"ols"`).
Arguments:
fig: the output of a `plotly.express` charting call
Returns:
A `pandas.DataFrame` with a column "px_fit_results" co... | [
"def",
"get_trendline_results",
"(",
"fig",
")",
":",
"return",
"fig",
".",
"_px_trendlines"
] | [
82,
0
] | [
94,
29
] | python | en | ['en', 'error', 'th'] | False |
invert_label | (args, column) | Invert mapping.
Find key corresponding to value column in dict args["labels"].
Returns `column` if the value does not exist.
| Invert mapping.
Find key corresponding to value column in dict args["labels"].
Returns `column` if the value does not exist.
| def invert_label(args, column):
"""Invert mapping.
Find key corresponding to value column in dict args["labels"].
Returns `column` if the value does not exist.
"""
reversed_labels = {value: key for (key, value) in args["labels"].items()}
try:
return reversed_labels[column]
except Exc... | [
"def",
"invert_label",
"(",
"args",
",",
"column",
")",
":",
"reversed_labels",
"=",
"{",
"value",
":",
"key",
"for",
"(",
"key",
",",
"value",
")",
"in",
"args",
"[",
"\"labels\"",
"]",
".",
"items",
"(",
")",
"}",
"try",
":",
"return",
"reversed_la... | [
119,
0
] | [
128,
21
] | python | en | ['en', 'en', 'en'] | False |
make_trace_kwargs | (args, trace_spec, trace_data, mapping_labels, sizeref) | Populates a dict with arguments to update trace
Parameters
----------
args : dict
args to be used for the trace
trace_spec : NamedTuple
which kind of trace to be used (has constructor, marginal etc.
attributes)
trace_data : pandas DataFrame
data
mapping_labels : ... | Populates a dict with arguments to update trace | def make_trace_kwargs(args, trace_spec, trace_data, mapping_labels, sizeref):
"""Populates a dict with arguments to update trace
Parameters
----------
args : dict
args to be used for the trace
trace_spec : NamedTuple
which kind of trace to be used (has constructor, marginal etc.
... | [
"def",
"make_trace_kwargs",
"(",
"args",
",",
"trace_spec",
",",
"trace_data",
",",
"mapping_labels",
",",
"sizeref",
")",
":",
"if",
"\"line_close\"",
"in",
"args",
"and",
"args",
"[",
"\"line_close\"",
"]",
":",
"trace_data",
"=",
"trace_data",
".",
"append"... | [
195,
0
] | [
486,
35
] | python | en | ['en', 'en', 'en'] | True |
_get_reserved_col_names | (args) |
This function builds a list of columns of the data_frame argument used
as arguments, either as str/int arguments or given as columns
(pandas series type).
|
This function builds a list of columns of the data_frame argument used
as arguments, either as str/int arguments or given as columns
(pandas series type).
| def _get_reserved_col_names(args):
"""
This function builds a list of columns of the data_frame argument used
as arguments, either as str/int arguments or given as columns
(pandas series type).
"""
df = args["data_frame"]
reserved_names = set()
for field in args:
if field not in ... | [
"def",
"_get_reserved_col_names",
"(",
"args",
")",
":",
"df",
"=",
"args",
"[",
"\"data_frame\"",
"]",
"reserved_names",
"=",
"set",
"(",
")",
"for",
"field",
"in",
"args",
":",
"if",
"field",
"not",
"in",
"all_attrables",
":",
"continue",
"names",
"=",
... | [
953,
0
] | [
981,
25
] | python | en | ['en', 'error', 'th'] | False |
_is_col_list | (df_input, arg) | Returns True if arg looks like it's a list of columns or references to columns
in df_input, and False otherwise (in which case it's assumed to be a single column
or reference to a column).
| Returns True if arg looks like it's a list of columns or references to columns
in df_input, and False otherwise (in which case it's assumed to be a single column
or reference to a column).
| def _is_col_list(df_input, arg):
"""Returns True if arg looks like it's a list of columns or references to columns
in df_input, and False otherwise (in which case it's assumed to be a single column
or reference to a column).
"""
if arg is None or isinstance(arg, str) or isinstance(arg, int):
... | [
"def",
"_is_col_list",
"(",
"df_input",
",",
"arg",
")",
":",
"if",
"arg",
"is",
"None",
"or",
"isinstance",
"(",
"arg",
",",
"str",
")",
"or",
"isinstance",
"(",
"arg",
",",
"int",
")",
":",
"return",
"False",
"if",
"isinstance",
"(",
"arg",
",",
... | [
984,
0
] | [
1006,
15
] | python | en | ['en', 'en', 'en'] | True |
_isinstance_listlike | (x) | Returns True if x is an iterable which can be transformed into a pandas Series,
False for the other types of possible values of a `hover_data` dict.
A tuple of length 2 is a special case corresponding to a (format, data) tuple.
| Returns True if x is an iterable which can be transformed into a pandas Series,
False for the other types of possible values of a `hover_data` dict.
A tuple of length 2 is a special case corresponding to a (format, data) tuple.
| def _isinstance_listlike(x):
"""Returns True if x is an iterable which can be transformed into a pandas Series,
False for the other types of possible values of a `hover_data` dict.
A tuple of length 2 is a special case corresponding to a (format, data) tuple.
"""
if (
isinstance(x, str)
... | [
"def",
"_isinstance_listlike",
"(",
"x",
")",
":",
"if",
"(",
"isinstance",
"(",
"x",
",",
"str",
")",
"or",
"(",
"isinstance",
"(",
"x",
",",
"tuple",
")",
"and",
"len",
"(",
"x",
")",
"==",
"2",
")",
"or",
"isinstance",
"(",
"x",
",",
"bool",
... | [
1009,
0
] | [
1022,
19
] | python | en | ['en', 'en', 'en'] | True |
process_args_into_dataframe | (args, wide_mode, var_name, value_name) |
After this function runs, the `all_attrables` keys of `args` all contain only
references to columns of `df_output`. This function handles the extraction of data
from `args["attrable"]` and column-name-generation as appropriate, and adds the
data to `df_output` and then replaces `args["attrable"]` with ... |
After this function runs, the `all_attrables` keys of `args` all contain only
references to columns of `df_output`. This function handles the extraction of data
from `args["attrable"]` and column-name-generation as appropriate, and adds the
data to `df_output` and then replaces `args["attrable"]` with ... | def process_args_into_dataframe(args, wide_mode, var_name, value_name):
"""
After this function runs, the `all_attrables` keys of `args` all contain only
references to columns of `df_output`. This function handles the extraction of data
from `args["attrable"]` and column-name-generation as appropriate, ... | [
"def",
"process_args_into_dataframe",
"(",
"args",
",",
"wide_mode",
",",
"var_name",
",",
"value_name",
")",
":",
"df_input",
"=",
"args",
"[",
"\"data_frame\"",
"]",
"df_provided",
"=",
"df_input",
"is",
"not",
"None",
"df_output",
"=",
"pd",
".",
"DataFrame... | [
1031,
0
] | [
1236,
34
] | python | en | ['en', 'error', 'th'] | False |
build_dataframe | (args, constructor) |
Constructs a dataframe and modifies `args` in-place.
The argument values in `args` can be either strings corresponding to
existing columns of a dataframe, or data arrays (lists, numpy arrays,
pandas columns, series).
Parameters
----------
args : OrderedDict
arguments passed to the... |
Constructs a dataframe and modifies `args` in-place. | def build_dataframe(args, constructor):
"""
Constructs a dataframe and modifies `args` in-place.
The argument values in `args` can be either strings corresponding to
existing columns of a dataframe, or data arrays (lists, numpy arrays,
pandas columns, series).
Parameters
----------
arg... | [
"def",
"build_dataframe",
"(",
"args",
",",
"constructor",
")",
":",
"# make copies of all the fields via dict() and list()",
"for",
"field",
"in",
"args",
":",
"if",
"field",
"in",
"array_attrables",
"and",
"args",
"[",
"field",
"]",
"is",
"not",
"None",
":",
"... | [
1239,
0
] | [
1454,
15
] | python | en | ['en', 'error', 'th'] | False |
process_dataframe_hierarchy | (args) |
Build dataframe for sunburst or treemap when the path argument is provided.
|
Build dataframe for sunburst or treemap when the path argument is provided.
| def process_dataframe_hierarchy(args):
"""
Build dataframe for sunburst or treemap when the path argument is provided.
"""
df = args["data_frame"]
path = args["path"][::-1]
_check_dataframe_all_leaves(df[path[::-1]])
discrete_color = False
new_path = []
for col_name in path:
... | [
"def",
"process_dataframe_hierarchy",
"(",
"args",
")",
":",
"df",
"=",
"args",
"[",
"\"data_frame\"",
"]",
"path",
"=",
"args",
"[",
"\"path\"",
"]",
"[",
":",
":",
"-",
"1",
"]",
"_check_dataframe_all_leaves",
"(",
"df",
"[",
"path",
"[",
":",
":",
"... | [
1481,
0
] | [
1603,
15
] | python | en | ['en', 'error', 'th'] | False |
process_dataframe_timeline | (args) |
Massage input for bar traces for px.timeline()
|
Massage input for bar traces for px.timeline()
| def process_dataframe_timeline(args):
"""
Massage input for bar traces for px.timeline()
"""
args["is_timeline"] = True
if args["x_start"] is None or args["x_end"] is None:
raise ValueError("Both x_start and x_end are required")
try:
x_start = pd.to_datetime(args["data_frame"][a... | [
"def",
"process_dataframe_timeline",
"(",
"args",
")",
":",
"args",
"[",
"\"is_timeline\"",
"]",
"=",
"True",
"if",
"args",
"[",
"\"x_start\"",
"]",
"is",
"None",
"or",
"args",
"[",
"\"x_end\"",
"]",
"is",
"None",
":",
"raise",
"ValueError",
"(",
"\"Both x... | [
1606,
0
] | [
1628,
15
] | python | en | ['en', 'error', 'th'] | False |
get_orderings | (args, grouper, grouped) |
`orders` is the user-supplied ordering (with the remaining data-frame-supplied
ordering appended if the column is used for grouping). It includes anything the user
gave, for any variable, including values not present in the dataset. It is used
downstream to set e.g. `categoryarray` for cartesian axes
... |
`orders` is the user-supplied ordering (with the remaining data-frame-supplied
ordering appended if the column is used for grouping). It includes anything the user
gave, for any variable, including values not present in the dataset. It is used
downstream to set e.g. `categoryarray` for cartesian axes | def get_orderings(args, grouper, grouped):
"""
`orders` is the user-supplied ordering (with the remaining data-frame-supplied
ordering appended if the column is used for grouping). It includes anything the user
gave, for any variable, including values not present in the dataset. It is used
downstrea... | [
"def",
"get_orderings",
"(",
"args",
",",
"grouper",
",",
"grouped",
")",
":",
"orders",
"=",
"{",
"}",
"if",
"\"category_orders\"",
"not",
"in",
"args",
"else",
"args",
"[",
"\"category_orders\"",
"]",
".",
"copy",
"(",
")",
"group_names",
"=",
"[",
"]"... | [
1784,
0
] | [
1822,
44
] | python | en | ['en', 'error', 'th'] | False |
AcuteEvalBuilder.rebuild_core | (self) |
Rebuild the frontend for this task.
|
Rebuild the frontend for this task.
| def rebuild_core(self):
"""
Rebuild the frontend for this task.
"""
return_dir = os.getcwd()
os.chdir(FRONTEND_SOURCE_DIR)
if os.path.exists(FRONTEND_BUILD_DIR):
shutil.rmtree(FRONTEND_BUILD_DIR)
packages_installed = subprocess.call(["npm", "install"])... | [
"def",
"rebuild_core",
"(",
"self",
")",
":",
"return_dir",
"=",
"os",
".",
"getcwd",
"(",
")",
"os",
".",
"chdir",
"(",
"FRONTEND_SOURCE_DIR",
")",
"if",
"os",
".",
"path",
".",
"exists",
"(",
"FRONTEND_BUILD_DIR",
")",
":",
"shutil",
".",
"rmtree",
"... | [
26,
4
] | [
46,
28
] | python | en | ['en', 'error', 'th'] | False |
AcuteEvalBuilder.build_in_dir | (self, build_dir: str) |
Build the frontend if it doesn't exist, then copy into the server directory.
|
Build the frontend if it doesn't exist, then copy into the server directory.
| def build_in_dir(self, build_dir: str):
"""
Build the frontend if it doesn't exist, then copy into the server directory.
"""
# Only build this task if it hasn't already been built
if True: # not os.path.exists(FRONTEND_BUILD_DIR):
self.rebuild_core()
# Copy ... | [
"def",
"build_in_dir",
"(",
"self",
",",
"build_dir",
":",
"str",
")",
":",
"# Only build this task if it hasn't already been built",
"if",
"True",
":",
"# not os.path.exists(FRONTEND_BUILD_DIR):",
"self",
".",
"rebuild_core",
"(",
")",
"# Copy the built core and the given ta... | [
48,
4
] | [
70,
48
] | python | en | ['en', 'error', 'th'] | False |
AcuteEvalBuilder.task_dir_is_valid | (task_dir: str) |
Acute eval is always valid, we don't have any special resources.
|
Acute eval is always valid, we don't have any special resources.
| def task_dir_is_valid(task_dir: str) -> bool:
"""
Acute eval is always valid, we don't have any special resources.
"""
return True | [
"def",
"task_dir_is_valid",
"(",
"task_dir",
":",
"str",
")",
"->",
"bool",
":",
"return",
"True"
] | [
74,
4
] | [
78,
19
] | python | en | ['en', 'error', 'th'] | False |
BartModel.output | (self, tensor: torch.Tensor) |
Compute output logits.
Override standard TGM output to _not_ prevent generation of BOS.
|
Compute output logits. | def output(self, tensor: torch.Tensor) -> torch.Tensor:
"""
Compute output logits.
Override standard TGM output to _not_ prevent generation of BOS.
"""
# project back to vocabulary
output = F.linear(tensor, self.embeddings.weight)
return output | [
"def",
"output",
"(",
"self",
",",
"tensor",
":",
"torch",
".",
"Tensor",
")",
"->",
"torch",
".",
"Tensor",
":",
"# project back to vocabulary",
"output",
"=",
"F",
".",
"linear",
"(",
"tensor",
",",
"self",
".",
"embeddings",
".",
"weight",
")",
"retur... | [
18,
4
] | [
26,
21
] | python | en | ['en', 'error', 'th'] | False |
BartModel._get_initial_forced_decoder_input | (self, bsz: int, inputs: torch.LongTensor) |
Return initial input to the decoder.
Override TGA._get_initial_forced_decoder_input to seed EOS BOS.
:param bsz:
batchsize
:param inputs:
inputs to decode
:return initial_input:
initial input for the decoder.
|
Return initial input to the decoder. | def _get_initial_forced_decoder_input(self, bsz: int, inputs: torch.LongTensor):
"""
Return initial input to the decoder.
Override TGA._get_initial_forced_decoder_input to seed EOS BOS.
:param bsz:
batchsize
:param inputs:
inputs to decode
:retu... | [
"def",
"_get_initial_forced_decoder_input",
"(",
"self",
",",
"bsz",
":",
"int",
",",
"inputs",
":",
"torch",
".",
"LongTensor",
")",
":",
"tens",
"=",
"(",
"torch",
".",
"LongTensor",
"(",
"[",
"self",
".",
"END_IDX",
",",
"self",
".",
"START_IDX",
"]",... | [
28,
4
] | [
48,
43
] | python | en | ['en', 'error', 'th'] | False |
BartModel.reorder_decoder_incremental_state | (
self,
incremental_state: Dict[str, Any],
inds: Union[List[int], torch.LongTensor],
) |
Incremental state is weird to handle when we seed decoder with two inputs
initially.
|
Incremental state is weird to handle when we seed decoder with two inputs
initially.
| def reorder_decoder_incremental_state(
self,
incremental_state: Dict[str, Any],
inds: Union[List[int], torch.LongTensor],
) -> Optional[Dict[str, Any]]:
"""
Incremental state is weird to handle when we seed decoder with two inputs
initially.
"""
# we o... | [
"def",
"reorder_decoder_incremental_state",
"(",
"self",
",",
"incremental_state",
":",
"Dict",
"[",
"str",
",",
"Any",
"]",
",",
"inds",
":",
"Union",
"[",
"List",
"[",
"int",
"]",
",",
"torch",
".",
"LongTensor",
"]",
",",
")",
"->",
"Optional",
"[",
... | [
50,
4
] | [
72,
81
] | python | en | ['en', 'error', 'th'] | False |
setup_interweb_args | (shared) |
Build and parse CLI opts.
|
Build and parse CLI opts.
| def setup_interweb_args(shared):
"""
Build and parse CLI opts.
"""
parser = setup_args()
parser.description = 'Interactive chat with a model in a web browser'
parser.add_argument('--port', type=int, default=PORT, help='Port to listen on.')
parser.add_argument(
'--host',
defau... | [
"def",
"setup_interweb_args",
"(",
"shared",
")",
":",
"parser",
"=",
"setup_args",
"(",
")",
"parser",
".",
"description",
"=",
"'Interactive chat with a model in a web browser'",
"parser",
".",
"add_argument",
"(",
"'--port'",
",",
"type",
"=",
"int",
",",
"defa... | [
237,
0
] | [
250,
17
] | python | en | ['en', 'error', 'th'] | False |
MyHandler.do_HEAD | (self) |
Handle HEAD requests.
|
Handle HEAD requests.
| def do_HEAD(self):
"""
Handle HEAD requests.
"""
self.send_response(200)
self.send_header('Content-type', 'text/html')
self.end_headers() | [
"def",
"do_HEAD",
"(",
"self",
")",
":",
"self",
".",
"send_response",
"(",
"200",
")",
"self",
".",
"send_header",
"(",
"'Content-type'",
",",
"'text/html'",
")",
"self",
".",
"end_headers",
"(",
")"
] | [
179,
4
] | [
185,
26
] | python | en | ['en', 'error', 'th'] | False |
MyHandler.do_POST | (self) |
Handle POST request, especially replying to a chat message.
|
Handle POST request, especially replying to a chat message.
| def do_POST(self):
"""
Handle POST request, especially replying to a chat message.
"""
if self.path == '/interact':
content_length = int(self.headers['Content-Length'])
body = self.rfile.read(content_length)
model_response = self._interactive_running(
... | [
"def",
"do_POST",
"(",
"self",
")",
":",
"if",
"self",
".",
"path",
"==",
"'/interact'",
":",
"content_length",
"=",
"int",
"(",
"self",
".",
"headers",
"[",
"'Content-Length'",
"]",
")",
"body",
"=",
"self",
".",
"rfile",
".",
"read",
"(",
"content_le... | [
187,
4
] | [
210,
49
] | python | en | ['en', 'error', 'th'] | False |
MyHandler.do_GET | (self) |
Respond to GET request, especially the initial load.
|
Respond to GET request, especially the initial load.
| def do_GET(self):
"""
Respond to GET request, especially the initial load.
"""
paths = {
'/': {'status': 200},
'/favicon.ico': {'status': 202}, # Need for chrome
}
if self.path in paths:
self._respond(paths[self.path])
else:
... | [
"def",
"do_GET",
"(",
"self",
")",
":",
"paths",
"=",
"{",
"'/'",
":",
"{",
"'status'",
":",
"200",
"}",
",",
"'/favicon.ico'",
":",
"{",
"'status'",
":",
"202",
"}",
",",
"# Need for chrome",
"}",
"if",
"self",
".",
"path",
"in",
"paths",
":",
"se... | [
212,
4
] | [
223,
42
] | python | en | ['en', 'error', 'th'] | False |
ModelTester.cloud_segmentation_test | (self, net, test_loader, config, num_votes=30, debug=False) |
Test method for cloud segmentation models
|
Test method for cloud segmentation models
| def cloud_segmentation_test(self, net, test_loader, config, num_votes=30, debug=False):
"""
Test method for cloud segmentation models
"""
############
# Initialize
############
# Choose test smoothing parameter (0 for no smothing, 0.99 for big smoothing)
... | [
"def",
"cloud_segmentation_test",
"(",
"self",
",",
"net",
",",
"test_loader",
",",
"config",
",",
"num_votes",
"=",
"30",
",",
"debug",
"=",
"False",
")",
":",
"############",
"# Initialize",
"############",
"# Choose test smoothing parameter (0 for no smothing, 0.99 f... | [
179,
4
] | [
489,
14
] | python | en | ['en', 'error', 'th'] | False |
ModelTester.slam_segmentation_test | (self, net, test_loader, config, num_votes=100, debug=True) |
Test method for slam segmentation models
|
Test method for slam segmentation models
| def slam_segmentation_test(self, net, test_loader, config, num_votes=100, debug=True):
"""
Test method for slam segmentation models
"""
############
# Initialize
############
# Choose validation smoothing parameter (0 for no smothing, 0.99 for big smoothing)
... | [
"def",
"slam_segmentation_test",
"(",
"self",
",",
"net",
",",
"test_loader",
",",
"config",
",",
"num_votes",
"=",
"100",
",",
"debug",
"=",
"True",
")",
":",
"############",
"# Initialize",
"############",
"# Choose validation smoothing parameter (0 for no smothing, 0... | [
491,
4
] | [
799,
14
] | python | en | ['en', 'error', 'th'] | False |
to_html | (
fig,
config=None,
auto_play=True,
include_plotlyjs=True,
include_mathjax=False,
post_script=None,
full_html=True,
animation_opts=None,
default_width="100%",
default_height="100%",
validate=True,
) |
Convert a figure to an HTML string representation.
Parameters
----------
fig:
Figure object or dict representing a figure
config: dict or None (default None)
Plotly.js figure config options
auto_play: bool (default=True)
Whether to automatically start the animation sequ... |
Convert a figure to an HTML string representation. | def to_html(
fig,
config=None,
auto_play=True,
include_plotlyjs=True,
include_mathjax=False,
post_script=None,
full_html=True,
animation_opts=None,
default_width="100%",
default_height="100%",
validate=True,
):
"""
Convert a figure to an HTML string representation.
... | [
"def",
"to_html",
"(",
"fig",
",",
"config",
"=",
"None",
",",
"auto_play",
"=",
"True",
",",
"include_plotlyjs",
"=",
"True",
",",
"include_mathjax",
"=",
"False",
",",
"post_script",
"=",
"None",
",",
"full_html",
"=",
"True",
",",
"animation_opts",
"=",... | [
25,
0
] | [
376,
30
] | python | en | ['en', 'error', 'th'] | False |
write_html | (
fig,
file,
config=None,
auto_play=True,
include_plotlyjs=True,
include_mathjax=False,
post_script=None,
full_html=True,
animation_opts=None,
validate=True,
default_width="100%",
default_height="100%",
auto_open=False,
) |
Write a figure to an HTML file representation
Parameters
----------
fig:
Figure object or dict representing a figure
file: str or writeable
A string representing a local file path or a writeable object
(e.g. an open file descriptor)
config: dict or None (default None)
... |
Write a figure to an HTML file representation | def write_html(
fig,
file,
config=None,
auto_play=True,
include_plotlyjs=True,
include_mathjax=False,
post_script=None,
full_html=True,
animation_opts=None,
validate=True,
default_width="100%",
default_height="100%",
auto_open=False,
):
"""
Write a figure to a... | [
"def",
"write_html",
"(",
"fig",
",",
"file",
",",
"config",
"=",
"None",
",",
"auto_play",
"=",
"True",
",",
"include_plotlyjs",
"=",
"True",
",",
"include_mathjax",
"=",
"False",
",",
"post_script",
"=",
"None",
",",
"full_html",
"=",
"True",
",",
"ani... | [
379,
0
] | [
542,
28
] | 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.