hexsha stringlengths 40 40 | repo stringlengths 7 114 | path stringlengths 4 124 | license listlengths 1 9 | language stringclasses 1
value | identifier stringlengths 1 71 | return_type stringlengths 1 749 ⌀ | original_string stringlengths 76 22.7k | original_docstring stringlengths 16 7.61k | docstring stringlengths 16 2.47k | docstring_tokens listlengths 6 477 | code stringlengths 14 10.2k | code_tokens listlengths 6 996 | short_docstring stringlengths 2 644 | short_docstring_tokens listlengths 1 116 | comment listlengths 1 89 | parameters listlengths 0 64 | docstring_params dict |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
66173f7a015bdadf7a4ae2570d2767e187d9cb2b | vuiseng9/nncf_pytorch | nncf/common/pruning/node_selector.py | [
"Apache-2.0"
] | Python | _get_multiforward_nodes | List[List[NNCFNode]] | def _get_multiforward_nodes(self, graph: NNCFGraph) -> List[List[NNCFNode]]:
"""
Groups nodes based on their `layer_name` property to determine groups of nodes belonging to
a single weighted layer object in the model, i.e. the group of operations in the graph that reuse one and
the same ... |
Groups nodes based on their `layer_name` property to determine groups of nodes belonging to
a single weighted layer object in the model, i.e. the group of operations in the graph that reuse one and
the same set of weights, and returns the groups that have more than one element.
:return... | Groups nodes based on their `layer_name` property to determine groups of nodes belonging to
a single weighted layer object in the model, i.e. the group of operations in the graph that reuse one and
the same set of weights, and returns the groups that have more than one element. | [
"Groups",
"nodes",
"based",
"on",
"their",
"`",
"layer_name",
"`",
"property",
"to",
"determine",
"groups",
"of",
"nodes",
"belonging",
"to",
"a",
"single",
"weighted",
"layer",
"object",
"in",
"the",
"model",
"i",
".",
"e",
".",
"the",
"group",
"of",
"o... | def _get_multiforward_nodes(self, graph: NNCFGraph) -> List[List[NNCFNode]]:
ret = defaultdict(list)
for node in graph.get_nodes_by_types(self._prune_operations_types):
ret[node.layer_name].append(node)
return [ret[module_identifier] for module_identifier in ret if len(ret[module_ide... | [
"def",
"_get_multiforward_nodes",
"(",
"self",
",",
"graph",
":",
"NNCFGraph",
")",
"->",
"List",
"[",
"List",
"[",
"NNCFNode",
"]",
"]",
":",
"ret",
"=",
"defaultdict",
"(",
"list",
")",
"for",
"node",
"in",
"graph",
".",
"get_nodes_by_types",
"(",
"sel... | Groups nodes based on their `layer_name` property to determine groups of nodes belonging to
a single weighted layer object in the model, i.e. | [
"Groups",
"nodes",
"based",
"on",
"their",
"`",
"layer_name",
"`",
"property",
"to",
"determine",
"groups",
"of",
"nodes",
"belonging",
"to",
"a",
"single",
"weighted",
"layer",
"object",
"in",
"the",
"model",
"i",
".",
"e",
"."
] | [
"\"\"\"\n Groups nodes based on their `layer_name` property to determine groups of nodes belonging to\n a single weighted layer object in the model, i.e. the group of operations in the graph that reuse one and\n the same set of weights, and returns the groups that have more than one element.\n\... | [
{
"param": "self",
"type": null
},
{
"param": "graph",
"type": "NNCFGraph"
}
] | {
"returns": [
{
"docstring": "List of lists of nodes; each list corresponds to a group of nodes united by the common\nunderlying layer object of the original model.",
"docstring_tokens": [
"List",
"of",
"lists",
"of",
"nodes",
";",
"each",
... |
66173f7a015bdadf7a4ae2570d2767e187d9cb2b | vuiseng9/nncf_pytorch | nncf/common/pruning/node_selector.py | [
"Apache-2.0"
] | Python | _pruning_dimensions_analysis | Dict[int, PruningAnalysisDecision] | def _pruning_dimensions_analysis(self, graph, can_prune_after_check) -> Dict[int, PruningAnalysisDecision]:
"""
Check all nodes that were marked as prunable after the model analysis and compatibility check vs.
pruning algo have a correct correspondent closing node on each path form self to outpu... |
Check all nodes that were marked as prunable after the model analysis and compatibility check vs.
pruning algo have a correct correspondent closing node on each path form self to outputs.
:param graph: Graph to work with.
:param can_prune_after_check: Dict of node indices vs the decisi... | Check all nodes that were marked as prunable after the model analysis and compatibility check vs.
pruning algo have a correct correspondent closing node on each path form self to outputs. | [
"Check",
"all",
"nodes",
"that",
"were",
"marked",
"as",
"prunable",
"after",
"the",
"model",
"analysis",
"and",
"compatibility",
"check",
"vs",
".",
"pruning",
"algo",
"have",
"a",
"correct",
"correspondent",
"closing",
"node",
"on",
"each",
"path",
"form",
... | def _pruning_dimensions_analysis(self, graph, can_prune_after_check) -> Dict[int, PruningAnalysisDecision]:
mask_prop_algo = MaskPropagationAlgorithm(graph, self._pruning_operator_metatypes)
can_prune_by_dim = mask_prop_algo.symbolic_mask_propagation(self._prune_operations_types, can_prune_after_check)
... | [
"def",
"_pruning_dimensions_analysis",
"(",
"self",
",",
"graph",
",",
"can_prune_after_check",
")",
"->",
"Dict",
"[",
"int",
",",
"PruningAnalysisDecision",
"]",
":",
"mask_prop_algo",
"=",
"MaskPropagationAlgorithm",
"(",
"graph",
",",
"self",
".",
"_pruning_oper... | Check all nodes that were marked as prunable after the model analysis and compatibility check vs.
pruning algo have a correct correspondent closing node on each path form self to outputs. | [
"Check",
"all",
"nodes",
"that",
"were",
"marked",
"as",
"prunable",
"after",
"the",
"model",
"analysis",
"and",
"compatibility",
"check",
"vs",
".",
"pruning",
"algo",
"have",
"a",
"correct",
"correspondent",
"closing",
"node",
"on",
"each",
"path",
"form",
... | [
"\"\"\"\n Check all nodes that were marked as prunable after the model analysis and compatibility check vs.\n pruning algo have a correct correspondent closing node on each path form self to outputs.\n\n :param graph: Graph to work with.\n :param can_prune_after_check: Dict of node indic... | [
{
"param": "self",
"type": null
},
{
"param": "graph",
"type": null
},
{
"param": "can_prune_after_check",
"type": null
}
] | {
"returns": [
{
"docstring": "Pruning node analysis after model analyzer, pruning algo compatibility and pruning dimensions checks.",
"docstring_tokens": [
"Pruning",
"node",
"analysis",
"after",
"model",
"analyzer",
"pruning",
"algo",
... |
66173f7a015bdadf7a4ae2570d2767e187d9cb2b | vuiseng9/nncf_pytorch | nncf/common/pruning/node_selector.py | [
"Apache-2.0"
] | Python | _should_prune_groups_analysis | Dict[int, PruningAnalysisDecision] | def _should_prune_groups_analysis(self, graph: NNCFGraph, pruned_nodes_clusterization: Clusterization,
can_prune: Dict[int, PruningAnalysisDecision]) \
-> Dict[int, PruningAnalysisDecision]:
"""
Check whether all nodes in group can be pruned based on use... |
Check whether all nodes in group can be pruned based on user-defined constraints and
model analysis. Otherwise the whole group cannot be pruned.
:param graph: Graph to work with.
:param pruned_nodes_clusterization: Clusterization with pruning nodes groups.
:param can_prune: Com... | Check whether all nodes in group can be pruned based on user-defined constraints and
model analysis. Otherwise the whole group cannot be pruned. | [
"Check",
"whether",
"all",
"nodes",
"in",
"group",
"can",
"be",
"pruned",
"based",
"on",
"user",
"-",
"defined",
"constraints",
"and",
"model",
"analysis",
".",
"Otherwise",
"the",
"whole",
"group",
"cannot",
"be",
"pruned",
"."
] | def _should_prune_groups_analysis(self, graph: NNCFGraph, pruned_nodes_clusterization: Clusterization,
can_prune: Dict[int, PruningAnalysisDecision]) \
-> Dict[int, PruningAnalysisDecision]:
should_prune = {}
for cluster in pruned_nodes_clusterization.ge... | [
"def",
"_should_prune_groups_analysis",
"(",
"self",
",",
"graph",
":",
"NNCFGraph",
",",
"pruned_nodes_clusterization",
":",
"Clusterization",
",",
"can_prune",
":",
"Dict",
"[",
"int",
",",
"PruningAnalysisDecision",
"]",
")",
"->",
"Dict",
"[",
"int",
",",
"P... | Check whether all nodes in group can be pruned based on user-defined constraints and
model analysis. | [
"Check",
"whether",
"all",
"nodes",
"in",
"group",
"can",
"be",
"pruned",
"based",
"on",
"user",
"-",
"defined",
"constraints",
"and",
"model",
"analysis",
"."
] | [
"\"\"\"\n Check whether all nodes in group can be pruned based on user-defined constraints and\n model analysis. Otherwise the whole group cannot be pruned.\n\n :param graph: Graph to work with.\n :param pruned_nodes_clusterization: Clusterization with pruning nodes groups.\n :par... | [
{
"param": "self",
"type": null
},
{
"param": "graph",
"type": "NNCFGraph"
},
{
"param": "pruned_nodes_clusterization",
"type": "Clusterization"
},
{
"param": "can_prune",
"type": "Dict[int, PruningAnalysisDecision]"
}
] | {
"returns": [
{
"docstring": null,
"docstring_tokens": [
"None"
],
"type": null
}
],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
... |
66173f7a015bdadf7a4ae2570d2767e187d9cb2b | vuiseng9/nncf_pytorch | nncf/common/pruning/node_selector.py | [
"Apache-2.0"
] | Python | _filter_groups | None | def _filter_groups(self, pruned_nodes_clusterization: Clusterization,
can_prune: Dict[int, PruningAnalysisDecision]) -> None:
"""
Check whether all nodes in group can be pruned based on user-defined constraints and
connections inside the network. Otherwise the whole group ... |
Check whether all nodes in group can be pruned based on user-defined constraints and
connections inside the network. Otherwise the whole group cannot be pruned and will be
removed the clusterization.
:param pruned_nodes_clusterization: Clusterization with pruning nodes groups.
... | Check whether all nodes in group can be pruned based on user-defined constraints and
connections inside the network. Otherwise the whole group cannot be pruned and will be
removed the clusterization. | [
"Check",
"whether",
"all",
"nodes",
"in",
"group",
"can",
"be",
"pruned",
"based",
"on",
"user",
"-",
"defined",
"constraints",
"and",
"connections",
"inside",
"the",
"network",
".",
"Otherwise",
"the",
"whole",
"group",
"cannot",
"be",
"pruned",
"and",
"wil... | def _filter_groups(self, pruned_nodes_clusterization: Clusterization,
can_prune: Dict[int, PruningAnalysisDecision]) -> None:
for cluster in pruned_nodes_clusterization.get_all_clusters():
nodes_decisions = [can_prune[node.node_id] for node in cluster.elements]
nod... | [
"def",
"_filter_groups",
"(",
"self",
",",
"pruned_nodes_clusterization",
":",
"Clusterization",
",",
"can_prune",
":",
"Dict",
"[",
"int",
",",
"PruningAnalysisDecision",
"]",
")",
"->",
"None",
":",
"for",
"cluster",
"in",
"pruned_nodes_clusterization",
".",
"ge... | Check whether all nodes in group can be pruned based on user-defined constraints and
connections inside the network. | [
"Check",
"whether",
"all",
"nodes",
"in",
"group",
"can",
"be",
"pruned",
"based",
"on",
"user",
"-",
"defined",
"constraints",
"and",
"connections",
"inside",
"the",
"network",
"."
] | [
"\"\"\"\n Check whether all nodes in group can be pruned based on user-defined constraints and\n connections inside the network. Otherwise the whole group cannot be pruned and will be\n removed the clusterization.\n\n :param pruned_nodes_clusterization: Clusterization with pruning nodes ... | [
{
"param": "self",
"type": null
},
{
"param": "pruned_nodes_clusterization",
"type": "Clusterization"
},
{
"param": "can_prune",
"type": "Dict[int, PruningAnalysisDecision]"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "pruned_nodes_clusterization",
"type": "Clusterization",
"docstring"... |
66173f7a015bdadf7a4ae2570d2767e187d9cb2b | vuiseng9/nncf_pytorch | nncf/common/pruning/node_selector.py | [
"Apache-2.0"
] | Python | _is_module_prunable | PruningAnalysisDecision | def _is_module_prunable(self, graph: NNCFGraph, node: NNCFNode) -> PruningAnalysisDecision:
"""
Check whether we should prune module corresponding to provided node
according to algorithm parameters.
:param graph: Graph to work with.
:param node: Node to check.
:return: P... |
Check whether we should prune module corresponding to provided node
according to algorithm parameters.
:param graph: Graph to work with.
:param node: Node to check.
:return: Pruning analysis decision.
| Check whether we should prune module corresponding to provided node
according to algorithm parameters. | [
"Check",
"whether",
"we",
"should",
"prune",
"module",
"corresponding",
"to",
"provided",
"node",
"according",
"to",
"algorithm",
"parameters",
"."
] | def _is_module_prunable(self, graph: NNCFGraph, node: NNCFNode) -> PruningAnalysisDecision:
stop_propagation_ops = self._stop_propagation_op_metatype.get_all_op_aliases()
types_to_track = self._prune_operations_types + stop_propagation_ops
input_non_pruned_nodes = get_first_nodes_of_type(graph, ... | [
"def",
"_is_module_prunable",
"(",
"self",
",",
"graph",
":",
"NNCFGraph",
",",
"node",
":",
"NNCFNode",
")",
"->",
"PruningAnalysisDecision",
":",
"stop_propagation_ops",
"=",
"self",
".",
"_stop_propagation_op_metatype",
".",
"get_all_op_aliases",
"(",
")",
"types... | Check whether we should prune module corresponding to provided node
according to algorithm parameters. | [
"Check",
"whether",
"we",
"should",
"prune",
"module",
"corresponding",
"to",
"provided",
"node",
"according",
"to",
"algorithm",
"parameters",
"."
] | [
"\"\"\"\n Check whether we should prune module corresponding to provided node\n according to algorithm parameters.\n\n :param graph: Graph to work with.\n :param node: Node to check.\n :return: Pruning analysis decision.\n \"\"\""
] | [
{
"param": "self",
"type": null
},
{
"param": "graph",
"type": "NNCFGraph"
},
{
"param": "node",
"type": "NNCFNode"
}
] | {
"returns": [
{
"docstring": "Pruning analysis decision.",
"docstring_tokens": [
"Pruning",
"analysis",
"decision",
"."
],
"type": null
}
],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
... |
c5f2bf94ba2cd982b3580a2d6cc3477f3605e67c | inbalme/CodeForPosts | utils.py | [
"MIT"
] | Python | make_error_df | <not_specific> | def make_error_df(actual, predicted):
'''
returns a dataframe with prediction errors (diff-error and relative-errors)
from input numpy arrays of actual and predicted values.
:param actual: numpy array
:param predicted: numpy array
:return:
'''
dict = {'actual': actual, 'predicted': predi... |
returns a dataframe with prediction errors (diff-error and relative-errors)
from input numpy arrays of actual and predicted values.
:param actual: numpy array
:param predicted: numpy array
:return:
| returns a dataframe with prediction errors (diff-error and relative-errors)
from input numpy arrays of actual and predicted values. | [
"returns",
"a",
"dataframe",
"with",
"prediction",
"errors",
"(",
"diff",
"-",
"error",
"and",
"relative",
"-",
"errors",
")",
"from",
"input",
"numpy",
"arrays",
"of",
"actual",
"and",
"predicted",
"values",
"."
] | def make_error_df(actual, predicted):
dict = {'actual': actual, 'predicted': predicted}
error_df = pd.DataFrame(data=dict)
error_df['error'] = error_df['actual'] - error_df['predicted']
error_df['error_relative_to_predicted'] = error_df['error'] / error_df['predicted']
error_df['error_relative_to_ac... | [
"def",
"make_error_df",
"(",
"actual",
",",
"predicted",
")",
":",
"dict",
"=",
"{",
"'actual'",
":",
"actual",
",",
"'predicted'",
":",
"predicted",
"}",
"error_df",
"=",
"pd",
".",
"DataFrame",
"(",
"data",
"=",
"dict",
")",
"error_df",
"[",
"'error'",... | returns a dataframe with prediction errors (diff-error and relative-errors)
from input numpy arrays of actual and predicted values. | [
"returns",
"a",
"dataframe",
"with",
"prediction",
"errors",
"(",
"diff",
"-",
"error",
"and",
"relative",
"-",
"errors",
")",
"from",
"input",
"numpy",
"arrays",
"of",
"actual",
"and",
"predicted",
"values",
"."
] | [
"'''\n returns a dataframe with prediction errors (diff-error and relative-errors)\n from input numpy arrays of actual and predicted values.\n :param actual: numpy array\n :param predicted: numpy array\n :return:\n '''"
] | [
{
"param": "actual",
"type": null
},
{
"param": "predicted",
"type": null
}
] | {
"returns": [
{
"docstring": null,
"docstring_tokens": [
"None"
],
"type": null
}
],
"raises": [],
"params": [
{
"identifier": "actual",
"type": null,
"docstring": null,
"docstring_tokens": [
"None"
],
"default": null,
... |
c5f2bf94ba2cd982b3580a2d6cc3477f3605e67c | inbalme/CodeForPosts | utils.py | [
"MIT"
] | Python | plot_scatter | <not_specific> | def plot_scatter(x, y, add_unit_line=True, add_R2=True, layout_kwargs=None):
'''
makes a scatter plot with Plotly
:param x: numpy array
:param y: numpy array
:param add_unit_line: boolean. whether to add a line x=y
:param add_R2: boolean. whether to add text of R2 on the plot
:param layout_k... |
makes a scatter plot with Plotly
:param x: numpy array
:param y: numpy array
:param add_unit_line: boolean. whether to add a line x=y
:param add_R2: boolean. whether to add text of R2 on the plot
:param layout_kwargs: a dictionary, according to plotly API:
https://plotly.com/python/figu... | makes a scatter plot with Plotly | [
"makes",
"a",
"scatter",
"plot",
"with",
"Plotly"
] | def plot_scatter(x, y, add_unit_line=True, add_R2=True, layout_kwargs=None):
unit_line = [np.nanmin(np.append(x, y)), np.nanmax(np.append(x, y))]
R2 = round(explained_variance_score(x, y), 3)
fig = go.Figure()
fig.add_trace(go.Scatter(x=x, y=y,
mode='markers',
... | [
"def",
"plot_scatter",
"(",
"x",
",",
"y",
",",
"add_unit_line",
"=",
"True",
",",
"add_R2",
"=",
"True",
",",
"layout_kwargs",
"=",
"None",
")",
":",
"unit_line",
"=",
"[",
"np",
".",
"nanmin",
"(",
"np",
".",
"append",
"(",
"x",
",",
"y",
")",
... | makes a scatter plot with Plotly | [
"makes",
"a",
"scatter",
"plot",
"with",
"Plotly"
] | [
"'''\n makes a scatter plot with Plotly\n :param x: numpy array\n :param y: numpy array\n :param add_unit_line: boolean. whether to add a line x=y\n :param add_R2: boolean. whether to add text of R2 on the plot\n :param layout_kwargs: a dictionary, according to plotly API:\n https://plotly.... | [
{
"param": "x",
"type": null
},
{
"param": "y",
"type": null
},
{
"param": "add_unit_line",
"type": null
},
{
"param": "add_R2",
"type": null
},
{
"param": "layout_kwargs",
"type": null
}
] | {
"returns": [
{
"docstring": "plotly figure object",
"docstring_tokens": [
"plotly",
"figure",
"object"
],
"type": null
}
],
"raises": [],
"params": [
{
"identifier": "x",
"type": null,
"docstring": null,
"docstring_tokens": [
... |
c5f2bf94ba2cd982b3580a2d6cc3477f3605e67c | inbalme/CodeForPosts | utils.py | [
"MIT"
] | Python | calc_metrics_regression | <not_specific> | def calc_metrics_regression(actual, predicted, digits=3):
'''
returns a dictionary of regression metrics calculated from input numpy arrays of actual and predicted values
:param actual:
:param predicted:
:param digits:
:return:
'''
R2_score = round(explained_variance_score(actual, predi... |
returns a dictionary of regression metrics calculated from input numpy arrays of actual and predicted values
:param actual:
:param predicted:
:param digits:
:return:
| returns a dictionary of regression metrics calculated from input numpy arrays of actual and predicted values | [
"returns",
"a",
"dictionary",
"of",
"regression",
"metrics",
"calculated",
"from",
"input",
"numpy",
"arrays",
"of",
"actual",
"and",
"predicted",
"values"
] | def calc_metrics_regression(actual, predicted, digits=3):
R2_score = round(explained_variance_score(actual, predicted), digits)
mae = round(mean_absolute_error(actual, predicted), digits)
mse = round(mean_squared_error(actual, predicted), digits)
rmse = round(sqrt(mean_squared_error(actual, predicted)),... | [
"def",
"calc_metrics_regression",
"(",
"actual",
",",
"predicted",
",",
"digits",
"=",
"3",
")",
":",
"R2_score",
"=",
"round",
"(",
"explained_variance_score",
"(",
"actual",
",",
"predicted",
")",
",",
"digits",
")",
"mae",
"=",
"round",
"(",
"mean_absolut... | returns a dictionary of regression metrics calculated from input numpy arrays of actual and predicted values | [
"returns",
"a",
"dictionary",
"of",
"regression",
"metrics",
"calculated",
"from",
"input",
"numpy",
"arrays",
"of",
"actual",
"and",
"predicted",
"values"
] | [
"'''\n returns a dictionary of regression metrics calculated from input numpy arrays of actual and predicted values\n :param actual:\n :param predicted:\n :param digits:\n :return:\n '''"
] | [
{
"param": "actual",
"type": null
},
{
"param": "predicted",
"type": null
},
{
"param": "digits",
"type": null
}
] | {
"returns": [
{
"docstring": null,
"docstring_tokens": [
"None"
],
"type": null
}
],
"raises": [],
"params": [
{
"identifier": "actual",
"type": null,
"docstring": null,
"docstring_tokens": [
"None"
],
"default": null,
... |
d3e31ebb0cc4b7503b9217113188fb69011eccda | inbalme/CodeForPosts | error_analysis_dashboard.py | [
"MIT"
] | Python | filter_data_rows | <not_specific> | def filter_data_rows(self):
'''
filter the dataframe rows by a cutoff_value and a column set by the user.
:return: dataframe where the values in column "cutoff_by_column" >= "cutoff_value"
'''
data = self.df.copy()
data = utils.filter_df_rows(df=data, cutoff_by_column=sel... |
filter the dataframe rows by a cutoff_value and a column set by the user.
:return: dataframe where the values in column "cutoff_by_column" >= "cutoff_value"
| filter the dataframe rows by a cutoff_value and a column set by the user. | [
"filter",
"the",
"dataframe",
"rows",
"by",
"a",
"cutoff_value",
"and",
"a",
"column",
"set",
"by",
"the",
"user",
"."
] | def filter_data_rows(self):
data = self.df.copy()
data = utils.filter_df_rows(df=data, cutoff_by_column=self.cutoff_by_column, cutoff_value=self.cutoff_value)
return data | [
"def",
"filter_data_rows",
"(",
"self",
")",
":",
"data",
"=",
"self",
".",
"df",
".",
"copy",
"(",
")",
"data",
"=",
"utils",
".",
"filter_df_rows",
"(",
"df",
"=",
"data",
",",
"cutoff_by_column",
"=",
"self",
".",
"cutoff_by_column",
",",
"cutoff_valu... | filter the dataframe rows by a cutoff_value and a column set by the user. | [
"filter",
"the",
"dataframe",
"rows",
"by",
"a",
"cutoff_value",
"and",
"a",
"column",
"set",
"by",
"the",
"user",
"."
] | [
"'''\n filter the dataframe rows by a cutoff_value and a column set by the user.\n :return: dataframe where the values in column \"cutoff_by_column\" >= \"cutoff_value\"\n '''"
] | [
{
"param": "self",
"type": null
}
] | {
"returns": [
{
"docstring": "dataframe where the values in column \"cutoff_by_column\" >= \"cutoff_value\"",
"docstring_tokens": [
"dataframe",
"where",
"the",
"values",
"in",
"column",
"\"",
"cutoff_by_column",
"\"",
">... |
d3e31ebb0cc4b7503b9217113188fb69011eccda | inbalme/CodeForPosts | error_analysis_dashboard.py | [
"MIT"
] | Python | scatter_view | <not_specific> | def scatter_view(self):
'''
create a scatter plot using the filtered dataframe (output of self.filter_data_rows) and where x and y axes are
dataframe columns set by the user via self.x and self.y
:return: a Plotly scatter plot wrapped by Panel package
'''
data = self.filt... |
create a scatter plot using the filtered dataframe (output of self.filter_data_rows) and where x and y axes are
dataframe columns set by the user via self.x and self.y
:return: a Plotly scatter plot wrapped by Panel package
| create a scatter plot using the filtered dataframe (output of self.filter_data_rows) and where x and y axes are
dataframe columns set by the user via self.x and self.y | [
"create",
"a",
"scatter",
"plot",
"using",
"the",
"filtered",
"dataframe",
"(",
"output",
"of",
"self",
".",
"filter_data_rows",
")",
"and",
"where",
"x",
"and",
"y",
"axes",
"are",
"dataframe",
"columns",
"set",
"by",
"the",
"user",
"via",
"self",
".",
... | def scatter_view(self):
data = self.filter_data_rows()
array_x = data[self.X].to_numpy()
array_y = data[self.Y].to_numpy()
fig = utils.plot_scatter(x=array_x, y=array_y,
add_unit_line=True, add_R2=True,
layout_kwargs=dict(... | [
"def",
"scatter_view",
"(",
"self",
")",
":",
"data",
"=",
"self",
".",
"filter_data_rows",
"(",
")",
"array_x",
"=",
"data",
"[",
"self",
".",
"X",
"]",
".",
"to_numpy",
"(",
")",
"array_y",
"=",
"data",
"[",
"self",
".",
"Y",
"]",
".",
"to_numpy"... | create a scatter plot using the filtered dataframe (output of self.filter_data_rows) and where x and y axes are
dataframe columns set by the user via self.x and self.y | [
"create",
"a",
"scatter",
"plot",
"using",
"the",
"filtered",
"dataframe",
"(",
"output",
"of",
"self",
".",
"filter_data_rows",
")",
"and",
"where",
"x",
"and",
"y",
"axes",
"are",
"dataframe",
"columns",
"set",
"by",
"the",
"user",
"via",
"self",
".",
... | [
"'''\n create a scatter plot using the filtered dataframe (output of self.filter_data_rows) and where x and y axes are\n dataframe columns set by the user via self.x and self.y\n :return: a Plotly scatter plot wrapped by Panel package\n '''"
] | [
{
"param": "self",
"type": null
}
] | {
"returns": [
{
"docstring": "a Plotly scatter plot wrapped by Panel package",
"docstring_tokens": [
"a",
"Plotly",
"scatter",
"plot",
"wrapped",
"by",
"Panel",
"package"
],
"type": null
}
],
"raises": [],
"params":... |
d3e31ebb0cc4b7503b9217113188fb69011eccda | inbalme/CodeForPosts | error_analysis_dashboard.py | [
"MIT"
] | Python | error_boxplot_view | <not_specific> | def error_boxplot_view(self):
'''
create a boxplot using the filtered dataframe (output of self.filter_data_rows) and where the data is
dataframe column set by the user via self.var_to_inspect.
:return: a Plotly boxplot wrapped by Panel package
'''
data = self.filter_data... |
create a boxplot using the filtered dataframe (output of self.filter_data_rows) and where the data is
dataframe column set by the user via self.var_to_inspect.
:return: a Plotly boxplot wrapped by Panel package
| create a boxplot using the filtered dataframe (output of self.filter_data_rows) and where the data is
dataframe column set by the user via self.var_to_inspect. | [
"create",
"a",
"boxplot",
"using",
"the",
"filtered",
"dataframe",
"(",
"output",
"of",
"self",
".",
"filter_data_rows",
")",
"and",
"where",
"the",
"data",
"is",
"dataframe",
"column",
"set",
"by",
"the",
"user",
"via",
"self",
".",
"var_to_inspect",
"."
] | def error_boxplot_view(self):
data = self.filter_data_rows()
fig = px.box(data, y=self.var_to_inspect, color_discrete_sequence=['green'])
return pn.pane.Plotly(fig, width=400) | [
"def",
"error_boxplot_view",
"(",
"self",
")",
":",
"data",
"=",
"self",
".",
"filter_data_rows",
"(",
")",
"fig",
"=",
"px",
".",
"box",
"(",
"data",
",",
"y",
"=",
"self",
".",
"var_to_inspect",
",",
"color_discrete_sequence",
"=",
"[",
"'green'",
"]",... | create a boxplot using the filtered dataframe (output of self.filter_data_rows) and where the data is
dataframe column set by the user via self.var_to_inspect. | [
"create",
"a",
"boxplot",
"using",
"the",
"filtered",
"dataframe",
"(",
"output",
"of",
"self",
".",
"filter_data_rows",
")",
"and",
"where",
"the",
"data",
"is",
"dataframe",
"column",
"set",
"by",
"the",
"user",
"via",
"self",
".",
"var_to_inspect",
"."
] | [
"'''\n create a boxplot using the filtered dataframe (output of self.filter_data_rows) and where the data is\n dataframe column set by the user via self.var_to_inspect.\n :return: a Plotly boxplot wrapped by Panel package\n '''"
] | [
{
"param": "self",
"type": null
}
] | {
"returns": [
{
"docstring": "a Plotly boxplot wrapped by Panel package",
"docstring_tokens": [
"a",
"Plotly",
"boxplot",
"wrapped",
"by",
"Panel",
"package"
],
"type": null
}
],
"raises": [],
"params": [
{
"ident... |
d3e31ebb0cc4b7503b9217113188fb69011eccda | inbalme/CodeForPosts | error_analysis_dashboard.py | [
"MIT"
] | Python | wrap_param_var_to_inspect | <not_specific> | def wrap_param_var_to_inspect(self):
'''
change the default widget of self.var_to_inspect from drop-down menu to Radio-button.
:return: a widget wrapped by Panel package
'''
return pn.Param(self.param, parameters=['var_to_inspect'], # pn.Param is a wrapper of Panel package for P... |
change the default widget of self.var_to_inspect from drop-down menu to Radio-button.
:return: a widget wrapped by Panel package
| change the default widget of self.var_to_inspect from drop-down menu to Radio-button. | [
"change",
"the",
"default",
"widget",
"of",
"self",
".",
"var_to_inspect",
"from",
"drop",
"-",
"down",
"menu",
"to",
"Radio",
"-",
"button",
"."
] | def wrap_param_var_to_inspect(self):
return pn.Param(self.param, parameters=['var_to_inspect'],
name='Choose variable to inspect distribution',
show_name=True,
widgets={'var_to_inspect': {'type': pn.widgets.RadioButtonGroup}},
width=200) | [
"def",
"wrap_param_var_to_inspect",
"(",
"self",
")",
":",
"return",
"pn",
".",
"Param",
"(",
"self",
".",
"param",
",",
"parameters",
"=",
"[",
"'var_to_inspect'",
"]",
",",
"name",
"=",
"'Choose variable to inspect distribution'",
",",
"show_name",
"=",
"True"... | change the default widget of self.var_to_inspect from drop-down menu to Radio-button. | [
"change",
"the",
"default",
"widget",
"of",
"self",
".",
"var_to_inspect",
"from",
"drop",
"-",
"down",
"menu",
"to",
"Radio",
"-",
"button",
"."
] | [
"'''\n change the default widget of self.var_to_inspect from drop-down menu to Radio-button.\n :return: a widget wrapped by Panel package\n '''",
"# pn.Param is a wrapper of Panel package for Param objects."
] | [
{
"param": "self",
"type": null
}
] | {
"returns": [
{
"docstring": "a widget wrapped by Panel package",
"docstring_tokens": [
"a",
"widget",
"wrapped",
"by",
"Panel",
"package"
],
"type": null
}
],
"raises": [],
"params": [
{
"identifier": "self",
"type... |
d3e31ebb0cc4b7503b9217113188fb69011eccda | inbalme/CodeForPosts | error_analysis_dashboard.py | [
"MIT"
] | Python | _update_cutoff_value | null | def _update_cutoff_value(self):
'''
an update method to dynamically change the range of self.cutoff_value based on the user selection of self.cutoff_by_column.
This method is triggered each time the chosen 'cutoff_by_column' change
'''
self.param['cutoff_value'].bounds = (self.df... |
an update method to dynamically change the range of self.cutoff_value based on the user selection of self.cutoff_by_column.
This method is triggered each time the chosen 'cutoff_by_column' change
| an update method to dynamically change the range of self.cutoff_value based on the user selection of self.cutoff_by_column.
This method is triggered each time the chosen 'cutoff_by_column' change | [
"an",
"update",
"method",
"to",
"dynamically",
"change",
"the",
"range",
"of",
"self",
".",
"cutoff_value",
"based",
"on",
"the",
"user",
"selection",
"of",
"self",
".",
"cutoff_by_column",
".",
"This",
"method",
"is",
"triggered",
"each",
"time",
"the",
"ch... | def _update_cutoff_value(self):
self.param['cutoff_value'].bounds = (self.df[self.cutoff_by_column].min(), self.df[self.cutoff_by_column].max())
self.cutoff_value = self.df[self.cutoff_by_column].min() | [
"def",
"_update_cutoff_value",
"(",
"self",
")",
":",
"self",
".",
"param",
"[",
"'cutoff_value'",
"]",
".",
"bounds",
"=",
"(",
"self",
".",
"df",
"[",
"self",
".",
"cutoff_by_column",
"]",
".",
"min",
"(",
")",
",",
"self",
".",
"df",
"[",
"self",
... | an update method to dynamically change the range of self.cutoff_value based on the user selection of self.cutoff_by_column. | [
"an",
"update",
"method",
"to",
"dynamically",
"change",
"the",
"range",
"of",
"self",
".",
"cutoff_value",
"based",
"on",
"the",
"user",
"selection",
"of",
"self",
".",
"cutoff_by_column",
"."
] | [
"'''\n an update method to dynamically change the range of self.cutoff_value based on the user selection of self.cutoff_by_column.\n This method is triggered each time the chosen 'cutoff_by_column' change\n '''"
] | [
{
"param": "self",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
ffc66ab173d2f0d7de754078ffed203b2465b3c5 | jofaval/screenshot | src/screenshot.py | [
"Apache-2.0"
] | Python | hyper_import | None | def hyper_import(module: str) -> None:
"""
Imports a module, and install it if not previously installed
module : str
The module to attempt to install
returns None
"""
try:
__import__(module)
except:
pip.main([ 'install', module ]) |
Imports a module, and install it if not previously installed
module : str
The module to attempt to install
returns None
| Imports a module, and install it if not previously installed
module : str
The module to attempt to install
returns None | [
"Imports",
"a",
"module",
"and",
"install",
"it",
"if",
"not",
"previously",
"installed",
"module",
":",
"str",
"The",
"module",
"to",
"attempt",
"to",
"install",
"returns",
"None"
] | def hyper_import(module: str) -> None:
try:
__import__(module)
except:
pip.main([ 'install', module ]) | [
"def",
"hyper_import",
"(",
"module",
":",
"str",
")",
"->",
"None",
":",
"try",
":",
"__import__",
"(",
"module",
")",
"except",
":",
"pip",
".",
"main",
"(",
"[",
"'install'",
",",
"module",
"]",
")"
] | Imports a module, and install it if not previously installed
module : str
The module to attempt to install | [
"Imports",
"a",
"module",
"and",
"install",
"it",
"if",
"not",
"previously",
"installed",
"module",
":",
"str",
"The",
"module",
"to",
"attempt",
"to",
"install"
] | [
"\"\"\"\n Imports a module, and install it if not previously installed\n\n module : str\n The module to attempt to install\n\n returns None\n \"\"\""
] | [
{
"param": "module",
"type": "str"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "module",
"type": "str",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
ffc66ab173d2f0d7de754078ffed203b2465b3c5 | jofaval/screenshot | src/screenshot.py | [
"Apache-2.0"
] | Python | unique_id | str | def unique_id() -> str:
"""
Generates a unique ID
returns str
"""
return uuid.uuid4() |
Generates a unique ID
returns str
| Generates a unique ID
returns str | [
"Generates",
"a",
"unique",
"ID",
"returns",
"str"
] | def unique_id() -> str:
return uuid.uuid4() | [
"def",
"unique_id",
"(",
")",
"->",
"str",
":",
"return",
"uuid",
".",
"uuid4",
"(",
")"
] | Generates a unique ID
returns str | [
"Generates",
"a",
"unique",
"ID",
"returns",
"str"
] | [
"\"\"\"\n Generates a unique ID\n\n returns str\n \"\"\""
] | [] | {
"returns": [],
"raises": [],
"params": [],
"outlier_params": [],
"others": []
} |
ffc66ab173d2f0d7de754078ffed203b2465b3c5 | jofaval/screenshot | src/screenshot.py | [
"Apache-2.0"
] | Python | screenshot | str | def screenshot(url: str, configuration: dict = {}) -> str:
"""
Screenshots a url website
url : str
The url from which to get a Screenshot
configuration : dict
The configuration object
returns str
"""
# Merge the two dicitionaries
configuration = { **default_configurati... |
Screenshots a url website
url : str
The url from which to get a Screenshot
configuration : dict
The configuration object
returns str
| Screenshots a url website
url : str
The url from which to get a Screenshot
configuration : dict
The configuration object
returns str | [
"Screenshots",
"a",
"url",
"website",
"url",
":",
"str",
"The",
"url",
"from",
"which",
"to",
"get",
"a",
"Screenshot",
"configuration",
":",
"dict",
"The",
"configuration",
"object",
"returns",
"str"
] | def screenshot(url: str, configuration: dict = {}) -> str:
configuration = { **default_configuration, **configuration }
uniqueid = unique_id()
taret_dir = os.path.join(basedir, 'screenshots')
if not os.path.exists(taret_dir): os.mkdir(taret_dir)
target_path = os.path.join(taret_dir, f'{uniqueid}.png... | [
"def",
"screenshot",
"(",
"url",
":",
"str",
",",
"configuration",
":",
"dict",
"=",
"{",
"}",
")",
"->",
"str",
":",
"configuration",
"=",
"{",
"**",
"default_configuration",
",",
"**",
"configuration",
"}",
"uniqueid",
"=",
"unique_id",
"(",
")",
"tare... | Screenshots a url website
url : str
The url from which to get a Screenshot
configuration : dict
The configuration object | [
"Screenshots",
"a",
"url",
"website",
"url",
":",
"str",
"The",
"url",
"from",
"which",
"to",
"get",
"a",
"Screenshot",
"configuration",
":",
"dict",
"The",
"configuration",
"object"
] | [
"\"\"\"\n Screenshots a url website\n\n url : str\n The url from which to get a Screenshot\n configuration : dict\n The configuration object\n\n returns str\n \"\"\"",
"# Merge the two dicitionaries",
"# Generate the target path",
"# Set the size, if the dimensions are given",
"... | [
{
"param": "url",
"type": "str"
},
{
"param": "configuration",
"type": "dict"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "url",
"type": "str",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "configuration",
"type": "dict",
"docstring": null,
"docstring... |
c928dcc3c00857ae05875189437f39fbec723557 | amitjslearn/wordipy | wordipy/main.py | [
"BSD-2-Clause"
] | Python | abbreviationize | <not_specific> | def abbreviationize(input_str, sep=""):
"""
This function does the following two things
1) Takes the abbrevation with or without space and returns the abbrevation without spaces
2) Takes the tupled item and returns the repeated item tuple times (tuple is not a data type in this context)
Paramet... |
This function does the following two things
1) Takes the abbrevation with or without space and returns the abbrevation without spaces
2) Takes the tupled item and returns the repeated item tuple times (tuple is not a data type in this context)
Parameters
----------
input_str : str
sep ... | This function does the following two things
1) Takes the abbrevation with or without space and returns the abbrevation without spaces
2) Takes the tupled item and returns the repeated item tuple times (tuple is not a data type in this context)
Parameters
input_str : str
sep : str (symbols like comma (,))
Returns
st... | [
"This",
"function",
"does",
"the",
"following",
"two",
"things",
"1",
")",
"Takes",
"the",
"abbrevation",
"with",
"or",
"without",
"space",
"and",
"returns",
"the",
"abbrevation",
"without",
"spaces",
"2",
")",
"Takes",
"the",
"tupled",
"item",
"and",
"retur... | def abbreviationize(input_str, sep=""):
process_words = helpers.processing(input_str)
input_str_list = input_str.split(" ")
intersection = set(process_words) & set(voc.tuple_.keys())
if len(intersection):
times = intersection.pop()
times_num = int(voc.tuple_[times])
item = input_... | [
"def",
"abbreviationize",
"(",
"input_str",
",",
"sep",
"=",
"\"\"",
")",
":",
"process_words",
"=",
"helpers",
".",
"processing",
"(",
"input_str",
")",
"input_str_list",
"=",
"input_str",
".",
"split",
"(",
"\" \"",
")",
"intersection",
"=",
"set",
"(",
... | This function does the following two things
1) Takes the abbrevation with or without space and returns the abbrevation without spaces
2) Takes the tupled item and returns the repeated item tuple times (tuple is not a data type in this context) | [
"This",
"function",
"does",
"the",
"following",
"two",
"things",
"1",
")",
"Takes",
"the",
"abbrevation",
"with",
"or",
"without",
"space",
"and",
"returns",
"the",
"abbrevation",
"without",
"spaces",
"2",
")",
"Takes",
"the",
"tupled",
"item",
"and",
"retur... | [
"\"\"\"\n This function does the following two things\n 1) Takes the abbrevation with or without space and returns the abbrevation without spaces\n 2) Takes the tupled item and returns the repeated item tuple times (tuple is not a data type in this context)\n \n Parameters\n ----------\n input_... | [
{
"param": "input_str",
"type": null
},
{
"param": "sep",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "input_str",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "sep",
"type": null,
"docstring": null,
"docstring_tokens... |
c928dcc3c00857ae05875189437f39fbec723557 | amitjslearn/wordipy | wordipy/main.py | [
"BSD-2-Clause"
] | Python | final_abbreviationize | <not_specific> | def final_abbreviationize(output, input_str_list):
""" This is a helper function for abbreviationize"""
if all([x.isupper() for x in input_str_list]) or all(x.isupper() for x in output.split()):
'''
if all are upper ex: C M -> CM
'''
pattern = re.compile(r's+')
output = ... | This is a helper function for abbreviationize | This is a helper function for abbreviationize | [
"This",
"is",
"a",
"helper",
"function",
"for",
"abbreviationize"
] | def final_abbreviationize(output, input_str_list):
if all([x.isupper() for x in input_str_list]) or all(x.isupper() for x in output.split()):
pattern = re.compile(r's+')
output = re.sub(pattern, '', output)
output = output.replace(" ", "")
return output | [
"def",
"final_abbreviationize",
"(",
"output",
",",
"input_str_list",
")",
":",
"if",
"all",
"(",
"[",
"x",
".",
"isupper",
"(",
")",
"for",
"x",
"in",
"input_str_list",
"]",
")",
"or",
"all",
"(",
"x",
".",
"isupper",
"(",
")",
"for",
"x",
"in",
"... | This is a helper function for abbreviationize | [
"This",
"is",
"a",
"helper",
"function",
"for",
"abbreviationize"
] | [
"\"\"\" This is a helper function for abbreviationize\"\"\"",
"'''\n if all are upper ex: C M -> CM\n '''",
"#assert(len(\"\".join(input_str_list)) == len(a))"
] | [
{
"param": "output",
"type": null
},
{
"param": "input_str_list",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "output",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "input_str_list",
"type": null,
"docstring": null,
"docstrin... |
0befdba2a9f789fbdba2e4eb7244a6315fa03dd7 | marcol480/fink-science | fink_science/microlensing/classifier.py | [
"Apache-2.0"
] | Python | load_mulens_schema_twobands | <not_specific> | def load_mulens_schema_twobands():
""" DataFrame Schema for the mulens UDF using 2 filter bands
Returns
--------
schema: StructType
StructType with StructFields describing new columns to be added
when using `mulens` in pyspark UDF. There are 2 new columns per
filter bands: the c... | DataFrame Schema for the mulens UDF using 2 filter bands
Returns
--------
schema: StructType
StructType with StructFields describing new columns to be added
when using `mulens` in pyspark UDF. There are 2 new columns per
filter bands: the classification name (str) and
the m... | DataFrame Schema for the mulens UDF using 2 filter bands
Returns
StructType
StructType with StructFields describing new columns to be added
when using `mulens` in pyspark UDF. There are 2 new columns per
filter bands: the classification name (str) and
the mulens score (double). | [
"DataFrame",
"Schema",
"for",
"the",
"mulens",
"UDF",
"using",
"2",
"filter",
"bands",
"Returns",
"StructType",
"StructType",
"with",
"StructFields",
"describing",
"new",
"columns",
"to",
"be",
"added",
"when",
"using",
"`",
"mulens",
"`",
"in",
"pyspark",
"UD... | def load_mulens_schema_twobands():
schema = StructType([
StructField("class_1", StringType(), True),
StructField("ml_score_1", DoubleType(), True),
StructField("class_2", StringType(), True),
StructField("ml_score_2", DoubleType(), True)
])
return schema | [
"def",
"load_mulens_schema_twobands",
"(",
")",
":",
"schema",
"=",
"StructType",
"(",
"[",
"StructField",
"(",
"\"class_1\"",
",",
"StringType",
"(",
")",
",",
"True",
")",
",",
"StructField",
"(",
"\"ml_score_1\"",
",",
"DoubleType",
"(",
")",
",",
"True",... | DataFrame Schema for the mulens UDF using 2 filter bands
Returns | [
"DataFrame",
"Schema",
"for",
"the",
"mulens",
"UDF",
"using",
"2",
"filter",
"bands",
"Returns"
] | [
"\"\"\" DataFrame Schema for the mulens UDF using 2 filter bands\n\n Returns\n --------\n schema: StructType\n StructType with StructFields describing new columns to be added\n when using `mulens` in pyspark UDF. There are 2 new columns per\n filter bands: the classification name (str)... | [] | {
"returns": [],
"raises": [],
"params": [],
"outlier_params": [],
"others": []
} |
cc2b586c906d7d36a672557824d8d0d55331c5bc | gajanlee/tf-bert-ner | run_ner.py | [
"Apache-2.0"
] | Python | convert_examples_to_features | <not_specific> | def convert_examples_to_features(examples, label_list, max_seq_length,
tokenizer, mode="normal"):
"""Convert a set of `InputExample`s to a list of `InputFeatures`."""
features = []
for (ex_index, example) in enumerate(examples):
if ex_index % 10000 == 0:
... | Convert a set of `InputExample`s to a list of `InputFeatures`. | Convert a set of `InputExample`s to a list of `InputFeatures`. | [
"Convert",
"a",
"set",
"of",
"`",
"InputExample",
"`",
"s",
"to",
"a",
"list",
"of",
"`",
"InputFeatures",
"`",
"."
] | def convert_examples_to_features(examples, label_list, max_seq_length,
tokenizer, mode="normal"):
features = []
for (ex_index, example) in enumerate(examples):
if ex_index % 10000 == 0:
tf.logging.info("Writing example %d of %d" % (ex_index, len(examples)))
... | [
"def",
"convert_examples_to_features",
"(",
"examples",
",",
"label_list",
",",
"max_seq_length",
",",
"tokenizer",
",",
"mode",
"=",
"\"normal\"",
")",
":",
"features",
"=",
"[",
"]",
"for",
"(",
"ex_index",
",",
"example",
")",
"in",
"enumerate",
"(",
"exa... | Convert a set of `InputExample`s to a list of `InputFeatures`. | [
"Convert",
"a",
"set",
"of",
"`",
"InputExample",
"`",
"s",
"to",
"a",
"list",
"of",
"`",
"InputFeatures",
"`",
"."
] | [
"\"\"\"Convert a set of `InputExample`s to a list of `InputFeatures`.\"\"\""
] | [
{
"param": "examples",
"type": null
},
{
"param": "label_list",
"type": null
},
{
"param": "max_seq_length",
"type": null
},
{
"param": "tokenizer",
"type": null
},
{
"param": "mode",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "examples",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "label_list",
"type": null,
"docstring": null,
"docstring_... |
cc2b586c906d7d36a672557824d8d0d55331c5bc | gajanlee/tf-bert-ner | run_ner.py | [
"Apache-2.0"
] | Python | _read_sentence | <not_specific> | def _read_sentence(self, input_file):
"""Reads a tab separated value file."""
lines = []
words, labels = [], []
for line in open(input_file, encoding="utf-8"):
line = line.strip()
if len(line) == 0 and len(words) > 0:
lines.append((" ".join(words),... | Reads a tab separated value file. | Reads a tab separated value file. | [
"Reads",
"a",
"tab",
"separated",
"value",
"file",
"."
] | def _read_sentence(self, input_file):
lines = []
words, labels = [], []
for line in open(input_file, encoding="utf-8"):
line = line.strip()
if len(line) == 0 and len(words) > 0:
lines.append((" ".join(words), " ".join(labels)))
words, label... | [
"def",
"_read_sentence",
"(",
"self",
",",
"input_file",
")",
":",
"lines",
"=",
"[",
"]",
"words",
",",
"labels",
"=",
"[",
"]",
",",
"[",
"]",
"for",
"line",
"in",
"open",
"(",
"input_file",
",",
"encoding",
"=",
"\"utf-8\"",
")",
":",
"line",
"=... | Reads a tab separated value file. | [
"Reads",
"a",
"tab",
"separated",
"value",
"file",
"."
] | [
"\"\"\"Reads a tab separated value file.\"\"\""
] | [
{
"param": "self",
"type": null
},
{
"param": "input_file",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "input_file",
"type": null,
"docstring": null,
"docstring_toke... |
cc2b586c906d7d36a672557824d8d0d55331c5bc | gajanlee/tf-bert-ner | run_ner.py | [
"Apache-2.0"
] | Python | _create_examples | <not_specific> | def _create_examples(self, lines, set_type):
"""Creates examples for the training and dev sets."""
examples = []
for (i, line) in enumerate(lines):
guid = "%s-%s" % (set_type, i)
text = tokenization.convert_to_unicode(line[0])
label = tokenization.convert_to_... | Creates examples for the training and dev sets. | Creates examples for the training and dev sets. | [
"Creates",
"examples",
"for",
"the",
"training",
"and",
"dev",
"sets",
"."
] | def _create_examples(self, lines, set_type):
examples = []
for (i, line) in enumerate(lines):
guid = "%s-%s" % (set_type, i)
text = tokenization.convert_to_unicode(line[0])
label = tokenization.convert_to_unicode(line[1])
examples.append(
I... | [
"def",
"_create_examples",
"(",
"self",
",",
"lines",
",",
"set_type",
")",
":",
"examples",
"=",
"[",
"]",
"for",
"(",
"i",
",",
"line",
")",
"in",
"enumerate",
"(",
"lines",
")",
":",
"guid",
"=",
"\"%s-%s\"",
"%",
"(",
"set_type",
",",
"i",
")",... | Creates examples for the training and dev sets. | [
"Creates",
"examples",
"for",
"the",
"training",
"and",
"dev",
"sets",
"."
] | [
"\"\"\"Creates examples for the training and dev sets.\"\"\""
] | [
{
"param": "self",
"type": null
},
{
"param": "lines",
"type": null
},
{
"param": "set_type",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "lines",
"type": null,
"docstring": null,
"docstring_tokens": ... |
cc2b586c906d7d36a672557824d8d0d55331c5bc | gajanlee/tf-bert-ner | run_ner.py | [
"Apache-2.0"
] | Python | file_based_convert_examples_to_features | <not_specific> | def file_based_convert_examples_to_features(examples, label_list,
max_seq_length, tokenizer, output_file):
"""Convert a set of `InputExample`s to a TFRecord file."""
writer = tf.python_io.TFRecordWriter(output_file)
for (ex_index, example) in enumerate(examples)... | Convert a set of `InputExample`s to a TFRecord file. | Convert a set of `InputExample`s to a TFRecord file. | [
"Convert",
"a",
"set",
"of",
"`",
"InputExample",
"`",
"s",
"to",
"a",
"TFRecord",
"file",
"."
] | def file_based_convert_examples_to_features(examples, label_list,
max_seq_length, tokenizer, output_file):
writer = tf.python_io.TFRecordWriter(output_file)
for (ex_index, example) in enumerate(examples):
if ex_index % 10000 == 0:
tf.logging.info("... | [
"def",
"file_based_convert_examples_to_features",
"(",
"examples",
",",
"label_list",
",",
"max_seq_length",
",",
"tokenizer",
",",
"output_file",
")",
":",
"writer",
"=",
"tf",
".",
"python_io",
".",
"TFRecordWriter",
"(",
"output_file",
")",
"for",
"(",
"ex_inde... | Convert a set of `InputExample`s to a TFRecord file. | [
"Convert",
"a",
"set",
"of",
"`",
"InputExample",
"`",
"s",
"to",
"a",
"TFRecord",
"file",
"."
] | [
"\"\"\"Convert a set of `InputExample`s to a TFRecord file.\"\"\"",
"# features[\"lengths\"] = create_int_feature([feature.length])"
] | [
{
"param": "examples",
"type": null
},
{
"param": "label_list",
"type": null
},
{
"param": "max_seq_length",
"type": null
},
{
"param": "tokenizer",
"type": null
},
{
"param": "output_file",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "examples",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "label_list",
"type": null,
"docstring": null,
"docstring_... |
adb027aece46ac3c34e8a715e4f13da6f7d4307c | J535D165/cbsodata | cbsodata/cbsodata3.py | [
"MIT"
] | Python | _get_table_url | <not_specific> | def _get_table_url(table_id, catalog_url=None):
"""Create a table url for the given table identifier."""
if catalog_url is None:
_catalog_url = options.catalog_url
else:
_catalog_url = catalog_url
components = {"http": "https://" if options.use_https else "http://",
"... | Create a table url for the given table identifier. | Create a table url for the given table identifier. | [
"Create",
"a",
"table",
"url",
"for",
"the",
"given",
"table",
"identifier",
"."
] | def _get_table_url(table_id, catalog_url=None):
if catalog_url is None:
_catalog_url = options.catalog_url
else:
_catalog_url = catalog_url
components = {"http": "https://" if options.use_https else "http://",
"baseurl": _catalog_url,
"bulk": BULK,
... | [
"def",
"_get_table_url",
"(",
"table_id",
",",
"catalog_url",
"=",
"None",
")",
":",
"if",
"catalog_url",
"is",
"None",
":",
"_catalog_url",
"=",
"options",
".",
"catalog_url",
"else",
":",
"_catalog_url",
"=",
"catalog_url",
"components",
"=",
"{",
"\"http\""... | Create a table url for the given table identifier. | [
"Create",
"a",
"table",
"url",
"for",
"the",
"given",
"table",
"identifier",
"."
] | [
"\"\"\"Create a table url for the given table identifier.\"\"\"",
"# http://opendata.cbs.nl/ODataApi/OData/37506wwm"
] | [
{
"param": "table_id",
"type": null
},
{
"param": "catalog_url",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "table_id",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "catalog_url",
"type": null,
"docstring": null,
"docstring... |
7f461ce861422ef48fe766057e08929f9bef64f7 | mlissner/django-ses | django_ses/utils.py | [
"MIT"
] | Python | clear_cert_cache | null | def clear_cert_cache():
"""Clear the certificate cache.
This one-liner exists to discourage imports and direct usage of
_CERT_CACHE.
:returns None
"""
_CERT_CACHE.clear() | Clear the certificate cache.
This one-liner exists to discourage imports and direct usage of
_CERT_CACHE.
:returns None
| Clear the certificate cache.
This one-liner exists to discourage imports and direct usage of
_CERT_CACHE.
:returns None | [
"Clear",
"the",
"certificate",
"cache",
".",
"This",
"one",
"-",
"liner",
"exists",
"to",
"discourage",
"imports",
"and",
"direct",
"usage",
"of",
"_CERT_CACHE",
".",
":",
"returns",
"None"
] | def clear_cert_cache():
_CERT_CACHE.clear() | [
"def",
"clear_cert_cache",
"(",
")",
":",
"_CERT_CACHE",
".",
"clear",
"(",
")"
] | Clear the certificate cache. | [
"Clear",
"the",
"certificate",
"cache",
"."
] | [
"\"\"\"Clear the certificate cache.\n\n This one-liner exists to discourage imports and direct usage of\n _CERT_CACHE.\n\n :returns None\n \"\"\""
] | [] | {
"returns": [],
"raises": [],
"params": [],
"outlier_params": [],
"others": []
} |
7f461ce861422ef48fe766057e08929f9bef64f7 | mlissner/django-ses | django_ses/utils.py | [
"MIT"
] | Python | is_verified | <not_specific> | def is_verified(self):
"""
Verifies an SES event message.
Sign the bytes from the notification and compare it to the signature in
the notification. If same, return True; else False.
"""
if self._verified is not None:
return self._verified
signature =... |
Verifies an SES event message.
Sign the bytes from the notification and compare it to the signature in
the notification. If same, return True; else False.
| Verifies an SES event message.
Sign the bytes from the notification and compare it to the signature in
the notification. If same, return True; else False. | [
"Verifies",
"an",
"SES",
"event",
"message",
".",
"Sign",
"the",
"bytes",
"from",
"the",
"notification",
"and",
"compare",
"it",
"to",
"the",
"signature",
"in",
"the",
"notification",
".",
"If",
"same",
"return",
"True",
";",
"else",
"False",
"."
] | def is_verified(self):
if self._verified is not None:
return self._verified
signature = self._data.get("Signature")
if not signature:
self._verified = False
return self._verified
signature = bytes(base64.b64decode(signature))
sign_bytes = self.... | [
"def",
"is_verified",
"(",
"self",
")",
":",
"if",
"self",
".",
"_verified",
"is",
"not",
"None",
":",
"return",
"self",
".",
"_verified",
"signature",
"=",
"self",
".",
"_data",
".",
"get",
"(",
"\"Signature\"",
")",
"if",
"not",
"signature",
":",
"se... | Verifies an SES event message. | [
"Verifies",
"an",
"SES",
"event",
"message",
"."
] | [
"\"\"\"\n Verifies an SES event message.\n\n Sign the bytes from the notification and compare it to the signature in\n the notification. If same, return True; else False.\n \"\"\"",
"# Decode the signature from base64",
"# Get the message to sign",
"# Extract the public key",
"# ... | [
{
"param": "self",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
7f461ce861422ef48fe766057e08929f9bef64f7 | mlissner/django-ses | django_ses/utils.py | [
"MIT"
] | Python | certificate | <not_specific> | def certificate(self):
"""
Retrieves the certificate used to sign the event message.
:returns: None if the cert cannot be retrieved. Else, gets the cert
caches it, and returns it, or simply returns it if already cached.
"""
cert_url = self._get_cert_url()
if not ... |
Retrieves the certificate used to sign the event message.
:returns: None if the cert cannot be retrieved. Else, gets the cert
caches it, and returns it, or simply returns it if already cached.
| Retrieves the certificate used to sign the event message. | [
"Retrieves",
"the",
"certificate",
"used",
"to",
"sign",
"the",
"event",
"message",
"."
] | def certificate(self):
cert_url = self._get_cert_url()
if not cert_url:
return None
if cert_url in _CERT_CACHE:
return _CERT_CACHE[cert_url]
try:
import requests
from requests import RequestException
except ImportError:
... | [
"def",
"certificate",
"(",
"self",
")",
":",
"cert_url",
"=",
"self",
".",
"_get_cert_url",
"(",
")",
"if",
"not",
"cert_url",
":",
"return",
"None",
"if",
"cert_url",
"in",
"_CERT_CACHE",
":",
"return",
"_CERT_CACHE",
"[",
"cert_url",
"]",
"try",
":",
"... | Retrieves the certificate used to sign the event message. | [
"Retrieves",
"the",
"certificate",
"used",
"to",
"sign",
"the",
"event",
"message",
"."
] | [
"\"\"\"\n Retrieves the certificate used to sign the event message.\n\n :returns: None if the cert cannot be retrieved. Else, gets the cert\n caches it, and returns it, or simply returns it if already cached.\n \"\"\"",
"# Only load certificates from a certain domain?",
"# Without so... | [
{
"param": "self",
"type": null
}
] | {
"returns": [
{
"docstring": "None if the cert cannot be retrieved. Else, gets the cert\ncaches it, and returns it, or simply returns it if already cached.",
"docstring_tokens": [
"None",
"if",
"the",
"cert",
"cannot",
"be",
"retrieved",
... |
7f461ce861422ef48fe766057e08929f9bef64f7 | mlissner/django-ses | django_ses/utils.py | [
"MIT"
] | Python | _get_cert_url | <not_specific> | def _get_cert_url(self):
"""
Get the signing certificate URL.
Only accept urls that match the domains set in the
AWS_SNS_EVENT_CERT_TRUSTED_DOMAINS setting. Sub-domains
are allowed. i.e. if amazonaws.com is in the trusted domains
then sns.us-east-1.amazonaws.com will matc... |
Get the signing certificate URL.
Only accept urls that match the domains set in the
AWS_SNS_EVENT_CERT_TRUSTED_DOMAINS setting. Sub-domains
are allowed. i.e. if amazonaws.com is in the trusted domains
then sns.us-east-1.amazonaws.com will match.
| Get the signing certificate URL.
Only accept urls that match the domains set in the
AWS_SNS_EVENT_CERT_TRUSTED_DOMAINS setting. Sub-domains
are allowed. | [
"Get",
"the",
"signing",
"certificate",
"URL",
".",
"Only",
"accept",
"urls",
"that",
"match",
"the",
"domains",
"set",
"in",
"the",
"AWS_SNS_EVENT_CERT_TRUSTED_DOMAINS",
"setting",
".",
"Sub",
"-",
"domains",
"are",
"allowed",
"."
] | def _get_cert_url(self):
cert_url = self._data.get("SigningCertURL")
if not cert_url:
logger.warning('No signing certificate URL: "%s"', cert_url)
return None
if not cert_url.startswith("https://"):
logger.warning('Untrusted certificate URL: "%s"', cert_url)
... | [
"def",
"_get_cert_url",
"(",
"self",
")",
":",
"cert_url",
"=",
"self",
".",
"_data",
".",
"get",
"(",
"\"SigningCertURL\"",
")",
"if",
"not",
"cert_url",
":",
"logger",
".",
"warning",
"(",
"'No signing certificate URL: \"%s\"'",
",",
"cert_url",
")",
"return... | Get the signing certificate URL. | [
"Get",
"the",
"signing",
"certificate",
"URL",
"."
] | [
"\"\"\"\n Get the signing certificate URL.\n Only accept urls that match the domains set in the\n AWS_SNS_EVENT_CERT_TRUSTED_DOMAINS setting. Sub-domains\n are allowed. i.e. if amazonaws.com is in the trusted domains\n then sns.us-east-1.amazonaws.com will match.\n \"\"\""
... | [
{
"param": "self",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
7f461ce861422ef48fe766057e08929f9bef64f7 | mlissner/django-ses | django_ses/utils.py | [
"MIT"
] | Python | _get_bytes_to_sign | <not_specific> | def _get_bytes_to_sign(self):
"""
Creates the message used for signing SNS notifications.
This is used to verify the bounce message when it is received.
"""
# Depending on the message type the fields to add to the message
# differ so we handle that here.
msg_type... |
Creates the message used for signing SNS notifications.
This is used to verify the bounce message when it is received.
| Creates the message used for signing SNS notifications.
This is used to verify the bounce message when it is received. | [
"Creates",
"the",
"message",
"used",
"for",
"signing",
"SNS",
"notifications",
".",
"This",
"is",
"used",
"to",
"verify",
"the",
"bounce",
"message",
"when",
"it",
"is",
"received",
"."
] | def _get_bytes_to_sign(self):
msg_type = self._data.get('Type')
if msg_type == 'Notification':
fields_to_sign = [
'Message',
'MessageId',
'Subject',
'Timestamp',
'TopicArn',
'Type',
]
... | [
"def",
"_get_bytes_to_sign",
"(",
"self",
")",
":",
"msg_type",
"=",
"self",
".",
"_data",
".",
"get",
"(",
"'Type'",
")",
"if",
"msg_type",
"==",
"'Notification'",
":",
"fields_to_sign",
"=",
"[",
"'Message'",
",",
"'MessageId'",
",",
"'Subject'",
",",
"'... | Creates the message used for signing SNS notifications. | [
"Creates",
"the",
"message",
"used",
"for",
"signing",
"SNS",
"notifications",
"."
] | [
"\"\"\"\n Creates the message used for signing SNS notifications.\n This is used to verify the bounce message when it is received.\n \"\"\"",
"# Depending on the message type the fields to add to the message",
"# differ so we handle that here.",
"# Unrecognized type",
"# Some notificati... | [
{
"param": "self",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
7f461ce861422ef48fe766057e08929f9bef64f7 | mlissner/django-ses | django_ses/utils.py | [
"MIT"
] | Python | verify_event_message | <not_specific> | def verify_event_message(notification):
"""
Verify an SES/SNS event notification message.
"""
verifier = EventMessageVerifier(notification)
return verifier.is_verified() |
Verify an SES/SNS event notification message.
| Verify an SES/SNS event notification message. | [
"Verify",
"an",
"SES",
"/",
"SNS",
"event",
"notification",
"message",
"."
] | def verify_event_message(notification):
verifier = EventMessageVerifier(notification)
return verifier.is_verified() | [
"def",
"verify_event_message",
"(",
"notification",
")",
":",
"verifier",
"=",
"EventMessageVerifier",
"(",
"notification",
")",
"return",
"verifier",
".",
"is_verified",
"(",
")"
] | Verify an SES/SNS event notification message. | [
"Verify",
"an",
"SES",
"/",
"SNS",
"event",
"notification",
"message",
"."
] | [
"\"\"\"\n Verify an SES/SNS event notification message.\n \"\"\""
] | [
{
"param": "notification",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "notification",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
7f461ce861422ef48fe766057e08929f9bef64f7 | mlissner/django-ses | django_ses/utils.py | [
"MIT"
] | Python | verify_bounce_message | <not_specific> | def verify_bounce_message(msg):
"""
Verify an SES/SNS bounce(event) notification message.
"""
warnings.warn(
'utils.verify_bounce_message is deprecated. It is renamed to verify_event_message.',
RemovedInDjangoSES20Warning,
)
return verify_event_message(msg) |
Verify an SES/SNS bounce(event) notification message.
| Verify an SES/SNS bounce(event) notification message. | [
"Verify",
"an",
"SES",
"/",
"SNS",
"bounce",
"(",
"event",
")",
"notification",
"message",
"."
] | def verify_bounce_message(msg):
warnings.warn(
'utils.verify_bounce_message is deprecated. It is renamed to verify_event_message.',
RemovedInDjangoSES20Warning,
)
return verify_event_message(msg) | [
"def",
"verify_bounce_message",
"(",
"msg",
")",
":",
"warnings",
".",
"warn",
"(",
"'utils.verify_bounce_message is deprecated. It is renamed to verify_event_message.'",
",",
"RemovedInDjangoSES20Warning",
",",
")",
"return",
"verify_event_message",
"(",
"msg",
")"
] | Verify an SES/SNS bounce(event) notification message. | [
"Verify",
"an",
"SES",
"/",
"SNS",
"bounce",
"(",
"event",
")",
"notification",
"message",
"."
] | [
"\"\"\"\n Verify an SES/SNS bounce(event) notification message.\n \"\"\""
] | [
{
"param": "msg",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "msg",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
44ff9c8775237074bd64f165da5fda7d6484a872 | adobe-research/beacon-aug | beacon_aug/external/textflow/effects.py | [
"MIT"
] | Python | sample_normal | <not_specific> | def sample_normal(self, color_mean, color_std):
"""
sample RGB color from a normal distribution
:param color_mean: mean of the normal distribution
:param color_std: stander deviation of the normal distribution
:return: RGB color vector
"""
color_sample = color_mea... |
sample RGB color from a normal distribution
:param color_mean: mean of the normal distribution
:param color_std: stander deviation of the normal distribution
:return: RGB color vector
| sample RGB color from a normal distribution | [
"sample",
"RGB",
"color",
"from",
"a",
"normal",
"distribution"
] | def sample_normal(self, color_mean, color_std):
color_sample = color_mean + color_std * np.random.randn()
return np.clip(color_sample, 0, 255).astype(np.uint8) | [
"def",
"sample_normal",
"(",
"self",
",",
"color_mean",
",",
"color_std",
")",
":",
"color_sample",
"=",
"color_mean",
"+",
"color_std",
"*",
"np",
".",
"random",
".",
"randn",
"(",
")",
"return",
"np",
".",
"clip",
"(",
"color_sample",
",",
"0",
",",
... | sample RGB color from a normal distribution | [
"sample",
"RGB",
"color",
"from",
"a",
"normal",
"distribution"
] | [
"\"\"\"\n sample RGB color from a normal distribution\n :param color_mean: mean of the normal distribution\n :param color_std: stander deviation of the normal distribution\n :return: RGB color vector\n \"\"\""
] | [
{
"param": "self",
"type": null
},
{
"param": "color_mean",
"type": null
},
{
"param": "color_std",
"type": null
}
] | {
"returns": [
{
"docstring": "RGB color vector",
"docstring_tokens": [
"RGB",
"color",
"vector"
],
"type": null
}
],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
... |
44ff9c8775237074bd64f165da5fda7d6484a872 | adobe-research/beacon-aug | beacon_aug/external/textflow/effects.py | [
"MIT"
] | Python | sample_from_data | <not_specific> | def sample_from_data(self, bg_arr, rand=True):
"""
sample RGB color from the background image
:param bg_arr: a RGB image
:param rand: whether sample randomly around the mean color
:returns: foreground RGB, background RGB
"""
""" get background color mean """
... |
sample RGB color from the background image
:param bg_arr: a RGB image
:param rand: whether sample randomly around the mean color
:returns: foreground RGB, background RGB
| sample RGB color from the background image | [
"sample",
"RGB",
"color",
"from",
"the",
"background",
"image"
] | def sample_from_data(self, bg_arr, rand=True):
bg_arr = cv2.cvtColor(bg_arr, cv2.COLOR_RGB2LAB)
bg_arr = np.reshape(bg_arr, (np.prod(bg_arr.shape[:2]), 3))
bg_mean = np.mean(bg_arr, axis=0)
norms = np.linalg.norm(self.colorsLAB - bg_mean[None, :], axis=1)
nn = np.argmin(norms)
... | [
"def",
"sample_from_data",
"(",
"self",
",",
"bg_arr",
",",
"rand",
"=",
"True",
")",
":",
"\"\"\" get background color mean \"\"\"",
"bg_arr",
"=",
"cv2",
".",
"cvtColor",
"(",
"bg_arr",
",",
"cv2",
".",
"COLOR_RGB2LAB",
")",
"bg_arr",
"=",
"np",
".",
"resh... | sample RGB color from the background image | [
"sample",
"RGB",
"color",
"from",
"the",
"background",
"image"
] | [
"\"\"\"\n sample RGB color from the background image\n :param bg_arr: a RGB image\n :param rand: whether sample randomly around the mean color\n :returns: foreground RGB, background RGB\n \"\"\"",
"\"\"\" get background color mean \"\"\"",
"\"\"\" get nearest color in the colo... | [
{
"param": "self",
"type": null
},
{
"param": "bg_arr",
"type": null
},
{
"param": "rand",
"type": null
}
] | {
"returns": [
{
"docstring": "foreground RGB, background RGB",
"docstring_tokens": [
"foreground",
"RGB",
"background",
"RGB"
],
"type": null
}
],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": n... |
44ff9c8775237074bd64f165da5fda7d6484a872 | adobe-research/beacon-aug | beacon_aug/external/textflow/effects.py | [
"MIT"
] | Python | complement | <not_specific> | def complement(self, rgb_color):
"""
return a color which is complementary to the RGB_COLOR.
"""
col_hsv = np.squeeze(cv2.cvtColor(rgb_color[None, None, :], cv2.COLOR_RGB2HSV))
col_hsv[0] = col_hsv[0] + 128 # uint8 mods to 255
col_comp = np.squeeze(cv2.cvtColor(col_hsv[N... |
return a color which is complementary to the RGB_COLOR.
| return a color which is complementary to the RGB_COLOR. | [
"return",
"a",
"color",
"which",
"is",
"complementary",
"to",
"the",
"RGB_COLOR",
"."
] | def complement(self, rgb_color):
col_hsv = np.squeeze(cv2.cvtColor(rgb_color[None, None, :], cv2.COLOR_RGB2HSV))
col_hsv[0] = col_hsv[0] + 128
col_comp = np.squeeze(cv2.cvtColor(col_hsv[None, None, :], cv2.COLOR_HSV2RGB))
return col_comp | [
"def",
"complement",
"(",
"self",
",",
"rgb_color",
")",
":",
"col_hsv",
"=",
"np",
".",
"squeeze",
"(",
"cv2",
".",
"cvtColor",
"(",
"rgb_color",
"[",
"None",
",",
"None",
",",
":",
"]",
",",
"cv2",
".",
"COLOR_RGB2HSV",
")",
")",
"col_hsv",
"[",
... | return a color which is complementary to the RGB_COLOR. | [
"return",
"a",
"color",
"which",
"is",
"complementary",
"to",
"the",
"RGB_COLOR",
"."
] | [
"\"\"\"\n return a color which is complementary to the RGB_COLOR.\n \"\"\"",
"# uint8 mods to 255"
] | [
{
"param": "self",
"type": null
},
{
"param": "rgb_color",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "rgb_color",
"type": null,
"docstring": null,
"docstring_token... |
44ff9c8775237074bd64f165da5fda7d6484a872 | adobe-research/beacon-aug | beacon_aug/external/textflow/effects.py | [
"MIT"
] | Python | triangle_color | <not_specific> | def triangle_color(self, col1, col2):
"""
Returns a color which is "opposite" to both col1 and col2.
"""
col1, col2 = np.array(col1), np.array(col2)
col1 = np.squeeze(cv2.cvtColor(col1[None, None, :], cv2.COLOR_RGB2HSV))
col2 = np.squeeze(cv2.cvtColor(col2[None, None, :],... |
Returns a color which is "opposite" to both col1 and col2.
| Returns a color which is "opposite" to both col1 and col2. | [
"Returns",
"a",
"color",
"which",
"is",
"\"",
"opposite",
"\"",
"to",
"both",
"col1",
"and",
"col2",
"."
] | def triangle_color(self, col1, col2):
col1, col2 = np.array(col1), np.array(col2)
col1 = np.squeeze(cv2.cvtColor(col1[None, None, :], cv2.COLOR_RGB2HSV))
col2 = np.squeeze(cv2.cvtColor(col2[None, None, :], cv2.COLOR_RGB2HSV))
h1, h2 = col1[0], col2[0]
if h2 < h1:
h1, ... | [
"def",
"triangle_color",
"(",
"self",
",",
"col1",
",",
"col2",
")",
":",
"col1",
",",
"col2",
"=",
"np",
".",
"array",
"(",
"col1",
")",
",",
"np",
".",
"array",
"(",
"col2",
")",
"col1",
"=",
"np",
".",
"squeeze",
"(",
"cv2",
".",
"cvtColor",
... | Returns a color which is "opposite" to both col1 and col2. | [
"Returns",
"a",
"color",
"which",
"is",
"\"",
"opposite",
"\"",
"to",
"both",
"col1",
"and",
"col2",
"."
] | [
"\"\"\"\n Returns a color which is \"opposite\" to both col1 and col2.\n \"\"\"",
"# swap"
] | [
{
"param": "self",
"type": null
},
{
"param": "col1",
"type": null
},
{
"param": "col2",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "col1",
"type": null,
"docstring": null,
"docstring_tokens": [... |
44ff9c8775237074bd64f165da5fda7d6484a872 | adobe-research/beacon-aug | beacon_aug/external/textflow/effects.py | [
"MIT"
] | Python | _stack_layers | <not_specific> | def _stack_layers(self, text_arr, bg_arr, min_char_h, layer_type_params=None, is_mix_bg=False):
"""
stack effect layer to synthesize image with text
:param text_arr: 2D maks, {0, 255}
:param bg_arr: RGB image
:param min_char_h: the minimum character height in pixel
:param... |
stack effect layer to synthesize image with text
:param text_arr: 2D maks, {0, 255}
:param bg_arr: RGB image
:param min_char_h: the minimum character height in pixel
:param layer_type_params: dict
'text' : [feather (True/False), text color (RGB/None/'rand'), opa... | stack effect layer to synthesize image with text | [
"stack",
"effect",
"layer",
"to",
"synthesize",
"image",
"with",
"text"
] | def _stack_layers(self, text_arr, bg_arr, min_char_h, layer_type_params=None, is_mix_bg=False):
if layer_type_params is None:
layer_type_params = dict()
if TextEffects._layer_order[0] in layer_type_params:
layers = [self.layer_type_dict[TextEffects._layer_order[0]](
... | [
"def",
"_stack_layers",
"(",
"self",
",",
"text_arr",
",",
"bg_arr",
",",
"min_char_h",
",",
"layer_type_params",
"=",
"None",
",",
"is_mix_bg",
"=",
"False",
")",
":",
"if",
"layer_type_params",
"is",
"None",
":",
"layer_type_params",
"=",
"dict",
"(",
")",... | stack effect layer to synthesize image with text | [
"stack",
"effect",
"layer",
"to",
"synthesize",
"image",
"with",
"text"
] | [
"\"\"\"\n stack effect layer to synthesize image with text\n :param text_arr: 2D maks, {0, 255}\n :param bg_arr: RGB image\n :param min_char_h: the minimum character height in pixel\n :param layer_type_params: dict\n 'text' : [feather (True/False), text color (RGB/... | [
{
"param": "self",
"type": null
},
{
"param": "text_arr",
"type": null
},
{
"param": "bg_arr",
"type": null
},
{
"param": "min_char_h",
"type": null
},
{
"param": "layer_type_params",
"type": null
},
{
"param": "is_mix_bg",
"type": null
}
] | {
"returns": [
{
"docstring": "RGB image with text",
"docstring_tokens": [
"RGB",
"image",
"with",
"text"
],
"type": null
}
],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring... |
44ff9c8775237074bd64f165da5fda7d6484a872 | adobe-research/beacon-aug | beacon_aug/external/textflow/effects.py | [
"MIT"
] | Python | color_text | <not_specific> | def color_text(self, text_arr, bg_arr, rand=True, color=None):
"""
Decide on a color for the text:
- could be some other random image.
- could be a color based on the background.
this color is sampled from a dictionary built
from text-word images' ... |
Decide on a color for the text:
- could be some other random image.
- could be a color based on the background.
this color is sampled from a dictionary built
from text-word images' colors. The VALUE channel
is randomized.
| Decide on a color for the text:
could be some other random image.
could be a color based on the background.
this color is sampled from a dictionary built
from text-word images' colors. The VALUE channel
is randomized. | [
"Decide",
"on",
"a",
"color",
"for",
"the",
"text",
":",
"could",
"be",
"some",
"other",
"random",
"image",
".",
"could",
"be",
"a",
"color",
"based",
"on",
"the",
"background",
".",
"this",
"color",
"is",
"sampled",
"from",
"a",
"dictionary",
"built",
... | def color_text(self, text_arr, bg_arr, rand=True, color=None):
if color is not None:
fg_col = color
else:
fg_col, bg_col = self.font_color.sample_from_data(bg_arr, rand=rand)
bg_mean = np.median(bg_arr, axis=0)
thres = 1800
if np.linalg.norm(fg... | [
"def",
"color_text",
"(",
"self",
",",
"text_arr",
",",
"bg_arr",
",",
"rand",
"=",
"True",
",",
"color",
"=",
"None",
")",
":",
"if",
"color",
"is",
"not",
"None",
":",
"fg_col",
"=",
"color",
"else",
":",
"fg_col",
",",
"bg_col",
"=",
"self",
"."... | Decide on a color for the text:
could be some other random image. | [
"Decide",
"on",
"a",
"color",
"for",
"the",
"text",
":",
"could",
"be",
"some",
"other",
"random",
"image",
"."
] | [
"\"\"\"\n Decide on a color for the text:\n - could be some other random image.\n - could be a color based on the background.\n this color is sampled from a dictionary built\n from text-word images' colors. The VALUE channel\n is randomized.\... | [
{
"param": "self",
"type": null
},
{
"param": "text_arr",
"type": null
},
{
"param": "bg_arr",
"type": null
},
{
"param": "rand",
"type": null
},
{
"param": "color",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "text_arr",
"type": null,
"docstring": null,
"docstring_tokens... |
75c675506c04875366cb3fd7d9983913cac3913e | adobe-research/beacon-aug | beacon_aug/generator/__init__.py | [
"MIT"
] | Python | load_config | <not_specific> | def load_config(op_name, standard_fnames="./standard/*.yaml"):
'''
Extact and load the config for the current operator
@input:
standard_fnames: .json or .yaml file
'''
config = None
config_custom = None
# load config from custom python file
for custom_op_name in custom.__all__:
... |
Extact and load the config for the current operator
@input:
standard_fnames: .json or .yaml file
| Extact and load the config for the current operator | [
"Extact",
"and",
"load",
"the",
"config",
"for",
"the",
"current",
"operator"
] | def load_config(op_name, standard_fnames="./standard/*.yaml"):
config = None
config_custom = None
for custom_op_name in custom.__all__:
if op_name == custom_op_name:
module = importlib.import_module("custom." + op_name)
custom_op_function = getattr(module, op_name)
... | [
"def",
"load_config",
"(",
"op_name",
",",
"standard_fnames",
"=",
"\"./standard/*.yaml\"",
")",
":",
"config",
"=",
"None",
"config_custom",
"=",
"None",
"for",
"custom_op_name",
"in",
"custom",
".",
"__all__",
":",
"if",
"op_name",
"==",
"custom_op_name",
":",... | Extact and load the config for the current operator | [
"Extact",
"and",
"load",
"the",
"config",
"for",
"the",
"current",
"operator"
] | [
"'''\n Extact and load the config for the current operator\n @input:\n standard_fnames: .json or .yaml file\n '''",
"# load config from custom python file",
"# get local fname withoutextension",
"# custom_submodule = os.path.splitext(os.path.basename(py_fname))[0]",
"# dynamic import module"... | [
{
"param": "op_name",
"type": null
},
{
"param": "standard_fnames",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "op_name",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "standard_fnames",
"type": null,
"docstring": null,
"docstr... |
75c675506c04875366cb3fd7d9983913cac3913e | adobe-research/beacon-aug | beacon_aug/generator/__init__.py | [
"MIT"
] | Python | load_avail_libraries | <not_specific> | def load_avail_libraries(op_name):
''' Return the list of all supportive library in this operator '''
operator_paras = load_config(op_name)
r = [l for l in DEFAULT_LIBRARIES if l in operator_paras] # only available ones
return r | Return the list of all supportive library in this operator | Return the list of all supportive library in this operator | [
"Return",
"the",
"list",
"of",
"all",
"supportive",
"library",
"in",
"this",
"operator"
] | def load_avail_libraries(op_name):
operator_paras = load_config(op_name)
r = [l for l in DEFAULT_LIBRARIES if l in operator_paras]
return r | [
"def",
"load_avail_libraries",
"(",
"op_name",
")",
":",
"operator_paras",
"=",
"load_config",
"(",
"op_name",
")",
"r",
"=",
"[",
"l",
"for",
"l",
"in",
"DEFAULT_LIBRARIES",
"if",
"l",
"in",
"operator_paras",
"]",
"return",
"r"
] | Return the list of all supportive library in this operator | [
"Return",
"the",
"list",
"of",
"all",
"supportive",
"library",
"in",
"this",
"operator"
] | [
"''' Return the list of all supportive library in this operator '''",
"# only available ones"
] | [
{
"param": "op_name",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "op_name",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
6fb3dd093f15394d7169feb6b2f7f1369ab8f8b5 | adobe-research/beacon-aug | beacon_aug/advanced/benign_transforms.py | [
"MIT"
] | Python | Benign | <not_specific> | def Benign(in_place=True, out_place=True, compress=True,
severity=[1, 5], p=1, in_place_n=1, *args, **kwargs):
""" Apply run random number of operators according to hint
Parameters
----------
if in_place = True:
in_place_n (int,[int,int]): number (or range) of operators to select in ... | Apply run random number of operators according to hint
Parameters
----------
if in_place = True:
in_place_n (int,[int,int]): number (or range) of operators to select in "imagenet_c" (not change pixel location)
default: 1
severity(int,[int,int]): severity... | Apply run random number of operators according to hint
Parameters
This set of distortions is a slightly simplified (and harder) set of transformations taken from this paper:
[1] Black, Alexander, et al. "Deep Image Comparator: Learning To Visualize Editorial
Change." Proceedings of the IEEE/CVF Conference on CVPR Wo... | [
"Apply",
"run",
"random",
"number",
"of",
"operators",
"according",
"to",
"hint",
"Parameters",
"This",
"set",
"of",
"distortions",
"is",
"a",
"slightly",
"simplified",
"(",
"and",
"harder",
")",
"set",
"of",
"transformations",
"taken",
"from",
"this",
"paper"... | def Benign(in_place=True, out_place=True, compress=True,
severity=[1, 5], p=1, in_place_n=1, *args, **kwargs):
in_place_ops = [BA.Resize(height=256, width=256, library="albumentations"),
BA.Collections(tag="imagenet-c", p=p, severity=severity, n=in_place_n)]
out_place_ops = [
... | [
"def",
"Benign",
"(",
"in_place",
"=",
"True",
",",
"out_place",
"=",
"True",
",",
"compress",
"=",
"True",
",",
"severity",
"=",
"[",
"1",
",",
"5",
"]",
",",
"p",
"=",
"1",
",",
"in_place_n",
"=",
"1",
",",
"*",
"args",
",",
"**",
"kwargs",
"... | Apply run random number of operators according to hint
Parameters | [
"Apply",
"run",
"random",
"number",
"of",
"operators",
"according",
"to",
"hint",
"Parameters"
] | [
"\"\"\" Apply run random number of operators according to hint\n\n Parameters\n ----------\n if in_place = True:\n in_place_n (int,[int,int]): number (or range) of operators to select in \"imagenet_c\" (not change pixel location)\n default: 1\n severity(int,... | [
{
"param": "in_place",
"type": null
},
{
"param": "out_place",
"type": null
},
{
"param": "compress",
"type": null
},
{
"param": "severity",
"type": null
},
{
"param": "p",
"type": null
},
{
"param": "in_place_n",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "in_place",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "out_place",
"type": null,
"docstring": null,
"docstring_t... |
2a6976b6317b965ee94fb0e0bcaa81eb40b7a640 | adobe-research/beacon-aug | beacon_aug/generator/docs_generator.py | [
"MIT"
] | Python | replace_alias | <not_specific> | def replace_alias(function, op_dic, lib_name):
"""Find the source function from alias"""
if (' alias' in function.__doc__.lower() or 'alias for' in function.__doc__.lower() or "deprecated in favor of" in function.__doc__):
# (imgaug.PIL)
if 'Alias for :class:'.lower() in function.__doc__.lower... | Find the source function from alias | Find the source function from alias | [
"Find",
"the",
"source",
"function",
"from",
"alias"
] | def replace_alias(function, op_dic, lib_name):
if (' alias' in function.__doc__.lower() or 'alias for' in function.__doc__.lower() or "deprecated in favor of" in function.__doc__):
if 'Alias for :class:'.lower() in function.__doc__.lower():
original_fct_name = op_dic[lib_name]["function"]
... | [
"def",
"replace_alias",
"(",
"function",
",",
"op_dic",
",",
"lib_name",
")",
":",
"if",
"(",
"' alias'",
"in",
"function",
".",
"__doc__",
".",
"lower",
"(",
")",
"or",
"'alias for'",
"in",
"function",
".",
"__doc__",
".",
"lower",
"(",
")",
"or",
"\"... | Find the source function from alias | [
"Find",
"the",
"source",
"function",
"from",
"alias"
] | [
"\"\"\"Find the source function from alias\"\"\"",
"# (imgaug.PIL)",
"# (torchvision)"
] | [
{
"param": "function",
"type": null
},
{
"param": "op_dic",
"type": null
},
{
"param": "lib_name",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "function",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "op_dic",
"type": null,
"docstring": null,
"docstring_toke... |
1ad59fb8f08fc58739f4dd4981780bda190f12d4 | adobe-research/beacon-aug | beacon_aug/generator/operator_generator.py | [
"MIT"
] | Python | random_uniform | <not_specific> | def random_uniform(x):
'''for parsing equation
Support both list/tuple or digit input for library variable parser
return a random number
'''
if type(x) == list or type(x) == tuple:
return np.random.uniform(*x)
else:
return np.random.uniform(x) | for parsing equation
Support both list/tuple or digit input for library variable parser
return a random number
| for parsing equation
Support both list/tuple or digit input for library variable parser
return a random number | [
"for",
"parsing",
"equation",
"Support",
"both",
"list",
"/",
"tuple",
"or",
"digit",
"input",
"for",
"library",
"variable",
"parser",
"return",
"a",
"random",
"number"
] | def random_uniform(x):
if type(x) == list or type(x) == tuple:
return np.random.uniform(*x)
else:
return np.random.uniform(x) | [
"def",
"random_uniform",
"(",
"x",
")",
":",
"if",
"type",
"(",
"x",
")",
"==",
"list",
"or",
"type",
"(",
"x",
")",
"==",
"tuple",
":",
"return",
"np",
".",
"random",
".",
"uniform",
"(",
"*",
"x",
")",
"else",
":",
"return",
"np",
".",
"rando... | for parsing equation
Support both list/tuple or digit input for library variable parser
return a random number | [
"for",
"parsing",
"equation",
"Support",
"both",
"list",
"/",
"tuple",
"or",
"digit",
"input",
"for",
"library",
"variable",
"parser",
"return",
"a",
"random",
"number"
] | [
"'''for parsing equation\n Support both list/tuple or digit input for library variable parser\n return a random number\n\n '''"
] | [
{
"param": "x",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "x",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
1ad59fb8f08fc58739f4dd4981780bda190f12d4 | adobe-research/beacon-aug | beacon_aug/generator/operator_generator.py | [
"MIT"
] | Python | format_check | <not_specific> | def format_check(x):
'''for parsing equation
change list tuple to numpy array, to support + / - result
'''
if type(x) == list or type(x) == tuple:
return np.array(x)
return x | for parsing equation
change list tuple to numpy array, to support + / - result
| for parsing equation
change list tuple to numpy array, to support + / - result | [
"for",
"parsing",
"equation",
"change",
"list",
"tuple",
"to",
"numpy",
"array",
"to",
"support",
"+",
"/",
"-",
"result"
] | def format_check(x):
if type(x) == list or type(x) == tuple:
return np.array(x)
return x | [
"def",
"format_check",
"(",
"x",
")",
":",
"if",
"type",
"(",
"x",
")",
"==",
"list",
"or",
"type",
"(",
"x",
")",
"==",
"tuple",
":",
"return",
"np",
".",
"array",
"(",
"x",
")",
"return",
"x"
] | for parsing equation
change list tuple to numpy array, to support + / - result | [
"for",
"parsing",
"equation",
"change",
"list",
"tuple",
"to",
"numpy",
"array",
"to",
"support",
"+",
"/",
"-",
"result"
] | [
"'''for parsing equation\n change list tuple to numpy array, to support + / - result\n '''"
] | [
{
"param": "x",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "x",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
1ad59fb8f08fc58739f4dd4981780bda190f12d4 | adobe-research/beacon-aug | beacon_aug/generator/operator_generator.py | [
"MIT"
] | Python | random_uniform_parse | <not_specific> | def random_uniform_parse(self, paras):
'''
In case the lambda_function contain "random_uniform", need to run in instance not obj init
'''
if self.random_uniform_parse_equation is not None:
for lib_parname in self.random_uniform_parse_equation:
(lambda_function... |
In case the lambda_function contain "random_uniform", need to run in instance not obj init
| In case the lambda_function contain "random_uniform", need to run in instance not obj init | [
"In",
"case",
"the",
"lambda_function",
"contain",
"\"",
"random_uniform",
"\"",
"need",
"to",
"run",
"in",
"instance",
"not",
"obj",
"init"
] | def random_uniform_parse(self, paras):
if self.random_uniform_parse_equation is not None:
for lib_parname in self.random_uniform_parse_equation:
(lambda_function, val) = self.random_uniform_parse_equation[lib_parname]
paras[lib_parname] = (lambda x: eval(lambda_funct... | [
"def",
"random_uniform_parse",
"(",
"self",
",",
"paras",
")",
":",
"if",
"self",
".",
"random_uniform_parse_equation",
"is",
"not",
"None",
":",
"for",
"lib_parname",
"in",
"self",
".",
"random_uniform_parse_equation",
":",
"(",
"lambda_function",
",",
"val",
"... | In case the lambda_function contain "random_uniform", need to run in instance not obj init | [
"In",
"case",
"the",
"lambda_function",
"contain",
"\"",
"random_uniform",
"\"",
"need",
"to",
"run",
"in",
"instance",
"not",
"obj",
"init"
] | [
"'''\n In case the lambda_function contain \"random_uniform\", need to run in instance not obj init\n '''"
] | [
{
"param": "self",
"type": null
},
{
"param": "paras",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "paras",
"type": null,
"docstring": null,
"docstring_tokens": ... |
35b21fe1d600aea6a60ba4a5e33c0a7cb9a59bfa | adobe-research/beacon-aug | beacon_aug/screenshot.py | [
"MIT"
] | Python | flatten | <not_specific> | def flatten(dict, flatten_ls=[]):
'''use DFS to unfold the operations'''
for operation in dict["transforms"]: # "OneOf" or "OneOrOther", etc
class_name = operation['__class_fullname__']
if "." in class_name:
if operation['__class_fullname__'].split(".")[-2] == "c... | use DFS to unfold the operations | use DFS to unfold the operations | [
"use",
"DFS",
"to",
"unfold",
"the",
"operations"
] | def flatten(dict, flatten_ls=[]):
for operation in dict["transforms"]:
class_name = operation['__class_fullname__']
if "." in class_name:
if operation['__class_fullname__'].split(".")[-2] == "composition":
flatten(operation, flatten_ls)
... | [
"def",
"flatten",
"(",
"dict",
",",
"flatten_ls",
"=",
"[",
"]",
")",
":",
"for",
"operation",
"in",
"dict",
"[",
"\"transforms\"",
"]",
":",
"class_name",
"=",
"operation",
"[",
"'__class_fullname__'",
"]",
"if",
"\".\"",
"in",
"class_name",
":",
"if",
... | use DFS to unfold the operations | [
"use",
"DFS",
"to",
"unfold",
"the",
"operations"
] | [
"'''use DFS to unfold the operations'''",
"# \"OneOf\" or \"OneOrOther\", etc"
] | [
{
"param": "dict",
"type": null
},
{
"param": "flatten_ls",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "dict",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "flatten_ls",
"type": null,
"docstring": null,
"docstring_toke... |
35b21fe1d600aea6a60ba4a5e33c0a7cb9a59bfa | adobe-research/beacon-aug | beacon_aug/screenshot.py | [
"MIT"
] | Python | screenshot_pipeline | <not_specific> | def screenshot_pipeline(augPipeline, image, save_fig_path=None):
''' Visualize an augmentation pipeline by displaying the extreme case for all the parameters
'''
# get the flattened operator sequence avoiding hierarchical structure
single_operation_ls = extract_single_operation(augPipeline)
numOfOp... | Visualize an augmentation pipeline by displaying the extreme case for all the parameters
| Visualize an augmentation pipeline by displaying the extreme case for all the parameters | [
"Visualize",
"an",
"augmentation",
"pipeline",
"by",
"displaying",
"the",
"extreme",
"case",
"for",
"all",
"the",
"parameters"
] | def screenshot_pipeline(augPipeline, image, save_fig_path=None):
single_operation_ls = extract_single_operation(augPipeline)
numOfOperation = len(single_operation_ls)
fig, axs = plt.subplots(numOfOperation, 3,
figsize=(6, 2*numOfOperation),
constrained... | [
"def",
"screenshot_pipeline",
"(",
"augPipeline",
",",
"image",
",",
"save_fig_path",
"=",
"None",
")",
":",
"single_operation_ls",
"=",
"extract_single_operation",
"(",
"augPipeline",
")",
"numOfOperation",
"=",
"len",
"(",
"single_operation_ls",
")",
"fig",
",",
... | Visualize an augmentation pipeline by displaying the extreme case for all the parameters | [
"Visualize",
"an",
"augmentation",
"pipeline",
"by",
"displaying",
"the",
"extreme",
"case",
"for",
"all",
"the",
"parameters"
] | [
"''' Visualize an augmentation pipeline by displaying the extreme case for all the parameters\n '''",
"# get the flattened operator sequence avoiding hierarchical structure",
"# Extract the upper and lower limit",
"# deep copy to avoid pointing save location in dict",
"# Extract all the limit parameters"... | [
{
"param": "augPipeline",
"type": null
},
{
"param": "image",
"type": null
},
{
"param": "save_fig_path",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "augPipeline",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "image",
"type": null,
"docstring": null,
"docstring_to... |
35b21fe1d600aea6a60ba4a5e33c0a7cb9a59bfa | adobe-research/beacon-aug | beacon_aug/screenshot.py | [
"MIT"
] | Python | screenshot_library | <not_specific> | def screenshot_library(BA_operator, image_data, save_fig_path=None, individual_fig=False, **kwargs):
''' Visualize the augmentation result comparision to all available libraries
e.g.
----
import beacon_aug as BA
from beacon_aug import screenshot
fig, __ = BA.screenshot.screenshot_library(BA.... | Visualize the augmentation result comparision to all available libraries
e.g.
----
import beacon_aug as BA
from beacon_aug import screenshot
fig, __ = BA.screenshot.screenshot_library(BA.Brightness(), image_data=image)
fig.show()
| Visualize the augmentation result comparision to all available libraries
e.g.
| [
"Visualize",
"the",
"augmentation",
"result",
"comparision",
"to",
"all",
"available",
"libraries",
"e",
".",
"g",
"."
] | def screenshot_library(BA_operator, image_data, save_fig_path=None, individual_fig=False, **kwargs):
avail_libraries = BA_operator(**kwargs).avail_libraries
numOfLibraries = len(avail_libraries)
fig, axs = plt.subplots(2, 1 + numOfLibraries,
figsize=(4*numOfLibraries, 4),
... | [
"def",
"screenshot_library",
"(",
"BA_operator",
",",
"image_data",
",",
"save_fig_path",
"=",
"None",
",",
"individual_fig",
"=",
"False",
",",
"**",
"kwargs",
")",
":",
"avail_libraries",
"=",
"BA_operator",
"(",
"**",
"kwargs",
")",
".",
"avail_libraries",
... | Visualize the augmentation result comparision to all available libraries
e.g. | [
"Visualize",
"the",
"augmentation",
"result",
"comparision",
"to",
"all",
"available",
"libraries",
"e",
".",
"g",
"."
] | [
"''' Visualize the augmentation result comparision to all available libraries\n e.g.\n ----\n import beacon_aug as BA\n from beacon_aug import screenshot\n fig, __ = BA.screenshot.screenshot_library(BA.Brightness(), image_data=image)\n fig.show()\n '''",
"# or plt.suptitle('Main title')",... | [
{
"param": "BA_operator",
"type": null
},
{
"param": "image_data",
"type": null
},
{
"param": "save_fig_path",
"type": null
},
{
"param": "individual_fig",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "BA_operator",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "image_data",
"type": null,
"docstring": null,
"docstri... |
59369b212d193ab781a5c5ef308ffe01358d957e | adobe-research/beacon-aug | beacon_aug/external/textflow/perturb.py | [
"MIT"
] | Python | _pt_texture | <not_specific> | def _pt_texture(self, img, params):
"""
put texture on text or background
:param img: 2D or 3D array
:param params: [array/str/None, array/str/None]
:return: array
"""
try:
assert isinstance(params, (list, tuple)) and len(params) == 2
if i... |
put texture on text or background
:param img: 2D or 3D array
:param params: [array/str/None, array/str/None]
:return: array
| put texture on text or background | [
"put",
"texture",
"on",
"text",
"or",
"background"
] | def _pt_texture(self, img, params):
try:
assert isinstance(params, (list, tuple)) and len(params) == 2
if img.ndim == 2:
img = np.stack([img] * 3, axis=-1)
if params[0]:
im_fg = imread(params[0], mode='RGB') if isinstance(params[0], str) else... | [
"def",
"_pt_texture",
"(",
"self",
",",
"img",
",",
"params",
")",
":",
"try",
":",
"assert",
"isinstance",
"(",
"params",
",",
"(",
"list",
",",
"tuple",
")",
")",
"and",
"len",
"(",
"params",
")",
"==",
"2",
"if",
"img",
".",
"ndim",
"==",
"2",... | put texture on text or background | [
"put",
"texture",
"on",
"text",
"or",
"background"
] | [
"\"\"\"\n put texture on text or background\n :param img: 2D or 3D array\n :param params: [array/str/None, array/str/None]\n :return: array\n \"\"\"",
"# text texture",
"# background texture",
"# random crop from background image",
"# adjust text color for higher contrast"... | [
{
"param": "self",
"type": null
},
{
"param": "img",
"type": null
},
{
"param": "params",
"type": null
}
] | {
"returns": [
{
"docstring": null,
"docstring_tokens": [
"None"
],
"type": null
}
],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
... |
59369b212d193ab781a5c5ef308ffe01358d957e | adobe-research/beacon-aug | beacon_aug/external/textflow/perturb.py | [
"MIT"
] | Python | _pt_noise | <not_specific> | def _pt_noise(self, img, params):
"""
add noise to text image: Gaussian, uniform, or salt pepper.
:param img: array
:param params: list or tuple, [noise_type, std], value range [0, 1]
:return: array, dtype=uint8
"""
assert isinstance(params, (list, tuple)) and len... |
add noise to text image: Gaussian, uniform, or salt pepper.
:param img: array
:param params: list or tuple, [noise_type, std], value range [0, 1]
:return: array, dtype=uint8
| add noise to text image: Gaussian, uniform, or salt pepper. | [
"add",
"noise",
"to",
"text",
"image",
":",
"Gaussian",
"uniform",
"or",
"salt",
"pepper",
"."
] | def _pt_noise(self, img, params):
assert isinstance(params, (list, tuple)) and len(params) == 2
assert 0 <= params[0] <= 1 and 0 <= params[1] <= 1
def noise_normal(param):
return np.random.normal(scale=param, size=img.shape).astype(np.float32)
def noise_uniform(param):
... | [
"def",
"_pt_noise",
"(",
"self",
",",
"img",
",",
"params",
")",
":",
"assert",
"isinstance",
"(",
"params",
",",
"(",
"list",
",",
"tuple",
")",
")",
"and",
"len",
"(",
"params",
")",
"==",
"2",
"assert",
"0",
"<=",
"params",
"[",
"0",
"]",
"<="... | add noise to text image: Gaussian, uniform, or salt pepper. | [
"add",
"noise",
"to",
"text",
"image",
":",
"Gaussian",
"uniform",
"or",
"salt",
"pepper",
"."
] | [
"\"\"\"\n add noise to text image: Gaussian, uniform, or salt pepper.\n :param img: array\n :param params: list or tuple, [noise_type, std], value range [0, 1]\n :return: array, dtype=uint8\n \"\"\""
] | [
{
"param": "self",
"type": null
},
{
"param": "img",
"type": null
},
{
"param": "params",
"type": null
}
] | {
"returns": [
{
"docstring": null,
"docstring_tokens": [
"None"
],
"type": null
}
],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
... |
ab745465fb86dc3b8254bef4808d5f1f32d651bb | adobe-research/beacon-aug | beacon_aug/external/textflow/synthesis.py | [
"MIT"
] | Python | _set_image | null | def _set_image(self, img):
"""
set the image to place text on
:param img: array or str (file dir)
"""
assert isinstance(img, (np.ndarray, str))
if isinstance(img, np.ndarray):
assert img.ndim == 3 # RGB
self.image = img
elif isinstance(img... |
set the image to place text on
:param img: array or str (file dir)
| set the image to place text on | [
"set",
"the",
"image",
"to",
"place",
"text",
"on"
] | def _set_image(self, img):
assert isinstance(img, (np.ndarray, str))
if isinstance(img, np.ndarray):
assert img.ndim == 3
self.image = img
elif isinstance(img, str):
self.image = cv2.imread(img, cv2.IMREAD_COLOR)
if self.image is None:
... | [
"def",
"_set_image",
"(",
"self",
",",
"img",
")",
":",
"assert",
"isinstance",
"(",
"img",
",",
"(",
"np",
".",
"ndarray",
",",
"str",
")",
")",
"if",
"isinstance",
"(",
"img",
",",
"np",
".",
"ndarray",
")",
":",
"assert",
"img",
".",
"ndim",
"... | set the image to place text on | [
"set",
"the",
"image",
"to",
"place",
"text",
"on"
] | [
"\"\"\"\n set the image to place text on\n :param img: array or str (file dir)\n \"\"\"",
"# RGB"
] | [
{
"param": "self",
"type": null
},
{
"param": "img",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "img",
"type": null,
"docstring": "array or str (file dir)",
"... |
ab745465fb86dc3b8254bef4808d5f1f32d651bb | adobe-research/beacon-aug | beacon_aug/external/textflow/synthesis.py | [
"MIT"
] | Python | _get_text_regions | <not_specific> | def _get_text_regions(self, num_regions=5, is_top_left_origin=True, ensure_num_regions=False, check_collision=True):
"""
get smooth quadrilateral regions for placing text
:param n_regions: int, number of regions required, 1 to 10
:param is_top_left_origin: whether keep the first point in... |
get smooth quadrilateral regions for placing text
:param n_regions: int, number of regions required, 1 to 10
:param is_top_left_origin: whether keep the first point in a region vector as the top-left corner
:param ensure_num_regions: sometimes, there are not enough suitable regions for ... | get smooth quadrilateral regions for placing text | [
"get",
"smooth",
"quadrilateral",
"regions",
"for",
"placing",
"text"
] | def _get_text_regions(self, num_regions=5, is_top_left_origin=True, ensure_num_regions=False, check_collision=True):
def top_left_origin(pts):
dist, pts_new_order = [], []
n_pts = len(pts)
for pt in pts:
dist.append(np.linalg.norm(pt))
idx_top_left... | [
"def",
"_get_text_regions",
"(",
"self",
",",
"num_regions",
"=",
"5",
",",
"is_top_left_origin",
"=",
"True",
",",
"ensure_num_regions",
"=",
"False",
",",
"check_collision",
"=",
"True",
")",
":",
"def",
"top_left_origin",
"(",
"pts",
")",
":",
"dist",
","... | get smooth quadrilateral regions for placing text | [
"get",
"smooth",
"quadrilateral",
"regions",
"for",
"placing",
"text"
] | [
"\"\"\"\n get smooth quadrilateral regions for placing text\n :param n_regions: int, number of regions required, 1 to 10\n :param is_top_left_origin: whether keep the first point in a region vector as the top-left corner\n :param ensure_num_regions: sometimes, there are not enough suitab... | [
{
"param": "self",
"type": null
},
{
"param": "num_regions",
"type": null
},
{
"param": "is_top_left_origin",
"type": null
},
{
"param": "ensure_num_regions",
"type": null
},
{
"param": "check_collision",
"type": null
}
] | {
"returns": [
{
"docstring": "list, [4x2 array, ...], each item denotes four corners of a quadrilateral region",
"docstring_tokens": [
"list",
"[",
"4x2",
"array",
"...",
"]",
"each",
"item",
"denotes",
"four",
"c... |
ab745465fb86dc3b8254bef4808d5f1f32d651bb | adobe-research/beacon-aug | beacon_aug/external/textflow/synthesis.py | [
"MIT"
] | Python | _place_text_on_image | <not_specific> | def _place_text_on_image(self, text_list, font_list, region_list=None, effect_list=None,
is_top_left_origin=True, ensure_num_regions=True, is_keep_ratio=True):
"""
place multiple text on a image
:param text_list: list of str
:param font_list: list of font fil... |
place multiple text on a image
:param text_list: list of str
:param font_list: list of font file path
:param region_list: list of regions, a region is a list of 4 corners in x-y coord
:param effect_list: list of effects, a effect is a dict, please refer to self._place_text_on_re... | place multiple text on a image | [
"place",
"multiple",
"text",
"on",
"a",
"image"
] | def _place_text_on_image(self, text_list, font_list, region_list=None, effect_list=None,
is_top_left_origin=True, ensure_num_regions=True, is_keep_ratio=True):
n_text, n_font = len(text_list), len(font_list)
self.list_text = []
self.list_bound = []
self.list_... | [
"def",
"_place_text_on_image",
"(",
"self",
",",
"text_list",
",",
"font_list",
",",
"region_list",
"=",
"None",
",",
"effect_list",
"=",
"None",
",",
"is_top_left_origin",
"=",
"True",
",",
"ensure_num_regions",
"=",
"True",
",",
"is_keep_ratio",
"=",
"True",
... | place multiple text on a image | [
"place",
"multiple",
"text",
"on",
"a",
"image"
] | [
"\"\"\"\n place multiple text on a image\n :param text_list: list of str\n :param font_list: list of font file path\n :param region_list: list of regions, a region is a list of 4 corners in x-y coord\n :param effect_list: list of effects, a effect is a dict, please refer to self._... | [
{
"param": "self",
"type": null
},
{
"param": "text_list",
"type": null
},
{
"param": "font_list",
"type": null
},
{
"param": "region_list",
"type": null
},
{
"param": "effect_list",
"type": null
},
{
"param": "is_top_left_origin",
"type": null
}... | {
"returns": [
{
"docstring": "RGB image with text on it, and annotations, i.e., bounding box, character box, baseline, and true text",
"docstring_tokens": [
"RGB",
"image",
"with",
"text",
"on",
"it",
"and",
"annotations",
"i",
... |
ab745465fb86dc3b8254bef4808d5f1f32d651bb | adobe-research/beacon-aug | beacon_aug/external/textflow/synthesis.py | [
"MIT"
] | Python | plot_annotations | <not_specific> | def plot_annotations(self):
"""
plot bounding quadrilateral of the text placed on self.image, as well as their baseline and character-wise bbox
"""
output = np.copy(self.image)
cv2.drawContours(output, contours=np.array(self.list_bound),
contourIdx=-1, co... |
plot bounding quadrilateral of the text placed on self.image, as well as their baseline and character-wise bbox
| plot bounding quadrilateral of the text placed on self.image, as well as their baseline and character-wise bbox | [
"plot",
"bounding",
"quadrilateral",
"of",
"the",
"text",
"placed",
"on",
"self",
".",
"image",
"as",
"well",
"as",
"their",
"baseline",
"and",
"character",
"-",
"wise",
"bbox"
] | def plot_annotations(self):
output = np.copy(self.image)
cv2.drawContours(output, contours=np.array(self.list_bound),
contourIdx=-1, color=(255, 0, 0), thickness=1)
for i in range(len(self.list_bound)):
cv2.drawContours(
output, contours=self.... | [
"def",
"plot_annotations",
"(",
"self",
")",
":",
"output",
"=",
"np",
".",
"copy",
"(",
"self",
".",
"image",
")",
"cv2",
".",
"drawContours",
"(",
"output",
",",
"contours",
"=",
"np",
".",
"array",
"(",
"self",
".",
"list_bound",
")",
",",
"contou... | plot bounding quadrilateral of the text placed on self.image, as well as their baseline and character-wise bbox | [
"plot",
"bounding",
"quadrilateral",
"of",
"the",
"text",
"placed",
"on",
"self",
".",
"image",
"as",
"well",
"as",
"their",
"baseline",
"and",
"character",
"-",
"wise",
"bbox"
] | [
"\"\"\"\n plot bounding quadrilateral of the text placed on self.image, as well as their baseline and character-wise bbox\n \"\"\""
] | [
{
"param": "self",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
84ab1218e5715e5a2751e0a778a9f798bea739bb | adobe-research/beacon-aug | beacon_aug/external/textflow/__init__.py | [
"MIT"
] | Python | text_synthesis | <not_specific> | def text_synthesis(img, text_list, font_list=None, region_list=None, effect_list=None,
is_top_left_origin=True, ensure_num_regions=False, is_keep_ratio=True):
"""
place multiple text on a image
:param img: str or array, image path or RGB image
:param text_list: list of str
:param ... |
place multiple text on a image
:param img: str or array, image path or RGB image
:param text_list: list of str
:param font_list: list of font file path
:param region_list: list of regions, a region is a list of 4 corners in x-y coord
:param effect_list: list of effects, a effect is a dict, plea... | place multiple text on a image | [
"place",
"multiple",
"text",
"on",
"a",
"image"
] | def text_synthesis(img, text_list, font_list=None, region_list=None, effect_list=None,
is_top_left_origin=True, ensure_num_regions=False, is_keep_ratio=True):
if font_list is None:
font_list = [DIR_PATH + '/data/font/Vera.ttf',
DIR_PATH + 'data/font/VeraMono.ttf']
... | [
"def",
"text_synthesis",
"(",
"img",
",",
"text_list",
",",
"font_list",
"=",
"None",
",",
"region_list",
"=",
"None",
",",
"effect_list",
"=",
"None",
",",
"is_top_left_origin",
"=",
"True",
",",
"ensure_num_regions",
"=",
"False",
",",
"is_keep_ratio",
"=",
... | place multiple text on a image | [
"place",
"multiple",
"text",
"on",
"a",
"image"
] | [
"\"\"\"\n place multiple text on a image\n :param img: str or array, image path or RGB image\n :param text_list: list of str\n :param font_list: list of font file path\n :param region_list: list of regions, a region is a list of 4 corners in x-y coord\n :param effect_list: list of effects, a effec... | [
{
"param": "img",
"type": null
},
{
"param": "text_list",
"type": null
},
{
"param": "font_list",
"type": null
},
{
"param": "region_list",
"type": null
},
{
"param": "effect_list",
"type": null
},
{
"param": "is_top_left_origin",
"type": null
},... | {
"returns": [
{
"docstring": "dict,\nimg: text image\ntxt: ground truth, list of str\nbbx: bounding box, list of 4x2 arrays, each array has 4 points in image (x-y) coord\ncbx: character boxes, list of Nx4x2 arrays, each array has N (the number of characters) bounding boxes\nbln: baseline, list of 2x2 array... |
c9d1993b4cd8f5c688dcd7bf54d0462ac9f97279 | adobe-research/beacon-aug | beacon_aug/external/textflow/render.py | [
"MIT"
] | Python | list_charmap | <not_specific> | def list_charmap(self, verb=True):
"""
list current charmap by index, code, and name
:param verb: boolean, whether print the list
:return: the charmap in terms of indices (array), codes (array), names (list)
"""
if not self.face:
return
try:
... |
list current charmap by index, code, and name
:param verb: boolean, whether print the list
:return: the charmap in terms of indices (array), codes (array), names (list)
| list current charmap by index, code, and name | [
"list",
"current",
"charmap",
"by",
"index",
"code",
"and",
"name"
] | def list_charmap(self, verb=True):
if not self.face:
return
try:
charmap_name = self.face.charmap.encoding_name
except:
logging.warning('No charmap selected!')
return []
else:
chars = sorted([(c[1], c[0]) for c in self.face.get_... | [
"def",
"list_charmap",
"(",
"self",
",",
"verb",
"=",
"True",
")",
":",
"if",
"not",
"self",
".",
"face",
":",
"return",
"try",
":",
"charmap_name",
"=",
"self",
".",
"face",
".",
"charmap",
".",
"encoding_name",
"except",
":",
"logging",
".",
"warning... | list current charmap by index, code, and name | [
"list",
"current",
"charmap",
"by",
"index",
"code",
"and",
"name"
] | [
"\"\"\"\n list current charmap by index, code, and name\n :param verb: boolean, whether print the list\n :return: the charmap in terms of indices (array), codes (array), names (list)\n \"\"\""
] | [
{
"param": "self",
"type": null
},
{
"param": "verb",
"type": null
}
] | {
"returns": [
{
"docstring": "the charmap in terms of indices (array), codes (array), names (list)",
"docstring_tokens": [
"the",
"charmap",
"in",
"terms",
"of",
"indices",
"(",
"array",
")",
"codes",
"(",
... |
a25c7963c64c9abf8b6e1e443dd7fd58b3f9bbe2 | kbr/fritzconnection | fritzconnection/lib/fritzhomeauto.py | [
"MIT"
] | Python | device_information | <not_specific> | def device_information(self):
"""
Returns a list of dictionaries for all known homeauto-devices.
"""
info = list()
for n in itertools.count():
try:
info = self.get_device_information_by_index(n)
except IndexError:
break
... |
Returns a list of dictionaries for all known homeauto-devices.
| Returns a list of dictionaries for all known homeauto-devices. | [
"Returns",
"a",
"list",
"of",
"dictionaries",
"for",
"all",
"known",
"homeauto",
"-",
"devices",
"."
] | def device_information(self):
info = list()
for n in itertools.count():
try:
info = self.get_device_information_by_index(n)
except IndexError:
break
info.append(info)
return info | [
"def",
"device_information",
"(",
"self",
")",
":",
"info",
"=",
"list",
"(",
")",
"for",
"n",
"in",
"itertools",
".",
"count",
"(",
")",
":",
"try",
":",
"info",
"=",
"self",
".",
"get_device_information_by_index",
"(",
"n",
")",
"except",
"IndexError",... | Returns a list of dictionaries for all known homeauto-devices. | [
"Returns",
"a",
"list",
"of",
"dictionaries",
"for",
"all",
"known",
"homeauto",
"-",
"devices",
"."
] | [
"\"\"\"\n Returns a list of dictionaries for all known homeauto-devices.\n \"\"\""
] | [
{
"param": "self",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
adbf7702bae832cc63b893e8fd1872597adfc1ca | kbr/fritzconnection | fritzconnection/lib/fritzwlan.py | [
"MIT"
] | Python | channel_info | <not_specific> | def channel_info(self):
"""
Return a dictionary with the keys *NewChannel* and
*NewPossibleChannels* indicating the active channel and
alternative ones.
"""
return self._action('GetChannelInfo') |
Return a dictionary with the keys *NewChannel* and
*NewPossibleChannels* indicating the active channel and
alternative ones.
| Return a dictionary with the keys *NewChannel* and
NewPossibleChannels* indicating the active channel and
alternative ones. | [
"Return",
"a",
"dictionary",
"with",
"the",
"keys",
"*",
"NewChannel",
"*",
"and",
"NewPossibleChannels",
"*",
"indicating",
"the",
"active",
"channel",
"and",
"alternative",
"ones",
"."
] | def channel_info(self):
return self._action('GetChannelInfo') | [
"def",
"channel_info",
"(",
"self",
")",
":",
"return",
"self",
".",
"_action",
"(",
"'GetChannelInfo'",
")"
] | Return a dictionary with the keys *NewChannel* and
NewPossibleChannels* indicating the active channel and
alternative ones. | [
"Return",
"a",
"dictionary",
"with",
"the",
"keys",
"*",
"NewChannel",
"*",
"and",
"NewPossibleChannels",
"*",
"indicating",
"the",
"active",
"channel",
"and",
"alternative",
"ones",
"."
] | [
"\"\"\"\n Return a dictionary with the keys *NewChannel* and\n *NewPossibleChannels* indicating the active channel and\n alternative ones.\n \"\"\""
] | [
{
"param": "self",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
adbf7702bae832cc63b893e8fd1872597adfc1ca | kbr/fritzconnection | fritzconnection/lib/fritzwlan.py | [
"MIT"
] | Python | _create_preshared_key | <not_specific> | def _create_preshared_key(self):
"""
Returns a new pre-shared key for setting a new password.
The sequence is of uppercase characters as this is default on FritzOS
at time of writing.
"""
info = self.get_info()
characters = info["NewAllowedCharsPSK"]
lengt... |
Returns a new pre-shared key for setting a new password.
The sequence is of uppercase characters as this is default on FritzOS
at time of writing.
| Returns a new pre-shared key for setting a new password.
The sequence is of uppercase characters as this is default on FritzOS
at time of writing. | [
"Returns",
"a",
"new",
"pre",
"-",
"shared",
"key",
"for",
"setting",
"a",
"new",
"password",
".",
"The",
"sequence",
"is",
"of",
"uppercase",
"characters",
"as",
"this",
"is",
"default",
"on",
"FritzOS",
"at",
"time",
"of",
"writing",
"."
] | def _create_preshared_key(self):
info = self.get_info()
characters = info["NewAllowedCharsPSK"]
length = info["NewMaxCharsPSK"]
return "".join(random.choices(characters, k=length)).upper() | [
"def",
"_create_preshared_key",
"(",
"self",
")",
":",
"info",
"=",
"self",
".",
"get_info",
"(",
")",
"characters",
"=",
"info",
"[",
"\"NewAllowedCharsPSK\"",
"]",
"length",
"=",
"info",
"[",
"\"NewMaxCharsPSK\"",
"]",
"return",
"\"\"",
".",
"join",
"(",
... | Returns a new pre-shared key for setting a new password. | [
"Returns",
"a",
"new",
"pre",
"-",
"shared",
"key",
"for",
"setting",
"a",
"new",
"password",
"."
] | [
"\"\"\"\n Returns a new pre-shared key for setting a new password.\n The sequence is of uppercase characters as this is default on FritzOS\n at time of writing.\n \"\"\""
] | [
{
"param": "self",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
adbf7702bae832cc63b893e8fd1872597adfc1ca | kbr/fritzconnection | fritzconnection/lib/fritzwlan.py | [
"MIT"
] | Python | _create_password | <not_specific> | def _create_password(length):
"""
Returns a human-readable password with the given length.
"""
# add just two human-readable special characters.
# password strength increases with the length.
# character permutations are: 64**length
characters = string.ascii_lette... |
Returns a human-readable password with the given length.
| Returns a human-readable password with the given length. | [
"Returns",
"a",
"human",
"-",
"readable",
"password",
"with",
"the",
"given",
"length",
"."
] | def _create_password(length):
characters = string.ascii_letters + string.digits + "@#"
return "".join(random.choices(characters, k=length)) | [
"def",
"_create_password",
"(",
"length",
")",
":",
"characters",
"=",
"string",
".",
"ascii_letters",
"+",
"string",
".",
"digits",
"+",
"\"@#\"",
"return",
"\"\"",
".",
"join",
"(",
"random",
".",
"choices",
"(",
"characters",
",",
"k",
"=",
"length",
... | Returns a human-readable password with the given length. | [
"Returns",
"a",
"human",
"-",
"readable",
"password",
"with",
"the",
"given",
"length",
"."
] | [
"\"\"\"\n Returns a human-readable password with the given length.\n \"\"\"",
"# add just two human-readable special characters.",
"# password strength increases with the length.",
"# character permutations are: 64**length"
] | [
{
"param": "length",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "length",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
50245c71433dad201763cbb14595a5bf71a97ec2 | kbr/fritzconnection | fritzconnection/lib/fritzstatus.py | [
"MIT"
] | Python | is_linked | <not_specific> | def is_linked(self):
"""
A boolean whether the FritzBox is physically linked to
the provider.
"""
status = self.fc.call_action("WANCommonIFC", "GetCommonLinkProperties")
return status["NewPhysicalLinkStatus"] == "Up" |
A boolean whether the FritzBox is physically linked to
the provider.
| A boolean whether the FritzBox is physically linked to
the provider. | [
"A",
"boolean",
"whether",
"the",
"FritzBox",
"is",
"physically",
"linked",
"to",
"the",
"provider",
"."
] | def is_linked(self):
status = self.fc.call_action("WANCommonIFC", "GetCommonLinkProperties")
return status["NewPhysicalLinkStatus"] == "Up" | [
"def",
"is_linked",
"(",
"self",
")",
":",
"status",
"=",
"self",
".",
"fc",
".",
"call_action",
"(",
"\"WANCommonIFC\"",
",",
"\"GetCommonLinkProperties\"",
")",
"return",
"status",
"[",
"\"NewPhysicalLinkStatus\"",
"]",
"==",
"\"Up\""
] | A boolean whether the FritzBox is physically linked to
the provider. | [
"A",
"boolean",
"whether",
"the",
"FritzBox",
"is",
"physically",
"linked",
"to",
"the",
"provider",
"."
] | [
"\"\"\"\n A boolean whether the FritzBox is physically linked to\n the provider.\n \"\"\""
] | [
{
"param": "self",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
50245c71433dad201763cbb14595a5bf71a97ec2 | kbr/fritzconnection | fritzconnection/lib/fritzstatus.py | [
"MIT"
] | Python | is_connected | <not_specific> | def is_connected(self):
"""
A boolean whether the FritzBox has established an
internet-connection.
"""
status = self.fc.call_action("WANIPConn", "GetStatusInfo")
return status["NewConnectionStatus"] == "Connected" |
A boolean whether the FritzBox has established an
internet-connection.
| A boolean whether the FritzBox has established an
internet-connection. | [
"A",
"boolean",
"whether",
"the",
"FritzBox",
"has",
"established",
"an",
"internet",
"-",
"connection",
"."
] | def is_connected(self):
status = self.fc.call_action("WANIPConn", "GetStatusInfo")
return status["NewConnectionStatus"] == "Connected" | [
"def",
"is_connected",
"(",
"self",
")",
":",
"status",
"=",
"self",
".",
"fc",
".",
"call_action",
"(",
"\"WANIPConn\"",
",",
"\"GetStatusInfo\"",
")",
"return",
"status",
"[",
"\"NewConnectionStatus\"",
"]",
"==",
"\"Connected\""
] | A boolean whether the FritzBox has established an
internet-connection. | [
"A",
"boolean",
"whether",
"the",
"FritzBox",
"has",
"established",
"an",
"internet",
"-",
"connection",
"."
] | [
"\"\"\"\n A boolean whether the FritzBox has established an\n internet-connection.\n \"\"\""
] | [
{
"param": "self",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
50245c71433dad201763cbb14595a5bf71a97ec2 | kbr/fritzconnection | fritzconnection/lib/fritzstatus.py | [
"MIT"
] | Python | external_ip | <not_specific> | def external_ip(self):
"""The external v4 ip-address."""
return self.fc.call_action("WANIPConn", "GetExternalIPAddress")[
"NewExternalIPAddress"
] | The external v4 ip-address. | The external v4 ip-address. | [
"The",
"external",
"v4",
"ip",
"-",
"address",
"."
] | def external_ip(self):
return self.fc.call_action("WANIPConn", "GetExternalIPAddress")[
"NewExternalIPAddress"
] | [
"def",
"external_ip",
"(",
"self",
")",
":",
"return",
"self",
".",
"fc",
".",
"call_action",
"(",
"\"WANIPConn\"",
",",
"\"GetExternalIPAddress\"",
")",
"[",
"\"NewExternalIPAddress\"",
"]"
] | The external v4 ip-address. | [
"The",
"external",
"v4",
"ip",
"-",
"address",
"."
] | [
"\"\"\"The external v4 ip-address.\"\"\""
] | [
{
"param": "self",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
50245c71433dad201763cbb14595a5bf71a97ec2 | kbr/fritzconnection | fritzconnection/lib/fritzstatus.py | [
"MIT"
] | Python | external_ipv6_info | <not_specific> | def external_ipv6_info(self):
"""
Returns the ipv6 external address information as a dictionary with the keys:
NewExternalIPv6Address out -> string
NewPrefixLength out -> ui1
NewValidLifetime out -> ui... |
Returns the ipv6 external address information as a dictionary with the keys:
NewExternalIPv6Address out -> string
NewPrefixLength out -> ui1
NewValidLifetime out -> ui4
NewPreferedLifetime ... | Returns the ipv6 external address information as a dictionary with the keys:
NewExternalIPv6Address out -> string
NewPrefixLength out -> ui1
NewValidLifetime out -> ui4
NewPreferedLifetime out -> ui4 | [
"Returns",
"the",
"ipv6",
"external",
"address",
"information",
"as",
"a",
"dictionary",
"with",
"the",
"keys",
":",
"NewExternalIPv6Address",
"out",
"-",
">",
"string",
"NewPrefixLength",
"out",
"-",
">",
"ui1",
"NewValidLifetime",
"out",
"-",
">",
"ui4",
"Ne... | def external_ipv6_info(self):
return self.fc.call_action("WANIPConn", "X_AVM_DE_GetExternalIPv6Address") | [
"def",
"external_ipv6_info",
"(",
"self",
")",
":",
"return",
"self",
".",
"fc",
".",
"call_action",
"(",
"\"WANIPConn\"",
",",
"\"X_AVM_DE_GetExternalIPv6Address\"",
")"
] | Returns the ipv6 external address information as a dictionary with the keys:
NewExternalIPv6Address out -> string
NewPrefixLength out -> ui1
NewValidLifetime out -> ui4
NewPreferedLifetime out -> ui4 | [
"Returns",
"the",
"ipv6",
"external",
"address",
"information",
"as",
"a",
"dictionary",
"with",
"the",
"keys",
":",
"NewExternalIPv6Address",
"out",
"-",
">",
"string",
"NewPrefixLength",
"out",
"-",
">",
"ui1",
"NewValidLifetime",
"out",
"-",
">",
"ui4",
"Ne... | [
"\"\"\"\n Returns the ipv6 external address information as a dictionary with the keys:\n NewExternalIPv6Address out -> string\n NewPrefixLength out -> ui1\n NewValidLifetime out -> ui4\n NewPreferedLife... | [
{
"param": "self",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
50245c71433dad201763cbb14595a5bf71a97ec2 | kbr/fritzconnection | fritzconnection/lib/fritzstatus.py | [
"MIT"
] | Python | ipv6_prefix_info | <not_specific> | def ipv6_prefix_info(self):
"""
Returns the ipv6 prefix information as a dictionary with the keys:
NewIPv6Prefix out -> string
NewPrefixLength out -> ui1
NewValidLifetime out -> ui4
Ne... |
Returns the ipv6 prefix information as a dictionary with the keys:
NewIPv6Prefix out -> string
NewPrefixLength out -> ui1
NewValidLifetime out -> ui4
NewPreferedLifetime ... | Returns the ipv6 prefix information as a dictionary with the keys:
NewIPv6Prefix out -> string
NewPrefixLength out -> ui1
NewValidLifetime out -> ui4
NewPreferedLifetime out -> ui4 | [
"Returns",
"the",
"ipv6",
"prefix",
"information",
"as",
"a",
"dictionary",
"with",
"the",
"keys",
":",
"NewIPv6Prefix",
"out",
"-",
">",
"string",
"NewPrefixLength",
"out",
"-",
">",
"ui1",
"NewValidLifetime",
"out",
"-",
">",
"ui4",
"NewPreferedLifetime",
"o... | def ipv6_prefix_info(self):
return self.fc.call_action("WANIPConn", "X_AVM_DE_GetIPv6Prefix") | [
"def",
"ipv6_prefix_info",
"(",
"self",
")",
":",
"return",
"self",
".",
"fc",
".",
"call_action",
"(",
"\"WANIPConn\"",
",",
"\"X_AVM_DE_GetIPv6Prefix\"",
")"
] | Returns the ipv6 prefix information as a dictionary with the keys:
NewIPv6Prefix out -> string
NewPrefixLength out -> ui1
NewValidLifetime out -> ui4
NewPreferedLifetime out -> ui4 | [
"Returns",
"the",
"ipv6",
"prefix",
"information",
"as",
"a",
"dictionary",
"with",
"the",
"keys",
":",
"NewIPv6Prefix",
"out",
"-",
">",
"string",
"NewPrefixLength",
"out",
"-",
">",
"ui1",
"NewValidLifetime",
"out",
"-",
">",
"ui4",
"NewPreferedLifetime",
"o... | [
"\"\"\"\n Returns the ipv6 prefix information as a dictionary with the keys:\n NewIPv6Prefix out -> string\n NewPrefixLength out -> ui1\n NewValidLifetime out -> ui4\n NewPreferedLifetime ... | [
{
"param": "self",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
50245c71433dad201763cbb14595a5bf71a97ec2 | kbr/fritzconnection | fritzconnection/lib/fritzstatus.py | [
"MIT"
] | Python | uptime | <not_specific> | def uptime(self):
"""
Connection uptime in seconds.
Alias for self.connection_uptime for backward compatibility.
"""
return self.connection_uptime |
Connection uptime in seconds.
Alias for self.connection_uptime for backward compatibility.
| Connection uptime in seconds.
Alias for self.connection_uptime for backward compatibility. | [
"Connection",
"uptime",
"in",
"seconds",
".",
"Alias",
"for",
"self",
".",
"connection_uptime",
"for",
"backward",
"compatibility",
"."
] | def uptime(self):
return self.connection_uptime | [
"def",
"uptime",
"(",
"self",
")",
":",
"return",
"self",
".",
"connection_uptime"
] | Connection uptime in seconds. | [
"Connection",
"uptime",
"in",
"seconds",
"."
] | [
"\"\"\"\n Connection uptime in seconds.\n Alias for self.connection_uptime for backward compatibility.\n \"\"\""
] | [
{
"param": "self",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
50245c71433dad201763cbb14595a5bf71a97ec2 | kbr/fritzconnection | fritzconnection/lib/fritzstatus.py | [
"MIT"
] | Python | str_uptime | <not_specific> | def str_uptime(self):
"""Connection uptime in human-readable format."""
mins, secs = divmod(self.uptime, 60)
hours, mins = divmod(mins, 60)
return "%02d:%02d:%02d" % (hours, mins, secs) | Connection uptime in human-readable format. | Connection uptime in human-readable format. | [
"Connection",
"uptime",
"in",
"human",
"-",
"readable",
"format",
"."
] | def str_uptime(self):
mins, secs = divmod(self.uptime, 60)
hours, mins = divmod(mins, 60)
return "%02d:%02d:%02d" % (hours, mins, secs) | [
"def",
"str_uptime",
"(",
"self",
")",
":",
"mins",
",",
"secs",
"=",
"divmod",
"(",
"self",
".",
"uptime",
",",
"60",
")",
"hours",
",",
"mins",
"=",
"divmod",
"(",
"mins",
",",
"60",
")",
"return",
"\"%02d:%02d:%02d\"",
"%",
"(",
"hours",
",",
"m... | Connection uptime in human-readable format. | [
"Connection",
"uptime",
"in",
"human",
"-",
"readable",
"format",
"."
] | [
"\"\"\"Connection uptime in human-readable format.\"\"\""
] | [
{
"param": "self",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
50245c71433dad201763cbb14595a5bf71a97ec2 | kbr/fritzconnection | fritzconnection/lib/fritzstatus.py | [
"MIT"
] | Python | bytes_sent | <not_specific> | def bytes_sent(self):
"""Total number of sent bytes."""
try:
status = self.fc.call_action("WANCommonIFC1", "GetAddonInfos")
value = status["NewX_AVM_DE_TotalBytesSent64"]
except KeyError:
# fallback for older FritzOS Versions not providing a 64 bit value:
... | Total number of sent bytes. | Total number of sent bytes. | [
"Total",
"number",
"of",
"sent",
"bytes",
"."
] | def bytes_sent(self):
try:
status = self.fc.call_action("WANCommonIFC1", "GetAddonInfos")
value = status["NewX_AVM_DE_TotalBytesSent64"]
except KeyError:
status = self.fc.call_action(
"WANCommonIFC1", "GetTotalBytesSent"
)
value... | [
"def",
"bytes_sent",
"(",
"self",
")",
":",
"try",
":",
"status",
"=",
"self",
".",
"fc",
".",
"call_action",
"(",
"\"WANCommonIFC1\"",
",",
"\"GetAddonInfos\"",
")",
"value",
"=",
"status",
"[",
"\"NewX_AVM_DE_TotalBytesSent64\"",
"]",
"except",
"KeyError",
"... | Total number of sent bytes. | [
"Total",
"number",
"of",
"sent",
"bytes",
"."
] | [
"\"\"\"Total number of sent bytes.\"\"\"",
"# fallback for older FritzOS Versions not providing a 64 bit value:"
] | [
{
"param": "self",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
50245c71433dad201763cbb14595a5bf71a97ec2 | kbr/fritzconnection | fritzconnection/lib/fritzstatus.py | [
"MIT"
] | Python | bytes_received | <not_specific> | def bytes_received(self):
"""Total number of received bytes."""
try:
status = self.fc.call_action("WANCommonIFC1", "GetAddonInfos")
value = status["NewX_AVM_DE_TotalBytesReceived64"]
except KeyError:
# fallback for older FritzOS Versions not providing a 64 bit... | Total number of received bytes. | Total number of received bytes. | [
"Total",
"number",
"of",
"received",
"bytes",
"."
] | def bytes_received(self):
try:
status = self.fc.call_action("WANCommonIFC1", "GetAddonInfos")
value = status["NewX_AVM_DE_TotalBytesReceived64"]
except KeyError:
status = self.fc.call_action(
"WANCommonIFC1", "GetTotalBytesReceived"
)
... | [
"def",
"bytes_received",
"(",
"self",
")",
":",
"try",
":",
"status",
"=",
"self",
".",
"fc",
".",
"call_action",
"(",
"\"WANCommonIFC1\"",
",",
"\"GetAddonInfos\"",
")",
"value",
"=",
"status",
"[",
"\"NewX_AVM_DE_TotalBytesReceived64\"",
"]",
"except",
"KeyErr... | Total number of received bytes. | [
"Total",
"number",
"of",
"received",
"bytes",
"."
] | [
"\"\"\"Total number of received bytes.\"\"\"",
"# fallback for older FritzOS Versions not providing a 64 bit value:"
] | [
{
"param": "self",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
50245c71433dad201763cbb14595a5bf71a97ec2 | kbr/fritzconnection | fritzconnection/lib/fritzstatus.py | [
"MIT"
] | Python | transmission_rate | <not_specific> | def transmission_rate(self):
"""
The upstream and downstream values as a tuple in bytes per
second. Use this for periodical calling.
"""
status = self.fc.call_action("WANCommonIFC1", "GetAddonInfos")
upstream = status["NewByteSendRate"]
downstream = status["NewByt... |
The upstream and downstream values as a tuple in bytes per
second. Use this for periodical calling.
| The upstream and downstream values as a tuple in bytes per
second. Use this for periodical calling. | [
"The",
"upstream",
"and",
"downstream",
"values",
"as",
"a",
"tuple",
"in",
"bytes",
"per",
"second",
".",
"Use",
"this",
"for",
"periodical",
"calling",
"."
] | def transmission_rate(self):
status = self.fc.call_action("WANCommonIFC1", "GetAddonInfos")
upstream = status["NewByteSendRate"]
downstream = status["NewByteReceiveRate"]
return upstream, downstream | [
"def",
"transmission_rate",
"(",
"self",
")",
":",
"status",
"=",
"self",
".",
"fc",
".",
"call_action",
"(",
"\"WANCommonIFC1\"",
",",
"\"GetAddonInfos\"",
")",
"upstream",
"=",
"status",
"[",
"\"NewByteSendRate\"",
"]",
"downstream",
"=",
"status",
"[",
"\"N... | The upstream and downstream values as a tuple in bytes per
second. | [
"The",
"upstream",
"and",
"downstream",
"values",
"as",
"a",
"tuple",
"in",
"bytes",
"per",
"second",
"."
] | [
"\"\"\"\n The upstream and downstream values as a tuple in bytes per\n second. Use this for periodical calling.\n \"\"\""
] | [
{
"param": "self",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
50245c71433dad201763cbb14595a5bf71a97ec2 | kbr/fritzconnection | fritzconnection/lib/fritzstatus.py | [
"MIT"
] | Python | str_transmission_rate | <not_specific> | def str_transmission_rate(self):
"""
Tuple of human-readable transmission rate in bytes. First item
is upstream, second item downstream.
"""
upstream, downstream = self.transmission_rate
return (format_num(upstream), format_num(downstream)) |
Tuple of human-readable transmission rate in bytes. First item
is upstream, second item downstream.
| Tuple of human-readable transmission rate in bytes. First item
is upstream, second item downstream. | [
"Tuple",
"of",
"human",
"-",
"readable",
"transmission",
"rate",
"in",
"bytes",
".",
"First",
"item",
"is",
"upstream",
"second",
"item",
"downstream",
"."
] | def str_transmission_rate(self):
upstream, downstream = self.transmission_rate
return (format_num(upstream), format_num(downstream)) | [
"def",
"str_transmission_rate",
"(",
"self",
")",
":",
"upstream",
",",
"downstream",
"=",
"self",
".",
"transmission_rate",
"return",
"(",
"format_num",
"(",
"upstream",
")",
",",
"format_num",
"(",
"downstream",
")",
")"
] | Tuple of human-readable transmission rate in bytes. | [
"Tuple",
"of",
"human",
"-",
"readable",
"transmission",
"rate",
"in",
"bytes",
"."
] | [
"\"\"\"\n Tuple of human-readable transmission rate in bytes. First item\n is upstream, second item downstream.\n \"\"\""
] | [
{
"param": "self",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
50245c71433dad201763cbb14595a5bf71a97ec2 | kbr/fritzconnection | fritzconnection/lib/fritzstatus.py | [
"MIT"
] | Python | max_linked_bit_rate | <not_specific> | def max_linked_bit_rate(self):
"""
Tuple with the maximum upstream- and downstream-rate
of the physical link. The rate is given in bits/sec.
"""
return self._get_max_bit_rate("WANCommonInterfaceConfig") |
Tuple with the maximum upstream- and downstream-rate
of the physical link. The rate is given in bits/sec.
| Tuple with the maximum upstream- and downstream-rate
of the physical link. The rate is given in bits/sec. | [
"Tuple",
"with",
"the",
"maximum",
"upstream",
"-",
"and",
"downstream",
"-",
"rate",
"of",
"the",
"physical",
"link",
".",
"The",
"rate",
"is",
"given",
"in",
"bits",
"/",
"sec",
"."
] | def max_linked_bit_rate(self):
return self._get_max_bit_rate("WANCommonInterfaceConfig") | [
"def",
"max_linked_bit_rate",
"(",
"self",
")",
":",
"return",
"self",
".",
"_get_max_bit_rate",
"(",
"\"WANCommonInterfaceConfig\"",
")"
] | Tuple with the maximum upstream- and downstream-rate
of the physical link. | [
"Tuple",
"with",
"the",
"maximum",
"upstream",
"-",
"and",
"downstream",
"-",
"rate",
"of",
"the",
"physical",
"link",
"."
] | [
"\"\"\"\n Tuple with the maximum upstream- and downstream-rate\n of the physical link. The rate is given in bits/sec.\n \"\"\""
] | [
{
"param": "self",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
50245c71433dad201763cbb14595a5bf71a97ec2 | kbr/fritzconnection | fritzconnection/lib/fritzstatus.py | [
"MIT"
] | Python | max_bit_rate | <not_specific> | def max_bit_rate(self):
"""
Tuple with the maximum upstream- and downstream-rate
of the given connection. The rate is given in bits/sec.
"""
return self._get_max_bit_rate("WANCommonIFC") |
Tuple with the maximum upstream- and downstream-rate
of the given connection. The rate is given in bits/sec.
| Tuple with the maximum upstream- and downstream-rate
of the given connection. The rate is given in bits/sec. | [
"Tuple",
"with",
"the",
"maximum",
"upstream",
"-",
"and",
"downstream",
"-",
"rate",
"of",
"the",
"given",
"connection",
".",
"The",
"rate",
"is",
"given",
"in",
"bits",
"/",
"sec",
"."
] | def max_bit_rate(self):
return self._get_max_bit_rate("WANCommonIFC") | [
"def",
"max_bit_rate",
"(",
"self",
")",
":",
"return",
"self",
".",
"_get_max_bit_rate",
"(",
"\"WANCommonIFC\"",
")"
] | Tuple with the maximum upstream- and downstream-rate
of the given connection. | [
"Tuple",
"with",
"the",
"maximum",
"upstream",
"-",
"and",
"downstream",
"-",
"rate",
"of",
"the",
"given",
"connection",
"."
] | [
"\"\"\"\n Tuple with the maximum upstream- and downstream-rate\n of the given connection. The rate is given in bits/sec.\n \"\"\""
] | [
{
"param": "self",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
50245c71433dad201763cbb14595a5bf71a97ec2 | kbr/fritzconnection | fritzconnection/lib/fritzstatus.py | [
"MIT"
] | Python | _get_max_bit_rate | <not_specific> | def _get_max_bit_rate(self, servicename):
"""
internal method to get the upstream and downstream-rates for
different services of the WANCommonInterfaceConfig1 ServiceType.
"""
status = self.fc.call_action(servicename, "GetCommonLinkProperties")
downstream = status["NewLay... |
internal method to get the upstream and downstream-rates for
different services of the WANCommonInterfaceConfig1 ServiceType.
| internal method to get the upstream and downstream-rates for
different services of the WANCommonInterfaceConfig1 ServiceType. | [
"internal",
"method",
"to",
"get",
"the",
"upstream",
"and",
"downstream",
"-",
"rates",
"for",
"different",
"services",
"of",
"the",
"WANCommonInterfaceConfig1",
"ServiceType",
"."
] | def _get_max_bit_rate(self, servicename):
status = self.fc.call_action(servicename, "GetCommonLinkProperties")
downstream = status["NewLayer1DownstreamMaxBitRate"]
upstream = status["NewLayer1UpstreamMaxBitRate"]
return upstream, downstream | [
"def",
"_get_max_bit_rate",
"(",
"self",
",",
"servicename",
")",
":",
"status",
"=",
"self",
".",
"fc",
".",
"call_action",
"(",
"servicename",
",",
"\"GetCommonLinkProperties\"",
")",
"downstream",
"=",
"status",
"[",
"\"NewLayer1DownstreamMaxBitRate\"",
"]",
"u... | internal method to get the upstream and downstream-rates for
different services of the WANCommonInterfaceConfig1 ServiceType. | [
"internal",
"method",
"to",
"get",
"the",
"upstream",
"and",
"downstream",
"-",
"rates",
"for",
"different",
"services",
"of",
"the",
"WANCommonInterfaceConfig1",
"ServiceType",
"."
] | [
"\"\"\"\n internal method to get the upstream and downstream-rates for\n different services of the WANCommonInterfaceConfig1 ServiceType.\n \"\"\""
] | [
{
"param": "self",
"type": null
},
{
"param": "servicename",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "servicename",
"type": null,
"docstring": null,
"docstring_tok... |
50245c71433dad201763cbb14595a5bf71a97ec2 | kbr/fritzconnection | fritzconnection/lib/fritzstatus.py | [
"MIT"
] | Python | str_max_linked_bit_rate | <not_specific> | def str_max_linked_bit_rate(self):
"""
Human-readable maximum of the physical upstream- and
downstream-rate in bits/sec. Value is a tuple, first item is
upstream, second item is downstream.
"""
upstream, downstream = self.max_linked_bit_rate
return (
f... |
Human-readable maximum of the physical upstream- and
downstream-rate in bits/sec. Value is a tuple, first item is
upstream, second item is downstream.
| Human-readable maximum of the physical upstream- and
downstream-rate in bits/sec. Value is a tuple, first item is
upstream, second item is downstream. | [
"Human",
"-",
"readable",
"maximum",
"of",
"the",
"physical",
"upstream",
"-",
"and",
"downstream",
"-",
"rate",
"in",
"bits",
"/",
"sec",
".",
"Value",
"is",
"a",
"tuple",
"first",
"item",
"is",
"upstream",
"second",
"item",
"is",
"downstream",
"."
] | def str_max_linked_bit_rate(self):
upstream, downstream = self.max_linked_bit_rate
return (
format_rate(upstream, unit="bits"),
format_rate(downstream, unit="bits"),
) | [
"def",
"str_max_linked_bit_rate",
"(",
"self",
")",
":",
"upstream",
",",
"downstream",
"=",
"self",
".",
"max_linked_bit_rate",
"return",
"(",
"format_rate",
"(",
"upstream",
",",
"unit",
"=",
"\"bits\"",
")",
",",
"format_rate",
"(",
"downstream",
",",
"unit... | Human-readable maximum of the physical upstream- and
downstream-rate in bits/sec. | [
"Human",
"-",
"readable",
"maximum",
"of",
"the",
"physical",
"upstream",
"-",
"and",
"downstream",
"-",
"rate",
"in",
"bits",
"/",
"sec",
"."
] | [
"\"\"\"\n Human-readable maximum of the physical upstream- and\n downstream-rate in bits/sec. Value is a tuple, first item is\n upstream, second item is downstream.\n \"\"\""
] | [
{
"param": "self",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
50245c71433dad201763cbb14595a5bf71a97ec2 | kbr/fritzconnection | fritzconnection/lib/fritzstatus.py | [
"MIT"
] | Python | str_max_bit_rate | <not_specific> | def str_max_bit_rate(self):
"""
Human-readable maximum of the upstream- and downstream-rate in
bits/sec, as given by the provider. Value is a tuple, first item
is upstream, second item is downstream.
"""
upstream, downstream = self.max_bit_rate
return (
... |
Human-readable maximum of the upstream- and downstream-rate in
bits/sec, as given by the provider. Value is a tuple, first item
is upstream, second item is downstream.
| Human-readable maximum of the upstream- and downstream-rate in
bits/sec, as given by the provider. Value is a tuple, first item
is upstream, second item is downstream. | [
"Human",
"-",
"readable",
"maximum",
"of",
"the",
"upstream",
"-",
"and",
"downstream",
"-",
"rate",
"in",
"bits",
"/",
"sec",
"as",
"given",
"by",
"the",
"provider",
".",
"Value",
"is",
"a",
"tuple",
"first",
"item",
"is",
"upstream",
"second",
"item",
... | def str_max_bit_rate(self):
upstream, downstream = self.max_bit_rate
return (
format_rate(upstream, unit="bits"),
format_rate(downstream, unit="bits"),
) | [
"def",
"str_max_bit_rate",
"(",
"self",
")",
":",
"upstream",
",",
"downstream",
"=",
"self",
".",
"max_bit_rate",
"return",
"(",
"format_rate",
"(",
"upstream",
",",
"unit",
"=",
"\"bits\"",
")",
",",
"format_rate",
"(",
"downstream",
",",
"unit",
"=",
"\... | Human-readable maximum of the upstream- and downstream-rate in
bits/sec, as given by the provider. | [
"Human",
"-",
"readable",
"maximum",
"of",
"the",
"upstream",
"-",
"and",
"downstream",
"-",
"rate",
"in",
"bits",
"/",
"sec",
"as",
"given",
"by",
"the",
"provider",
"."
] | [
"\"\"\"\n Human-readable maximum of the upstream- and downstream-rate in\n bits/sec, as given by the provider. Value is a tuple, first item\n is upstream, second item is downstream.\n \"\"\""
] | [
{
"param": "self",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
50245c71433dad201763cbb14595a5bf71a97ec2 | kbr/fritzconnection | fritzconnection/lib/fritzstatus.py | [
"MIT"
] | Python | noise_margin | <not_specific> | def noise_margin(self):
"""
Tuple of noise margin. First item
is upstream, second item downstream.
"""
status = self.fc.call_action("WANDSLInterfaceConfig1", "GetInfo")
upstream = status["NewUpstreamNoiseMargin"]
downstream = status["NewDownstreamNoiseMargin"]
... |
Tuple of noise margin. First item
is upstream, second item downstream.
| Tuple of noise margin. First item
is upstream, second item downstream. | [
"Tuple",
"of",
"noise",
"margin",
".",
"First",
"item",
"is",
"upstream",
"second",
"item",
"downstream",
"."
] | def noise_margin(self):
status = self.fc.call_action("WANDSLInterfaceConfig1", "GetInfo")
upstream = status["NewUpstreamNoiseMargin"]
downstream = status["NewDownstreamNoiseMargin"]
return upstream, downstream | [
"def",
"noise_margin",
"(",
"self",
")",
":",
"status",
"=",
"self",
".",
"fc",
".",
"call_action",
"(",
"\"WANDSLInterfaceConfig1\"",
",",
"\"GetInfo\"",
")",
"upstream",
"=",
"status",
"[",
"\"NewUpstreamNoiseMargin\"",
"]",
"downstream",
"=",
"status",
"[",
... | Tuple of noise margin. | [
"Tuple",
"of",
"noise",
"margin",
"."
] | [
"\"\"\"\n Tuple of noise margin. First item\n is upstream, second item downstream.\n \"\"\""
] | [
{
"param": "self",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
50245c71433dad201763cbb14595a5bf71a97ec2 | kbr/fritzconnection | fritzconnection/lib/fritzstatus.py | [
"MIT"
] | Python | str_noise_margin | <not_specific> | def str_noise_margin(self):
"""
Human-readable noise margin in dB. Value is a tuple, first item
is upstream, second item downstream.
"""
upstream, downstream = self.noise_margin
return (format_dB(upstream), format_dB(downstream)) |
Human-readable noise margin in dB. Value is a tuple, first item
is upstream, second item downstream.
| Human-readable noise margin in dB. Value is a tuple, first item
is upstream, second item downstream. | [
"Human",
"-",
"readable",
"noise",
"margin",
"in",
"dB",
".",
"Value",
"is",
"a",
"tuple",
"first",
"item",
"is",
"upstream",
"second",
"item",
"downstream",
"."
] | def str_noise_margin(self):
upstream, downstream = self.noise_margin
return (format_dB(upstream), format_dB(downstream)) | [
"def",
"str_noise_margin",
"(",
"self",
")",
":",
"upstream",
",",
"downstream",
"=",
"self",
".",
"noise_margin",
"return",
"(",
"format_dB",
"(",
"upstream",
")",
",",
"format_dB",
"(",
"downstream",
")",
")"
] | Human-readable noise margin in dB. | [
"Human",
"-",
"readable",
"noise",
"margin",
"in",
"dB",
"."
] | [
"\"\"\"\n Human-readable noise margin in dB. Value is a tuple, first item\n is upstream, second item downstream.\n \"\"\""
] | [
{
"param": "self",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
50245c71433dad201763cbb14595a5bf71a97ec2 | kbr/fritzconnection | fritzconnection/lib/fritzstatus.py | [
"MIT"
] | Python | attenuation | <not_specific> | def attenuation(self):
"""
Tuple of attenuation. First item
is upstream, second item downstream.
"""
status = self.fc.call_action("WANDSLInterfaceConfig1", "GetInfo")
upstream = status["NewUpstreamAttenuation"]
downstream = status["NewDownstreamAttenuation"]
... |
Tuple of attenuation. First item
is upstream, second item downstream.
| Tuple of attenuation. First item
is upstream, second item downstream. | [
"Tuple",
"of",
"attenuation",
".",
"First",
"item",
"is",
"upstream",
"second",
"item",
"downstream",
"."
] | def attenuation(self):
status = self.fc.call_action("WANDSLInterfaceConfig1", "GetInfo")
upstream = status["NewUpstreamAttenuation"]
downstream = status["NewDownstreamAttenuation"]
return upstream, downstream | [
"def",
"attenuation",
"(",
"self",
")",
":",
"status",
"=",
"self",
".",
"fc",
".",
"call_action",
"(",
"\"WANDSLInterfaceConfig1\"",
",",
"\"GetInfo\"",
")",
"upstream",
"=",
"status",
"[",
"\"NewUpstreamAttenuation\"",
"]",
"downstream",
"=",
"status",
"[",
... | Tuple of attenuation. | [
"Tuple",
"of",
"attenuation",
"."
] | [
"\"\"\"\n Tuple of attenuation. First item\n is upstream, second item downstream.\n \"\"\""
] | [
{
"param": "self",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
50245c71433dad201763cbb14595a5bf71a97ec2 | kbr/fritzconnection | fritzconnection/lib/fritzstatus.py | [
"MIT"
] | Python | str_attenuation | <not_specific> | def str_attenuation(self):
"""
Human-readable attenuation in dB. Value is a tuple, first item
is upstream, second item downstream.
"""
upstream, downstream = self.attenuation
return (format_dB(upstream), format_dB(downstream)) |
Human-readable attenuation in dB. Value is a tuple, first item
is upstream, second item downstream.
| Human-readable attenuation in dB. Value is a tuple, first item
is upstream, second item downstream. | [
"Human",
"-",
"readable",
"attenuation",
"in",
"dB",
".",
"Value",
"is",
"a",
"tuple",
"first",
"item",
"is",
"upstream",
"second",
"item",
"downstream",
"."
] | def str_attenuation(self):
upstream, downstream = self.attenuation
return (format_dB(upstream), format_dB(downstream)) | [
"def",
"str_attenuation",
"(",
"self",
")",
":",
"upstream",
",",
"downstream",
"=",
"self",
".",
"attenuation",
"return",
"(",
"format_dB",
"(",
"upstream",
")",
",",
"format_dB",
"(",
"downstream",
")",
")"
] | Human-readable attenuation in dB. | [
"Human",
"-",
"readable",
"attenuation",
"in",
"dB",
"."
] | [
"\"\"\"\n Human-readable attenuation in dB. Value is a tuple, first item\n is upstream, second item downstream.\n \"\"\""
] | [
{
"param": "self",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
aebf0f6552fd9a59d38588b59b3285f27115ec99 | shinsean/pylti1.3 | pylti1p3/oidc_login.py | [
"MIT"
] | Python | redirect | <not_specific> | def redirect(self, launch_url, js_redirect=False):
# type: (str, bool) -> RED
"""
Calculate the redirect location to return to based on an OIDC third party initiated login request.
:param launch_url: URL to redirect back to after the OIDC login.
This URL must match exactly a URL... |
Calculate the redirect location to return to based on an OIDC third party initiated login request.
:param launch_url: URL to redirect back to after the OIDC login.
This URL must match exactly a URL white listed in the platform.
:param js_redirect: Redirect through JS
:return: R... | Calculate the redirect location to return to based on an OIDC third party initiated login request. | [
"Calculate",
"the",
"redirect",
"location",
"to",
"return",
"to",
"based",
"on",
"an",
"OIDC",
"third",
"party",
"initiated",
"login",
"request",
"."
] | def redirect(self, launch_url, js_redirect=False):
if self._cookies_check:
if not self._is_new_window_request():
html = self.get_cookies_allowed_js_check()
return self.get_response(html)
redirect_obj = self._prepare_redirect(launch_url)
if js_redirect:... | [
"def",
"redirect",
"(",
"self",
",",
"launch_url",
",",
"js_redirect",
"=",
"False",
")",
":",
"if",
"self",
".",
"_cookies_check",
":",
"if",
"not",
"self",
".",
"_is_new_window_request",
"(",
")",
":",
"html",
"=",
"self",
".",
"get_cookies_allowed_js_chec... | Calculate the redirect location to return to based on an OIDC third party initiated login request. | [
"Calculate",
"the",
"redirect",
"location",
"to",
"return",
"to",
"based",
"on",
"an",
"OIDC",
"third",
"party",
"initiated",
"login",
"request",
"."
] | [
"# type: (str, bool) -> RED",
"\"\"\"\n Calculate the redirect location to return to based on an OIDC third party initiated login request.\n\n :param launch_url: URL to redirect back to after the OIDC login.\n This URL must match exactly a URL white listed in the platform.\n :param js_... | [
{
"param": "self",
"type": null
},
{
"param": "launch_url",
"type": null
},
{
"param": "js_redirect",
"type": null
}
] | {
"returns": [
{
"docstring": "Returns a redirect object containing the fully formed OIDC login URL.",
"docstring_tokens": [
"Returns",
"a",
"redirect",
"object",
"containing",
"the",
"fully",
"formed",
"OIDC",
"login",
... |
aebf0f6552fd9a59d38588b59b3285f27115ec99 | shinsean/pylti1.3 | pylti1p3/oidc_login.py | [
"MIT"
] | Python | pass_params_to_launch | <not_specific> | def pass_params_to_launch(self, params):
# type: (T_SELF, t.Dict[str, object]) -> T_SELF
"""
Ability to pass custom params from oidc login to launch.
"""
self._state_params = params
return self |
Ability to pass custom params from oidc login to launch.
| Ability to pass custom params from oidc login to launch. | [
"Ability",
"to",
"pass",
"custom",
"params",
"from",
"oidc",
"login",
"to",
"launch",
"."
] | def pass_params_to_launch(self, params):
self._state_params = params
return self | [
"def",
"pass_params_to_launch",
"(",
"self",
",",
"params",
")",
":",
"self",
".",
"_state_params",
"=",
"params",
"return",
"self"
] | Ability to pass custom params from oidc login to launch. | [
"Ability",
"to",
"pass",
"custom",
"params",
"from",
"oidc",
"login",
"to",
"launch",
"."
] | [
"# type: (T_SELF, t.Dict[str, object]) -> T_SELF",
"\"\"\"\n Ability to pass custom params from oidc login to launch.\n \"\"\""
] | [
{
"param": "self",
"type": null
},
{
"param": "params",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "params",
"type": null,
"docstring": null,
"docstring_tokens":... |
d13a8bbc6e979ae591aaca2ba5cb8a47a33165c2 | shinsean/pylti1.3 | pylti1p3/tool_config/abstract.py | [
"MIT"
] | Python | check_iss_has_one_client | <not_specific> | def check_iss_has_one_client(self, iss):
# type: (str) -> bool
"""
Two methods check_iss_has_one_client / check_iss_has_many_clients are needed for the the backward compatibility
with the previous versions of the library (1.4.0 and early) where ToolConfDict supported only client_id per i... |
Two methods check_iss_has_one_client / check_iss_has_many_clients are needed for the the backward compatibility
with the previous versions of the library (1.4.0 and early) where ToolConfDict supported only client_id per iss.
Should return False for all new ToolConf-s
| Two methods check_iss_has_one_client / check_iss_has_many_clients are needed for the the backward compatibility
with the previous versions of the library (1.4.0 and early) where ToolConfDict supported only client_id per iss.
Should return False for all new ToolConf-s | [
"Two",
"methods",
"check_iss_has_one_client",
"/",
"check_iss_has_many_clients",
"are",
"needed",
"for",
"the",
"the",
"backward",
"compatibility",
"with",
"the",
"previous",
"versions",
"of",
"the",
"library",
"(",
"1",
".",
"4",
".",
"0",
"and",
"early",
")",
... | def check_iss_has_one_client(self, iss):
iss_type = self.issuers_relation_types.get(iss, IssuerToClientRelation.ONE_CLIENT_ID_PER_ISSUER)
return iss_type == IssuerToClientRelation.ONE_CLIENT_ID_PER_ISSUER | [
"def",
"check_iss_has_one_client",
"(",
"self",
",",
"iss",
")",
":",
"iss_type",
"=",
"self",
".",
"issuers_relation_types",
".",
"get",
"(",
"iss",
",",
"IssuerToClientRelation",
".",
"ONE_CLIENT_ID_PER_ISSUER",
")",
"return",
"iss_type",
"==",
"IssuerToClientRela... | Two methods check_iss_has_one_client / check_iss_has_many_clients are needed for the the backward compatibility
with the previous versions of the library (1.4.0 and early) where ToolConfDict supported only client_id per iss. | [
"Two",
"methods",
"check_iss_has_one_client",
"/",
"check_iss_has_many_clients",
"are",
"needed",
"for",
"the",
"the",
"backward",
"compatibility",
"with",
"the",
"previous",
"versions",
"of",
"the",
"library",
"(",
"1",
".",
"4",
".",
"0",
"and",
"early",
")",
... | [
"# type: (str) -> bool",
"\"\"\"\n Two methods check_iss_has_one_client / check_iss_has_many_clients are needed for the the backward compatibility\n with the previous versions of the library (1.4.0 and early) where ToolConfDict supported only client_id per iss.\n Should return False for all n... | [
{
"param": "self",
"type": null
},
{
"param": "iss",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "iss",
"type": null,
"docstring": null,
"docstring_tokens": []... |
d13a8bbc6e979ae591aaca2ba5cb8a47a33165c2 | shinsean/pylti1.3 | pylti1p3/tool_config/abstract.py | [
"MIT"
] | Python | find_registration_by_issuer | null | def find_registration_by_issuer(self, iss, *args, **kwargs):
# type: (str, *None, **FIND_REG_KWARGS) -> t.Optional[Registration]
"""
Find registration in case if iss has only one client id, i.e
in case of { ... "iss": { ... "client_id: "client" ... }, ... } config.
You may skip ... |
Find registration in case if iss has only one client id, i.e
in case of { ... "iss": { ... "client_id: "client" ... }, ... } config.
You may skip implementation of this method in case if all iss in your config could have more than one client id.
| Find registration in case if iss has only one client id, i.e
in case of { ...
You may skip implementation of this method in case if all iss in your config could have more than one client id. | [
"Find",
"registration",
"in",
"case",
"if",
"iss",
"has",
"only",
"one",
"client",
"id",
"i",
".",
"e",
"in",
"case",
"of",
"{",
"...",
"You",
"may",
"skip",
"implementation",
"of",
"this",
"method",
"in",
"case",
"if",
"all",
"iss",
"in",
"your",
"c... | def find_registration_by_issuer(self, iss, *args, **kwargs):
raise NotImplementedError | [
"def",
"find_registration_by_issuer",
"(",
"self",
",",
"iss",
",",
"*",
"args",
",",
"**",
"kwargs",
")",
":",
"raise",
"NotImplementedError"
] | Find registration in case if iss has only one client id, i.e
in case of { ... "iss": { ... "client_id: "client" ... }, ... } config. | [
"Find",
"registration",
"in",
"case",
"if",
"iss",
"has",
"only",
"one",
"client",
"id",
"i",
".",
"e",
"in",
"case",
"of",
"{",
"...",
"\"",
"iss",
"\"",
":",
"{",
"...",
"\"",
"client_id",
":",
"\"",
"client",
"\"",
"...",
"}",
"...",
"}",
"con... | [
"# type: (str, *None, **FIND_REG_KWARGS) -> t.Optional[Registration]",
"\"\"\"\n Find registration in case if iss has only one client id, i.e\n in case of { ... \"iss\": { ... \"client_id: \"client\" ... }, ... } config.\n\n You may skip implementation of this method in case if all iss in you... | [
{
"param": "self",
"type": null
},
{
"param": "iss",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "iss",
"type": null,
"docstring": null,
"docstring_tokens": []... |
d13a8bbc6e979ae591aaca2ba5cb8a47a33165c2 | shinsean/pylti1.3 | pylti1p3/tool_config/abstract.py | [
"MIT"
] | Python | find_registration_by_params | null | def find_registration_by_params(self, iss, client_id, *args, **kwargs):
# type: (str, str, *None, **FIND_REG_KWARGS) -> t.Optional[Registration]
"""
Find registration in case if iss has many client ids, i.e
in case of { ... "iss": [ { ... "client_id: "client1" ... }, { ... "client_id: "c... |
Find registration in case if iss has many client ids, i.e
in case of { ... "iss": [ { ... "client_id: "client1" ... }, { ... "client_id: "client2" ... } ], ... } config.
You may skip implementation of this method in case if all iss in your config couldn't have more than one
client id, ... | Find registration in case if iss has many client ids, i.e
in case of { ...
You may skip implementation of this method in case if all iss in your config couldn't have more than one
client id, but it is outdated and not recommended way of storing configuration. | [
"Find",
"registration",
"in",
"case",
"if",
"iss",
"has",
"many",
"client",
"ids",
"i",
".",
"e",
"in",
"case",
"of",
"{",
"...",
"You",
"may",
"skip",
"implementation",
"of",
"this",
"method",
"in",
"case",
"if",
"all",
"iss",
"in",
"your",
"config",
... | def find_registration_by_params(self, iss, client_id, *args, **kwargs):
raise NotImplementedError | [
"def",
"find_registration_by_params",
"(",
"self",
",",
"iss",
",",
"client_id",
",",
"*",
"args",
",",
"**",
"kwargs",
")",
":",
"raise",
"NotImplementedError"
] | Find registration in case if iss has many client ids, i.e
in case of { ... "iss": [ { ... "client_id: "client1" ... }, { ... "client_id: "client2" ... } ], ... } config. | [
"Find",
"registration",
"in",
"case",
"if",
"iss",
"has",
"many",
"client",
"ids",
"i",
".",
"e",
"in",
"case",
"of",
"{",
"...",
"\"",
"iss",
"\"",
":",
"[",
"{",
"...",
"\"",
"client_id",
":",
"\"",
"client1",
"\"",
"...",
"}",
"{",
"...",
"\""... | [
"# type: (str, str, *None, **FIND_REG_KWARGS) -> t.Optional[Registration]",
"\"\"\"\n Find registration in case if iss has many client ids, i.e\n in case of { ... \"iss\": [ { ... \"client_id: \"client1\" ... }, { ... \"client_id: \"client2\" ... } ], ... } config.\n\n You may skip implementa... | [
{
"param": "self",
"type": null
},
{
"param": "iss",
"type": null
},
{
"param": "client_id",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "iss",
"type": null,
"docstring": null,
"docstring_tokens": []... |
d13a8bbc6e979ae591aaca2ba5cb8a47a33165c2 | shinsean/pylti1.3 | pylti1p3/tool_config/abstract.py | [
"MIT"
] | Python | find_deployment | null | def find_deployment(self, iss, deployment_id):
# type: (str, str) -> t.Optional[Deployment]
"""
Find deployment in case if iss has only one client id, i.e
in case of { ... "iss": { ... "client_id: "client" ... }, ... } config.
You may skip implementation of this method in case i... |
Find deployment in case if iss has only one client id, i.e
in case of { ... "iss": { ... "client_id: "client" ... }, ... } config.
You may skip implementation of this method in case if all iss in your config could have more than one client id.
| Find deployment in case if iss has only one client id, i.e
in case of { ...
You may skip implementation of this method in case if all iss in your config could have more than one client id. | [
"Find",
"deployment",
"in",
"case",
"if",
"iss",
"has",
"only",
"one",
"client",
"id",
"i",
".",
"e",
"in",
"case",
"of",
"{",
"...",
"You",
"may",
"skip",
"implementation",
"of",
"this",
"method",
"in",
"case",
"if",
"all",
"iss",
"in",
"your",
"con... | def find_deployment(self, iss, deployment_id):
raise NotImplementedError | [
"def",
"find_deployment",
"(",
"self",
",",
"iss",
",",
"deployment_id",
")",
":",
"raise",
"NotImplementedError"
] | Find deployment in case if iss has only one client id, i.e
in case of { ... "iss": { ... "client_id: "client" ... }, ... } config. | [
"Find",
"deployment",
"in",
"case",
"if",
"iss",
"has",
"only",
"one",
"client",
"id",
"i",
".",
"e",
"in",
"case",
"of",
"{",
"...",
"\"",
"iss",
"\"",
":",
"{",
"...",
"\"",
"client_id",
":",
"\"",
"client",
"\"",
"...",
"}",
"...",
"}",
"confi... | [
"# type: (str, str) -> t.Optional[Deployment]",
"\"\"\"\n Find deployment in case if iss has only one client id, i.e\n in case of { ... \"iss\": { ... \"client_id: \"client\" ... }, ... } config.\n\n You may skip implementation of this method in case if all iss in your config could have more ... | [
{
"param": "self",
"type": null
},
{
"param": "iss",
"type": null
},
{
"param": "deployment_id",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "iss",
"type": null,
"docstring": null,
"docstring_tokens": []... |
d13a8bbc6e979ae591aaca2ba5cb8a47a33165c2 | shinsean/pylti1.3 | pylti1p3/tool_config/abstract.py | [
"MIT"
] | Python | find_deployment_by_params | null | def find_deployment_by_params(self, iss, deployment_id, client_id, *args, **kwargs):
# type: (str, str, str, *None, **None) -> t.Optional[Deployment]
"""
Find deployment in case if iss has many client ids, i.e
in case of { ... "iss": [ { ... "client_id: "client1" ... }, { ... "client_id:... |
Find deployment in case if iss has many client ids, i.e
in case of { ... "iss": [ { ... "client_id: "client1" ... }, { ... "client_id: "client2" ... } ], ... } config.
You may skip implementation of this method in case if all iss in your config couldn't have more than one
client id, bu... | Find deployment in case if iss has many client ids, i.e
in case of { ...
You may skip implementation of this method in case if all iss in your config couldn't have more than one
client id, but it is outdated and not recommended way of storing configuration. | [
"Find",
"deployment",
"in",
"case",
"if",
"iss",
"has",
"many",
"client",
"ids",
"i",
".",
"e",
"in",
"case",
"of",
"{",
"...",
"You",
"may",
"skip",
"implementation",
"of",
"this",
"method",
"in",
"case",
"if",
"all",
"iss",
"in",
"your",
"config",
... | def find_deployment_by_params(self, iss, deployment_id, client_id, *args, **kwargs):
raise NotImplementedError | [
"def",
"find_deployment_by_params",
"(",
"self",
",",
"iss",
",",
"deployment_id",
",",
"client_id",
",",
"*",
"args",
",",
"**",
"kwargs",
")",
":",
"raise",
"NotImplementedError"
] | Find deployment in case if iss has many client ids, i.e
in case of { ... "iss": [ { ... "client_id: "client1" ... }, { ... "client_id: "client2" ... } ], ... } config. | [
"Find",
"deployment",
"in",
"case",
"if",
"iss",
"has",
"many",
"client",
"ids",
"i",
".",
"e",
"in",
"case",
"of",
"{",
"...",
"\"",
"iss",
"\"",
":",
"[",
"{",
"...",
"\"",
"client_id",
":",
"\"",
"client1",
"\"",
"...",
"}",
"{",
"...",
"\"",
... | [
"# type: (str, str, str, *None, **None) -> t.Optional[Deployment]",
"\"\"\"\n Find deployment in case if iss has many client ids, i.e\n in case of { ... \"iss\": [ { ... \"client_id: \"client1\" ... }, { ... \"client_id: \"client2\" ... } ], ... } config.\n\n You may skip implementation of th... | [
{
"param": "self",
"type": null
},
{
"param": "iss",
"type": null
},
{
"param": "deployment_id",
"type": null
},
{
"param": "client_id",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "iss",
"type": null,
"docstring": null,
"docstring_tokens": []... |
affa0c438a4d571ba8d6a44ad82916aad156e879 | saurabhkb/Energy-Efficient-Scheduling | local_search/local_search.py | [
"Apache-2.0"
] | Python | read_schedule_file | <not_specific> | def read_schedule_file(self, fname):
''' Expects a file with lines of the form "time:job1,job2,...".
This function reads this file and constructs the schedule in memory.
Then it looks at the schedule and sets to zero the capacities of timeslot-SINK edges
that are closed in the schedule. '''
schedule = [None ... | Expects a file with lines of the form "time:job1,job2,...".
This function reads this file and constructs the schedule in memory.
Then it looks at the schedule and sets to zero the capacities of timeslot-SINK edges
that are closed in the schedule. | Expects a file with lines of the form "time:job1,job2,...".
This function reads this file and constructs the schedule in memory.
Then it looks at the schedule and sets to zero the capacities of timeslot-SINK edges
that are closed in the schedule. | [
"Expects",
"a",
"file",
"with",
"lines",
"of",
"the",
"form",
"\"",
"time",
":",
"job1",
"job2",
"...",
"\"",
".",
"This",
"function",
"reads",
"this",
"file",
"and",
"constructs",
"the",
"schedule",
"in",
"memory",
".",
"Then",
"it",
"looks",
"at",
"t... | def read_schedule_file(self, fname):
schedule = [None for t in range(self.T)]
with open(fname) as f:
for line in f:
if len(line.strip()) == 0: continue
if line.strip().startswith("#"): continue
tok = line.strip().split(":")
slot_number = int(tok[0])
slot_jobs = tok[1].split(",")
schedule[... | [
"def",
"read_schedule_file",
"(",
"self",
",",
"fname",
")",
":",
"schedule",
"=",
"[",
"None",
"for",
"t",
"in",
"range",
"(",
"self",
".",
"T",
")",
"]",
"with",
"open",
"(",
"fname",
")",
"as",
"f",
":",
"for",
"line",
"in",
"f",
":",
"if",
... | Expects a file with lines of the form "time:job1,job2,...". | [
"Expects",
"a",
"file",
"with",
"lines",
"of",
"the",
"form",
"\"",
"time",
":",
"job1",
"job2",
"...",
"\"",
"."
] | [
"''' Expects a file with lines of the form \"time:job1,job2,...\".\n\t\tThis function reads this file and constructs the schedule in memory.\n\t\tThen it looks at the schedule and sets to zero the capacities of timeslot-SINK edges\n\t\tthat are closed in the schedule. '''",
"# t is closed so set the corresponding... | [
{
"param": "self",
"type": null
},
{
"param": "fname",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "fname",
"type": null,
"docstring": null,
"docstring_tokens": ... |
affa0c438a4d571ba8d6a44ad82916aad156e879 | saurabhkb/Energy-Efficient-Scheduling | local_search/local_search.py | [
"Apache-2.0"
] | Python | read_job_data | null | def read_job_data(self, fname, B):
''' expects a file with lines of the form "job_id release_time deadline processing_length".
This function reads this file and constructs a bipartite graph of jobs and timeslots for
future flow computations. '''
jobs = {}
with open(fname) as f:
for line in f:
if len(l... | expects a file with lines of the form "job_id release_time deadline processing_length".
This function reads this file and constructs a bipartite graph of jobs and timeslots for
future flow computations. | expects a file with lines of the form "job_id release_time deadline processing_length".
This function reads this file and constructs a bipartite graph of jobs and timeslots for
future flow computations. | [
"expects",
"a",
"file",
"with",
"lines",
"of",
"the",
"form",
"\"",
"job_id",
"release_time",
"deadline",
"processing_length",
"\"",
".",
"This",
"function",
"reads",
"this",
"file",
"and",
"constructs",
"a",
"bipartite",
"graph",
"of",
"jobs",
"and",
"timeslo... | def read_job_data(self, fname, B):
jobs = {}
with open(fname) as f:
for line in f:
if len(line.strip()) == 0: continue
if line.strip().startswith("#"): continue
job_id, r, d, p = line.strip().split()
jobs[job_id] = map(int, (r, d, p))
self.T = max([jobs[j][1] for j in jobs]) + 1
self.jobs = ... | [
"def",
"read_job_data",
"(",
"self",
",",
"fname",
",",
"B",
")",
":",
"jobs",
"=",
"{",
"}",
"with",
"open",
"(",
"fname",
")",
"as",
"f",
":",
"for",
"line",
"in",
"f",
":",
"if",
"len",
"(",
"line",
".",
"strip",
"(",
")",
")",
"==",
"0",
... | expects a file with lines of the form "job_id release_time deadline processing_length". | [
"expects",
"a",
"file",
"with",
"lines",
"of",
"the",
"form",
"\"",
"job_id",
"release_time",
"deadline",
"processing_length",
"\"",
"."
] | [
"''' expects a file with lines of the form \"job_id release_time deadline processing_length\".\n\t\tThis function reads this file and constructs a bipartite graph of jobs and timeslots for\n\t\tfuture flow computations. '''",
"# T = maximum deadline + 1. range = [0, T)",
"# add source and sink nodes",
"# add ... | [
{
"param": "self",
"type": null
},
{
"param": "fname",
"type": null
},
{
"param": "B",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "fname",
"type": null,
"docstring": null,
"docstring_tokens": ... |
affa0c438a4d571ba8d6a44ad82916aad156e879 | saurabhkb/Energy-Efficient-Scheduling | local_search/local_search.py | [
"Apache-2.0"
] | Python | find_minimal_feasible | <not_specific> | def find_minimal_feasible(self, blacklist=[]):
''' Tries to close down as many slots as possible until no longer possible.
But don't close the slots in blacklist. '''
slots_closed = []
for t in range(self.T):
if t in blacklist: continue
if self.g[t][self.SINK]['capacity'] == 0: continue
self.g[t][self.... | Tries to close down as many slots as possible until no longer possible.
But don't close the slots in blacklist. | Tries to close down as many slots as possible until no longer possible.
But don't close the slots in blacklist. | [
"Tries",
"to",
"close",
"down",
"as",
"many",
"slots",
"as",
"possible",
"until",
"no",
"longer",
"possible",
".",
"But",
"don",
"'",
"t",
"close",
"the",
"slots",
"in",
"blacklist",
"."
] | def find_minimal_feasible(self, blacklist=[]):
slots_closed = []
for t in range(self.T):
if t in blacklist: continue
if self.g[t][self.SINK]['capacity'] == 0: continue
self.g[t][self.SINK]['capacity'] = 0
if self.is_schedule_feasible():
slots_closed.append(t)
else:
self.g[t][self.SINK]['capac... | [
"def",
"find_minimal_feasible",
"(",
"self",
",",
"blacklist",
"=",
"[",
"]",
")",
":",
"slots_closed",
"=",
"[",
"]",
"for",
"t",
"in",
"range",
"(",
"self",
".",
"T",
")",
":",
"if",
"t",
"in",
"blacklist",
":",
"continue",
"if",
"self",
".",
"g"... | Tries to close down as many slots as possible until no longer possible. | [
"Tries",
"to",
"close",
"down",
"as",
"many",
"slots",
"as",
"possible",
"until",
"no",
"longer",
"possible",
"."
] | [
"''' Tries to close down as many slots as possible until no longer possible.\n\t\tBut don't close the slots in blacklist. '''"
] | [
{
"param": "self",
"type": null
},
{
"param": "blacklist",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "blacklist",
"type": null,
"docstring": null,
"docstring_token... |
affa0c438a4d571ba8d6a44ad82916aad156e879 | saurabhkb/Energy-Efficient-Scheduling | local_search/local_search.py | [
"Apache-2.0"
] | Python | local_b | null | def local_b(self, b):
''' applies the "open b, close > b" rule repeatedly until local optimum is reached. '''
schedule_changed = True
# These slots were opened in some close/open operation. They should not be closed again
# in a future close/open operation.
newly_opened_slots = set()
while schedule_changed... | applies the "open b, close > b" rule repeatedly until local optimum is reached. | applies the "open b, close > b" rule repeatedly until local optimum is reached. | [
"applies",
"the",
"\"",
"open",
"b",
"close",
">",
"b",
"\"",
"rule",
"repeatedly",
"until",
"local",
"optimum",
"is",
"reached",
"."
] | def local_b(self, b):
schedule_changed = True
newly_opened_slots = set()
while schedule_changed:
empty = []
active = []
for t in range(self.T):
if self.g.edge[t][self.SINK]['capacity'] == 0:
empty.append(t)
elif t not in newly_opened_slots:
active.append(t)
if len(empty) < b:
bre... | [
"def",
"local_b",
"(",
"self",
",",
"b",
")",
":",
"schedule_changed",
"=",
"True",
"newly_opened_slots",
"=",
"set",
"(",
")",
"while",
"schedule_changed",
":",
"empty",
"=",
"[",
"]",
"active",
"=",
"[",
"]",
"for",
"t",
"in",
"range",
"(",
"self",
... | applies the "open b, close > b" rule repeatedly until local optimum is reached. | [
"applies",
"the",
"\"",
"open",
"b",
"close",
">",
"b",
"\"",
"rule",
"repeatedly",
"until",
"local",
"optimum",
"is",
"reached",
"."
] | [
"''' applies the \"open b, close > b\" rule repeatedly until local optimum is reached. '''",
"# These slots were opened in some close/open operation. They should not be closed again",
"# in a future close/open operation.",
"# find set of closed slots",
"# Note that here we cannot simply open slots_to_open a... | [
{
"param": "self",
"type": null
},
{
"param": "b",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "b",
"type": null,
"docstring": null,
"docstring_tokens": [],
... |
affa0c438a4d571ba8d6a44ad82916aad156e879 | saurabhkb/Energy-Efficient-Scheduling | local_search/local_search.py | [
"Apache-2.0"
] | Python | print_schedule | null | def print_schedule(self):
''' helper method which prints out schedule in a nice way. '''
s = self.get_schedule()
num_open = len([1 for x in s if len(x) > 0])
print num_open
for t, tjobs in enumerate(s):
if tjobs != []:
print t, ":", ",".join(map(str, tjobs)) | helper method which prints out schedule in a nice way. | helper method which prints out schedule in a nice way. | [
"helper",
"method",
"which",
"prints",
"out",
"schedule",
"in",
"a",
"nice",
"way",
"."
] | def print_schedule(self):
s = self.get_schedule()
num_open = len([1 for x in s if len(x) > 0])
print num_open
for t, tjobs in enumerate(s):
if tjobs != []:
print t, ":", ",".join(map(str, tjobs)) | [
"def",
"print_schedule",
"(",
"self",
")",
":",
"s",
"=",
"self",
".",
"get_schedule",
"(",
")",
"num_open",
"=",
"len",
"(",
"[",
"1",
"for",
"x",
"in",
"s",
"if",
"len",
"(",
"x",
")",
">",
"0",
"]",
")",
"print",
"num_open",
"for",
"t",
",",... | helper method which prints out schedule in a nice way. | [
"helper",
"method",
"which",
"prints",
"out",
"schedule",
"in",
"a",
"nice",
"way",
"."
] | [
"''' helper method which prints out schedule in a nice way. '''"
] | [
{
"param": "self",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
d638647d0b1d8b79c705fd7b653af621d0228b38 | Michael-C-Kirk/Foodr | decode.py | [
"MIT"
] | Python | ratingParser | <not_specific> | def ratingParser(infoDict: dict, rating: int, price = 5):
'''
infoDict: Dictionary of restaurant information
rating: Int representing minimum restaraunt rating you prefer
return: list of rating sorted restaraunt info (dictionary containing all restaraunt data), list of restataunt basic info (name & image)
'''
par... |
infoDict: Dictionary of restaurant information
rating: Int representing minimum restaraunt rating you prefer
return: list of rating sorted restaraunt info (dictionary containing all restaraunt data), list of restataunt basic info (name & image)
| Dictionary of restaurant information
rating: Int representing minimum restaraunt rating you prefer
return: list of rating sorted restaraunt info (dictionary containing all restaraunt data), list of restataunt basic info (name & image) | [
"Dictionary",
"of",
"restaurant",
"information",
"rating",
":",
"Int",
"representing",
"minimum",
"restaraunt",
"rating",
"you",
"prefer",
"return",
":",
"list",
"of",
"rating",
"sorted",
"restaraunt",
"info",
"(",
"dictionary",
"containing",
"all",
"restaraunt",
... | def ratingParser(infoDict: dict, rating: int, price = 5):
parsedInfo = []
basicInfo = []
for place in infoDict['results']:
try:
if (place['rating'] >= rating and place['price_level'] <= price and place['opening_hours']['open_now'] == True):
parsedInfo.append(place)
photoURL = buildPhotoURL(place['photos... | [
"def",
"ratingParser",
"(",
"infoDict",
":",
"dict",
",",
"rating",
":",
"int",
",",
"price",
"=",
"5",
")",
":",
"parsedInfo",
"=",
"[",
"]",
"'''Contains parsed restaraunts name, rating and image url'''",
"basicInfo",
"=",
"[",
"]",
"for",
"place",
"in",
"in... | infoDict: Dictionary of restaurant information
rating: Int representing minimum restaraunt rating you prefer
return: list of rating sorted restaraunt info (dictionary containing all restaraunt data), list of restataunt basic info (name & image) | [
"infoDict",
":",
"Dictionary",
"of",
"restaurant",
"information",
"rating",
":",
"Int",
"representing",
"minimum",
"restaraunt",
"rating",
"you",
"prefer",
"return",
":",
"list",
"of",
"rating",
"sorted",
"restaraunt",
"info",
"(",
"dictionary",
"containing",
"all... | [
"'''\n\tinfoDict: Dictionary of restaurant information\n\trating: Int representing minimum restaraunt rating you prefer\n\treturn: list of rating sorted restaraunt info (dictionary containing all restaraunt data), list of restataunt basic info (name & image)\n\t'''",
"'''Contains parsed restaraunts name, rating a... | [
{
"param": "infoDict",
"type": "dict"
},
{
"param": "rating",
"type": "int"
},
{
"param": "price",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "infoDict",
"type": "dict",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "rating",
"type": "int",
"docstring": null,
"docstring_t... |
d638647d0b1d8b79c705fd7b653af621d0228b38 | Michael-C-Kirk/Foodr | decode.py | [
"MIT"
] | Python | priceParser | <not_specific> | def priceParser(infoDict: dict, price: int):
'''
infoDict: Dictionary of restaurant information
rating: Int representing minimum restaraunt rating you prefer
return: list of price sorted restaraunt info (dictionary containing all restaraunt data), list of restataunt basic info (name & image)
'''
parsedInfo = []
... |
infoDict: Dictionary of restaurant information
rating: Int representing minimum restaraunt rating you prefer
return: list of price sorted restaraunt info (dictionary containing all restaraunt data), list of restataunt basic info (name & image)
| Dictionary of restaurant information
rating: Int representing minimum restaraunt rating you prefer
return: list of price sorted restaraunt info (dictionary containing all restaraunt data), list of restataunt basic info (name & image) | [
"Dictionary",
"of",
"restaurant",
"information",
"rating",
":",
"Int",
"representing",
"minimum",
"restaraunt",
"rating",
"you",
"prefer",
"return",
":",
"list",
"of",
"price",
"sorted",
"restaraunt",
"info",
"(",
"dictionary",
"containing",
"all",
"restaraunt",
"... | def priceParser(infoDict: dict, price: int):
parsedInfo = []
basicInfo = []
for place in infoDict['results']:
try:
if (place['price_level'] <= price and place['opening_hours']['open_now'] == True):
parsedInfo.append(place)
photoURL = buildPhotoURL(place['photos'][0]['photo_reference'], 500)
basicInf... | [
"def",
"priceParser",
"(",
"infoDict",
":",
"dict",
",",
"price",
":",
"int",
")",
":",
"parsedInfo",
"=",
"[",
"]",
"'''Contains parsed restaraunts name, rating and image url'''",
"basicInfo",
"=",
"[",
"]",
"for",
"place",
"in",
"infoDict",
"[",
"'results'",
"... | infoDict: Dictionary of restaurant information
rating: Int representing minimum restaraunt rating you prefer
return: list of price sorted restaraunt info (dictionary containing all restaraunt data), list of restataunt basic info (name & image) | [
"infoDict",
":",
"Dictionary",
"of",
"restaurant",
"information",
"rating",
":",
"Int",
"representing",
"minimum",
"restaraunt",
"rating",
"you",
"prefer",
"return",
":",
"list",
"of",
"price",
"sorted",
"restaraunt",
"info",
"(",
"dictionary",
"containing",
"all"... | [
"'''\n\tinfoDict: Dictionary of restaurant information\n\trating: Int representing minimum restaraunt rating you prefer\n\treturn: list of price sorted restaraunt info (dictionary containing all restaraunt data), list of restataunt basic info (name & image)\n\t'''",
"'''Contains parsed restaraunts name, rating an... | [
{
"param": "infoDict",
"type": "dict"
},
{
"param": "price",
"type": "int"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "infoDict",
"type": "dict",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "price",
"type": "int",
"docstring": null,
"docstring_to... |
a52f24e880faaeebabef65a93ff920cf050cdbf3 | Michael-C-Kirk/Foodr | decision_tree.py | [
"MIT"
] | Python | prediction | <not_specific> | def prediction(clf: "classifier object", data: {'Time': int, 'Mood':int, 'Age':int}):
'''Takes in a classifier and dict of data and outputs a number that represents
the type of food they would want'''
d=[[data['Time'],data['Mood'], data['Age']]]
return clf.predict(d) | Takes in a classifier and dict of data and outputs a number that represents
the type of food they would want | Takes in a classifier and dict of data and outputs a number that represents
the type of food they would want | [
"Takes",
"in",
"a",
"classifier",
"and",
"dict",
"of",
"data",
"and",
"outputs",
"a",
"number",
"that",
"represents",
"the",
"type",
"of",
"food",
"they",
"would",
"want"
] | def prediction(clf: "classifier object", data: {'Time': int, 'Mood':int, 'Age':int}):
d=[[data['Time'],data['Mood'], data['Age']]]
return clf.predict(d) | [
"def",
"prediction",
"(",
"clf",
":",
"\"classifier object\"",
",",
"data",
":",
"{",
"'Time'",
":",
"int",
",",
"'Mood'",
":",
"int",
",",
"'Age'",
":",
"int",
"}",
")",
":",
"d",
"=",
"[",
"[",
"data",
"[",
"'Time'",
"]",
",",
"data",
"[",
"'Mo... | Takes in a classifier and dict of data and outputs a number that represents
the type of food they would want | [
"Takes",
"in",
"a",
"classifier",
"and",
"dict",
"of",
"data",
"and",
"outputs",
"a",
"number",
"that",
"represents",
"the",
"type",
"of",
"food",
"they",
"would",
"want"
] | [
"'''Takes in a classifier and dict of data and outputs a number that represents\n the type of food they would want'''"
] | [
{
"param": "clf",
"type": "\"classifier object\""
},
{
"param": "data",
"type": "{'Time': int, 'Mood':int, 'Age':int}"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "clf",
"type": "\"classifier object\"",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "data",
"type": "{'Time': int, 'Mood':int, 'Age':int}",
... |
5e960fbe0069f7bf9c45351051a79c15b59e8603 | Michael-C-Kirk/Foodr | data_update.py | [
"MIT"
] | Python | update_data_set | null | def update_data_set(text_file_name:str, data:{'Time':int, "Mood":int, "Age":int}, class_res:int):
'''Given a text file name and data, it will open the text file
and update the file with new data in format "int,int,int" '''
file = open(text_file_name, "a")
elements_for_data_input=["\n",
... | Given a text file name and data, it will open the text file
and update the file with new data in format "int,int,int" | Given a text file name and data, it will open the text file
and update the file with new data in format "int,int,int" | [
"Given",
"a",
"text",
"file",
"name",
"and",
"data",
"it",
"will",
"open",
"the",
"text",
"file",
"and",
"update",
"the",
"file",
"with",
"new",
"data",
"in",
"format",
"\"",
"int",
"int",
"int",
"\""
] | def update_data_set(text_file_name:str, data:{'Time':int, "Mood":int, "Age":int}, class_res:int):
file = open(text_file_name, "a")
elements_for_data_input=["\n",
data['Time'],
',',
data['Mood'],
'... | [
"def",
"update_data_set",
"(",
"text_file_name",
":",
"str",
",",
"data",
":",
"{",
"'Time'",
":",
"int",
",",
"\"Mood\"",
":",
"int",
",",
"\"Age\"",
":",
"int",
"}",
",",
"class_res",
":",
"int",
")",
":",
"file",
"=",
"open",
"(",
"text_file_name",
... | Given a text file name and data, it will open the text file
and update the file with new data in format "int,int,int" | [
"Given",
"a",
"text",
"file",
"name",
"and",
"data",
"it",
"will",
"open",
"the",
"text",
"file",
"and",
"update",
"the",
"file",
"with",
"new",
"data",
"in",
"format",
"\"",
"int",
"int",
"int",
"\""
] | [
"'''Given a text file name and data, it will open the text file \n and update the file with new data in format \"int,int,int\" '''"
] | [
{
"param": "text_file_name",
"type": "str"
},
{
"param": "data",
"type": "{'Time':int, \"Mood\":int, \"Age\":int}"
},
{
"param": "class_res",
"type": "int"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "text_file_name",
"type": "str",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "data",
"type": "{'Time':int, \"Mood\":int, \"Age\":int}",
... |
28fa43bc3f97b20d0f1b061782d08e672ea8480c | Michael-C-Kirk/Foodr | parser.py | [
"MIT"
] | Python | ratingParser | <not_specific> | def ratingParser(infoDict: dict, rating: int):
'''
infoDict: Dictionary of restaurant information
rating: Int representing minimum restaraunt rating you prefer
return: list of rating sorted restaraunt info (dictionary containing all restaraunt data), list of restataunt basic info (name & image)
'''
parsedInfo = [... |
infoDict: Dictionary of restaurant information
rating: Int representing minimum restaraunt rating you prefer
return: list of rating sorted restaraunt info (dictionary containing all restaraunt data), list of restataunt basic info (name & image)
| Dictionary of restaurant information
rating: Int representing minimum restaraunt rating you prefer
return: list of rating sorted restaraunt info (dictionary containing all restaraunt data), list of restataunt basic info (name & image) | [
"Dictionary",
"of",
"restaurant",
"information",
"rating",
":",
"Int",
"representing",
"minimum",
"restaraunt",
"rating",
"you",
"prefer",
"return",
":",
"list",
"of",
"rating",
"sorted",
"restaraunt",
"info",
"(",
"dictionary",
"containing",
"all",
"restaraunt",
... | def ratingParser(infoDict: dict, rating: int):
parsedInfo = []
basicInfo = []
for place in infoDict['results']:
try:
if (place['rating'] >= rating):
parsedInfo.append(place)
photoURL = buildPhotoURL(place['photos'][0]['photo_reference'], 500)
basicInfo.append((place['name'], place['rating'], photoUR... | [
"def",
"ratingParser",
"(",
"infoDict",
":",
"dict",
",",
"rating",
":",
"int",
")",
":",
"parsedInfo",
"=",
"[",
"]",
"'''Contains parsed restaraunts name, rating and image url'''",
"basicInfo",
"=",
"[",
"]",
"for",
"place",
"in",
"infoDict",
"[",
"'results'",
... | infoDict: Dictionary of restaurant information
rating: Int representing minimum restaraunt rating you prefer
return: list of rating sorted restaraunt info (dictionary containing all restaraunt data), list of restataunt basic info (name & image) | [
"infoDict",
":",
"Dictionary",
"of",
"restaurant",
"information",
"rating",
":",
"Int",
"representing",
"minimum",
"restaraunt",
"rating",
"you",
"prefer",
"return",
":",
"list",
"of",
"rating",
"sorted",
"restaraunt",
"info",
"(",
"dictionary",
"containing",
"all... | [
"'''\n\tinfoDict: Dictionary of restaurant information\n\trating: Int representing minimum restaraunt rating you prefer\n\treturn: list of rating sorted restaraunt info (dictionary containing all restaraunt data), list of restataunt basic info (name & image)\n\t'''",
"'''Contains parsed restaraunts name, rating a... | [
{
"param": "infoDict",
"type": "dict"
},
{
"param": "rating",
"type": "int"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "infoDict",
"type": "dict",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "rating",
"type": "int",
"docstring": null,
"docstring_t... |
28fa43bc3f97b20d0f1b061782d08e672ea8480c | Michael-C-Kirk/Foodr | parser.py | [
"MIT"
] | Python | priceParser | <not_specific> | def priceParser(infoDict: dict, price: int):
'''
infoDict: Dictionary of restaurant information
rating: Int representing minimum restaraunt rating you prefer
return: list of price sorted restaraunt info (dictionary containing all restaraunt data), list of restataunt basic info (name & image)
'''
parsedInfo = []
... |
infoDict: Dictionary of restaurant information
rating: Int representing minimum restaraunt rating you prefer
return: list of price sorted restaraunt info (dictionary containing all restaraunt data), list of restataunt basic info (name & image)
| Dictionary of restaurant information
rating: Int representing minimum restaraunt rating you prefer
return: list of price sorted restaraunt info (dictionary containing all restaraunt data), list of restataunt basic info (name & image) | [
"Dictionary",
"of",
"restaurant",
"information",
"rating",
":",
"Int",
"representing",
"minimum",
"restaraunt",
"rating",
"you",
"prefer",
"return",
":",
"list",
"of",
"price",
"sorted",
"restaraunt",
"info",
"(",
"dictionary",
"containing",
"all",
"restaraunt",
"... | def priceParser(infoDict: dict, price: int):
parsedInfo = []
basicInfo = []
for place in infoDict['results']:
try:
if (place['price_level'] <= price):
parsedInfo.append(place)
photoURL = buildPhotoURL(place['photos'][0]['photo_reference'], 500)
basicInfo.append((place['name'], place['rating'], photo... | [
"def",
"priceParser",
"(",
"infoDict",
":",
"dict",
",",
"price",
":",
"int",
")",
":",
"parsedInfo",
"=",
"[",
"]",
"'''Contains parsed restaraunts name, rating and image url'''",
"basicInfo",
"=",
"[",
"]",
"for",
"place",
"in",
"infoDict",
"[",
"'results'",
"... | infoDict: Dictionary of restaurant information
rating: Int representing minimum restaraunt rating you prefer
return: list of price sorted restaraunt info (dictionary containing all restaraunt data), list of restataunt basic info (name & image) | [
"infoDict",
":",
"Dictionary",
"of",
"restaurant",
"information",
"rating",
":",
"Int",
"representing",
"minimum",
"restaraunt",
"rating",
"you",
"prefer",
"return",
":",
"list",
"of",
"price",
"sorted",
"restaraunt",
"info",
"(",
"dictionary",
"containing",
"all"... | [
"'''\n\tinfoDict: Dictionary of restaurant information\n\trating: Int representing minimum restaraunt rating you prefer\n\treturn: list of price sorted restaraunt info (dictionary containing all restaraunt data), list of restataunt basic info (name & image)\n\t'''",
"'''Contains parsed restaraunts name, rating an... | [
{
"param": "infoDict",
"type": "dict"
},
{
"param": "price",
"type": "int"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "infoDict",
"type": "dict",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "price",
"type": "int",
"docstring": null,
"docstring_to... |
5a8a2d3c602e6ed97597810371dca0c71f0e8c37 | BdVade/Voting | Rewards2/teepy_rewards2/scrapper.py | [
"Apache-2.0"
] | Python | _algoscan | List | def _algoscan(self, address: str, pages: Union[int, None]=None) -> List:
"""
Makes a request to algoScan API to fetch transaction data for the given address.
Args:
- address: desired address for transaction data
- pages: desired number of pages for response[can be skippe... |
Makes a request to algoScan API to fetch transaction data for the given address.
Args:
- address: desired address for transaction data
- pages: desired number of pages for response[can be skipped to fetch all pages]
Returns:
- List[{}]: A list of transaction... | Makes a request to algoScan API to fetch transaction data for the given address. | [
"Makes",
"a",
"request",
"to",
"algoScan",
"API",
"to",
"fetch",
"transaction",
"data",
"for",
"the",
"given",
"address",
"."
] | def _algoscan(self, address: str, pages: Union[int, None]=None) -> List:
data = []
offset = 0
page = 0
while True:
if pages:
if page == pages:
break
res = requests.get(f"{self.api_base_url}{address}?offset={offset}")
... | [
"def",
"_algoscan",
"(",
"self",
",",
"address",
":",
"str",
",",
"pages",
":",
"Union",
"[",
"int",
",",
"None",
"]",
"=",
"None",
")",
"->",
"List",
":",
"data",
"=",
"[",
"]",
"offset",
"=",
"0",
"page",
"=",
"0",
"while",
"True",
":",
"if",... | Makes a request to algoScan API to fetch transaction data for the given address. | [
"Makes",
"a",
"request",
"to",
"algoScan",
"API",
"to",
"fetch",
"transaction",
"data",
"for",
"the",
"given",
"address",
"."
] | [
"\"\"\"\n Makes a request to algoScan API to fetch transaction data for the given address.\n\n Args:\n - address: desired address for transaction data\n - pages: desired number of pages for response[can be skipped to fetch all pages]\n Returns:\n - List[{}]: A l... | [
{
"param": "self",
"type": null
},
{
"param": "address",
"type": "str"
},
{
"param": "pages",
"type": "Union[int, None]"
}
] | {
"returns": [
{
"docstring": "A list of transaction data for the given address",
"docstring_tokens": [
"A",
"list",
"of",
"transaction",
"data",
"for",
"the",
"given",
"address"
],
"type": "- List[{}]"
}
],
"r... |
5a8a2d3c602e6ed97597810371dca0c71f0e8c37 | BdVade/Voting | Rewards2/teepy_rewards2/scrapper.py | [
"Apache-2.0"
] | Python | _algoexplorer | <not_specific> | def _algoexplorer(self, address: str, pages: Union[int, None]=None):
"""
Makes a request to algoExplorer API to fetch transaction data for the given address.
Args:
- address: desired address for transaction data
- pages: desired number of pages for response[can be skippe... |
Makes a request to algoExplorer API to fetch transaction data for the given address.
Args:
- address: desired address for transaction data
- pages: desired number of pages for response[can be skipped to fetch all pages]
Returns:
- List[{}]: A list of transac... | Makes a request to algoExplorer API to fetch transaction data for the given address. | [
"Makes",
"a",
"request",
"to",
"algoExplorer",
"API",
"to",
"fetch",
"transaction",
"data",
"for",
"the",
"given",
"address",
"."
] | def _algoexplorer(self, address: str, pages: Union[int, None]=None):
page = 1
limit = 50
data = []
while True:
if pages:
if page == pages:
break
url = f"{self.api_base_url}?page={page}&limit={limit}&address={address}"
... | [
"def",
"_algoexplorer",
"(",
"self",
",",
"address",
":",
"str",
",",
"pages",
":",
"Union",
"[",
"int",
",",
"None",
"]",
"=",
"None",
")",
":",
"page",
"=",
"1",
"limit",
"=",
"50",
"data",
"=",
"[",
"]",
"while",
"True",
":",
"if",
"pages",
... | Makes a request to algoExplorer API to fetch transaction data for the given address. | [
"Makes",
"a",
"request",
"to",
"algoExplorer",
"API",
"to",
"fetch",
"transaction",
"data",
"for",
"the",
"given",
"address",
"."
] | [
"\"\"\"\n Makes a request to algoExplorer API to fetch transaction data for the given address.\n\n Args:\n - address: desired address for transaction data\n - pages: desired number of pages for response[can be skipped to fetch all pages]\n Returns:\n - List[{}]:... | [
{
"param": "self",
"type": null
},
{
"param": "address",
"type": "str"
},
{
"param": "pages",
"type": "Union[int, None]"
}
] | {
"returns": [
{
"docstring": "A list of transaction data for the given address",
"docstring_tokens": [
"A",
"list",
"of",
"transaction",
"data",
"for",
"the",
"given",
"address"
],
"type": "- List[{}]"
}
],
"r... |
5a8a2d3c602e6ed97597810371dca0c71f0e8c37 | BdVade/Voting | Rewards2/teepy_rewards2/scrapper.py | [
"Apache-2.0"
] | Python | _algoexplorer | <not_specific> | def _algoexplorer(self, address, pages=None):
"""
Scrapes AlgoExplorer.io To fetch transaction data for Address.
Args:
- address: desired address for transaction data
- pages: desired number of pages for response[can be skipped to fetch all pages]
Returns:
... |
Scrapes AlgoExplorer.io To fetch transaction data for Address.
Args:
- address: desired address for transaction data
- pages: desired number of pages for response[can be skipped to fetch all pages]
Returns:
- List[{}]: A list of transaction data for the give... | Scrapes AlgoExplorer.io To fetch transaction data for Address. | [
"Scrapes",
"AlgoExplorer",
".",
"io",
"To",
"fetch",
"transaction",
"data",
"for",
"Address",
"."
] | def _algoexplorer(self, address, pages=None):
data = []
self.browser.get(f"{self.web_base_url}{address}")
rows = self.browser.find_elements(by=By.TAG_NAME, value='tr')
last_page = self.browser.find_element(By.CLASS_NAME, value="styles_pagination-container__i_fkI")
last_page = re.... | [
"def",
"_algoexplorer",
"(",
"self",
",",
"address",
",",
"pages",
"=",
"None",
")",
":",
"data",
"=",
"[",
"]",
"self",
".",
"browser",
".",
"get",
"(",
"f\"{self.web_base_url}{address}\"",
")",
"rows",
"=",
"self",
".",
"browser",
".",
"find_elements",
... | Scrapes AlgoExplorer.io To fetch transaction data for Address. | [
"Scrapes",
"AlgoExplorer",
".",
"io",
"To",
"fetch",
"transaction",
"data",
"for",
"Address",
"."
] | [
"\"\"\"\n Scrapes AlgoExplorer.io To fetch transaction data for Address.\n\n Args:\n - address: desired address for transaction data\n - pages: desired number of pages for response[can be skipped to fetch all pages]\n Returns:\n - List[{}]: A list of transaction... | [
{
"param": "self",
"type": null
},
{
"param": "address",
"type": null
},
{
"param": "pages",
"type": null
}
] | {
"returns": [
{
"docstring": "A list of transaction data for the given address",
"docstring_tokens": [
"A",
"list",
"of",
"transaction",
"data",
"for",
"the",
"given",
"address"
],
"type": "- List[{}]"
}
],
"r... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.