partition
stringclasses
3 values
func_name
stringlengths
1
134
docstring
stringlengths
1
46.9k
path
stringlengths
4
223
original_string
stringlengths
75
104k
code
stringlengths
75
104k
docstring_tokens
listlengths
1
1.97k
repo
stringlengths
7
55
language
stringclasses
1 value
url
stringlengths
87
315
code_tokens
listlengths
19
28.4k
sha
stringlengths
40
40
train
_non_local_part
Yields non-local operation of KAK decomposition.
cirq/ion/ion_decomposition.py
def _non_local_part(q0: ops.Qid, q1: ops.Qid, interaction_coefficients: Tuple[float, float, float], atol: float = 1e-8): """Yields non-local operation of KAK decomposition.""" x, y, z = interaction_coefficients return [ _parity_interactio...
def _non_local_part(q0: ops.Qid, q1: ops.Qid, interaction_coefficients: Tuple[float, float, float], atol: float = 1e-8): """Yields non-local operation of KAK decomposition.""" x, y, z = interaction_coefficients return [ _parity_interactio...
[ "Yields", "non", "-", "local", "operation", "of", "KAK", "decomposition", "." ]
quantumlib/Cirq
python
https://github.com/quantumlib/Cirq/blob/0827da80dd7880e5b923eb69407e980ed9bc0bd2/cirq/ion/ion_decomposition.py#L114-L125
[ "def", "_non_local_part", "(", "q0", ":", "ops", ".", "Qid", ",", "q1", ":", "ops", ".", "Qid", ",", "interaction_coefficients", ":", "Tuple", "[", "float", ",", "float", ",", "float", "]", ",", "atol", ":", "float", "=", "1e-8", ")", ":", "x", ","...
0827da80dd7880e5b923eb69407e980ed9bc0bd2
train
ParamResolver.value_of
Attempt to resolve a Symbol or name or float to its assigned value. If unable to resolve a sympy.Symbol, returns it unchanged. If unable to resolve a name, returns a sympy.Symbol with that name. Args: value: The sympy.Symbol or name or float to try to resolve into just ...
cirq/study/resolver.py
def value_of( self, value: Union[sympy.Basic, float, str] ) -> Union[sympy.Basic, float]: """Attempt to resolve a Symbol or name or float to its assigned value. If unable to resolve a sympy.Symbol, returns it unchanged. If unable to resolve a name, returns a sympy.Sy...
def value_of( self, value: Union[sympy.Basic, float, str] ) -> Union[sympy.Basic, float]: """Attempt to resolve a Symbol or name or float to its assigned value. If unable to resolve a sympy.Symbol, returns it unchanged. If unable to resolve a name, returns a sympy.Sy...
[ "Attempt", "to", "resolve", "a", "Symbol", "or", "name", "or", "float", "to", "its", "assigned", "value", "." ]
quantumlib/Cirq
python
https://github.com/quantumlib/Cirq/blob/0827da80dd7880e5b923eb69407e980ed9bc0bd2/cirq/study/resolver.py#L57-L84
[ "def", "value_of", "(", "self", ",", "value", ":", "Union", "[", "sympy", ".", "Basic", ",", "float", ",", "str", "]", ")", "->", "Union", "[", "sympy", ".", "Basic", ",", "float", "]", ":", "if", "isinstance", "(", "value", ",", "str", ")", ":",...
0827da80dd7880e5b923eb69407e980ed9bc0bd2
train
value_equality
Implements __eq__/__ne__/__hash__ via a _value_equality_values_ method. _value_equality_values_ is a method that the decorated class must implement. _value_equality_approximate_values_ is a method that the decorated class might implement if special support for approximate equality is required. This is...
cirq/value/value_equality.py
def value_equality(cls: type = None, *, unhashable: bool = False, distinct_child_types: bool = False, manual_cls: bool = False, approximate: bool = False ) -> Union[Callable[[type], type], type]: """Impl...
def value_equality(cls: type = None, *, unhashable: bool = False, distinct_child_types: bool = False, manual_cls: bool = False, approximate: bool = False ) -> Union[Callable[[type], type], type]: """Impl...
[ "Implements", "__eq__", "/", "__ne__", "/", "__hash__", "via", "a", "_value_equality_values_", "method", "." ]
quantumlib/Cirq
python
https://github.com/quantumlib/Cirq/blob/0827da80dd7880e5b923eb69407e980ed9bc0bd2/cirq/value/value_equality.py#L135-L223
[ "def", "value_equality", "(", "cls", ":", "type", "=", "None", ",", "*", ",", "unhashable", ":", "bool", "=", "False", ",", "distinct_child_types", ":", "bool", "=", "False", ",", "manual_cls", ":", "bool", "=", "False", ",", "approximate", ":", "bool", ...
0827da80dd7880e5b923eb69407e980ed9bc0bd2
train
diff_to_new_interesting_lines
Extracts a set of 'interesting' lines out of a GNU unified diff format. Format: gnu.org/software/diffutils/manual/html_node/Detailed-Unified.html @@ from-line-numbers to-line-numbers @@ line-from-either-file ... @@ start,count start,count @@ line-from-either-file ...
dev_tools/incremental_coverage.py
def diff_to_new_interesting_lines(unified_diff_lines: List[str] ) -> Dict[int, str]: """ Extracts a set of 'interesting' lines out of a GNU unified diff format. Format: gnu.org/software/diffutils/manual/html_node/Detailed-Unified.html @@ from-line-numbers to-l...
def diff_to_new_interesting_lines(unified_diff_lines: List[str] ) -> Dict[int, str]: """ Extracts a set of 'interesting' lines out of a GNU unified diff format. Format: gnu.org/software/diffutils/manual/html_node/Detailed-Unified.html @@ from-line-numbers to-l...
[ "Extracts", "a", "set", "of", "interesting", "lines", "out", "of", "a", "GNU", "unified", "diff", "format", "." ]
quantumlib/Cirq
python
https://github.com/quantumlib/Cirq/blob/0827da80dd7880e5b923eb69407e980ed9bc0bd2/dev_tools/incremental_coverage.py#L48-L105
[ "def", "diff_to_new_interesting_lines", "(", "unified_diff_lines", ":", "List", "[", "str", "]", ")", "->", "Dict", "[", "int", ",", "str", "]", ":", "interesting_lines", "=", "dict", "(", ")", "for", "diff_line", "in", "unified_diff_lines", ":", "# Parse the ...
0827da80dd7880e5b923eb69407e980ed9bc0bd2
train
get_incremental_uncovered_lines
Uses git diff and the annotation files created by `pytest --cov-report annotate` to find touched but uncovered lines in the given file. Args: abs_path: The path of a file to look for uncovered lines in. base_commit: Old state to diff against. actual_commit: Current state. Use None t...
dev_tools/incremental_coverage.py
def get_incremental_uncovered_lines(abs_path: str, base_commit: str, actual_commit: Optional[str] ) -> List[Tuple[int, str, str]]: """ Uses git diff and the annotation files created by `pytest --cov-r...
def get_incremental_uncovered_lines(abs_path: str, base_commit: str, actual_commit: Optional[str] ) -> List[Tuple[int, str, str]]: """ Uses git diff and the annotation files created by `pytest --cov-r...
[ "Uses", "git", "diff", "and", "the", "annotation", "files", "created", "by", "pytest", "--", "cov", "-", "report", "annotate", "to", "find", "touched", "but", "uncovered", "lines", "in", "the", "given", "file", "." ]
quantumlib/Cirq
python
https://github.com/quantumlib/Cirq/blob/0827da80dd7880e5b923eb69407e980ed9bc0bd2/dev_tools/incremental_coverage.py#L115-L162
[ "def", "get_incremental_uncovered_lines", "(", "abs_path", ":", "str", ",", "base_commit", ":", "str", ",", "actual_commit", ":", "Optional", "[", "str", "]", ")", "->", "List", "[", "Tuple", "[", "int", ",", "str", ",", "str", "]", "]", ":", "# Deleted ...
0827da80dd7880e5b923eb69407e980ed9bc0bd2
train
line_content_counts_as_uncovered_manual
Args: content: A line with indentation and tail comments/space removed. Returns: Whether the line could be included in the coverage report.
dev_tools/incremental_coverage.py
def line_content_counts_as_uncovered_manual(content: str) -> bool: """ Args: content: A line with indentation and tail comments/space removed. Returns: Whether the line could be included in the coverage report. """ # Omit empty lines. if not content: return False # ...
def line_content_counts_as_uncovered_manual(content: str) -> bool: """ Args: content: A line with indentation and tail comments/space removed. Returns: Whether the line could be included in the coverage report. """ # Omit empty lines. if not content: return False # ...
[ "Args", ":", "content", ":", "A", "line", "with", "indentation", "and", "tail", "comments", "/", "space", "removed", "." ]
quantumlib/Cirq
python
https://github.com/quantumlib/Cirq/blob/0827da80dd7880e5b923eb69407e980ed9bc0bd2/dev_tools/incremental_coverage.py#L165-L183
[ "def", "line_content_counts_as_uncovered_manual", "(", "content", ":", "str", ")", "->", "bool", ":", "# Omit empty lines.", "if", "not", "content", ":", "return", "False", "# Omit declarations.", "for", "keyword", "in", "[", "'def'", ",", "'class'", "]", ":", "...
0827da80dd7880e5b923eb69407e980ed9bc0bd2
train
line_counts_as_uncovered
Args: line: The line of code (including coverage annotation). is_from_cover_annotation_file: Whether this line has been annotated. Returns: Does the line count as uncovered?
dev_tools/incremental_coverage.py
def line_counts_as_uncovered(line: str, is_from_cover_annotation_file: bool) -> bool: """ Args: line: The line of code (including coverage annotation). is_from_cover_annotation_file: Whether this line has been annotated. Returns: Does the line count as un...
def line_counts_as_uncovered(line: str, is_from_cover_annotation_file: bool) -> bool: """ Args: line: The line of code (including coverage annotation). is_from_cover_annotation_file: Whether this line has been annotated. Returns: Does the line count as un...
[ "Args", ":", "line", ":", "The", "line", "of", "code", "(", "including", "coverage", "annotation", ")", ".", "is_from_cover_annotation_file", ":", "Whether", "this", "line", "has", "been", "annotated", ".", "Returns", ":", "Does", "the", "line", "count", "as...
quantumlib/Cirq
python
https://github.com/quantumlib/Cirq/blob/0827da80dd7880e5b923eb69407e980ed9bc0bd2/dev_tools/incremental_coverage.py#L222-L255
[ "def", "line_counts_as_uncovered", "(", "line", ":", "str", ",", "is_from_cover_annotation_file", ":", "bool", ")", "->", "bool", ":", "# Ignore this line?", "if", "is_from_cover_annotation_file", ":", "# Already covered, or the tool deemed it not relevant for coverage.", "if",...
0827da80dd7880e5b923eb69407e980ed9bc0bd2
train
is_applicable_python_file
Determines if a file should be included in incremental coverage analysis. Args: rel_path: The repo-relative file path being considered. Returns: Whether to include the file.
dev_tools/incremental_coverage.py
def is_applicable_python_file(rel_path: str) -> bool: """ Determines if a file should be included in incremental coverage analysis. Args: rel_path: The repo-relative file path being considered. Returns: Whether to include the file. """ return (rel_path.endswith('.py') and ...
def is_applicable_python_file(rel_path: str) -> bool: """ Determines if a file should be included in incremental coverage analysis. Args: rel_path: The repo-relative file path being considered. Returns: Whether to include the file. """ return (rel_path.endswith('.py') and ...
[ "Determines", "if", "a", "file", "should", "be", "included", "in", "incremental", "coverage", "analysis", "." ]
quantumlib/Cirq
python
https://github.com/quantumlib/Cirq/blob/0827da80dd7880e5b923eb69407e980ed9bc0bd2/dev_tools/incremental_coverage.py#L258-L268
[ "def", "is_applicable_python_file", "(", "rel_path", ":", "str", ")", "->", "bool", ":", "return", "(", "rel_path", ".", "endswith", "(", "'.py'", ")", "and", "not", "any", "(", "re", ".", "search", "(", "pat", ",", "rel_path", ")", "for", "pat", "in",...
0827da80dd7880e5b923eb69407e980ed9bc0bd2
train
_approximate_common_period
Finds a value that is nearly an integer multiple of multiple periods. The returned value should be the smallest non-negative number with this property. If `approx_denom` is too small the computation can fail to satisfy the `reject_atol` criteria and return `None`. This is actually desirable behavior, s...
cirq/ops/eigen_gate.py
def _approximate_common_period(periods: List[float], approx_denom: int = 60, reject_atol: float = 1e-8) -> Optional[float]: """Finds a value that is nearly an integer multiple of multiple periods. The returned value should be the smallest non-negati...
def _approximate_common_period(periods: List[float], approx_denom: int = 60, reject_atol: float = 1e-8) -> Optional[float]: """Finds a value that is nearly an integer multiple of multiple periods. The returned value should be the smallest non-negati...
[ "Finds", "a", "value", "that", "is", "nearly", "an", "integer", "multiple", "of", "multiple", "periods", "." ]
quantumlib/Cirq
python
https://github.com/quantumlib/Cirq/blob/0827da80dd7880e5b923eb69407e980ed9bc0bd2/cirq/ops/eigen_gate.py#L330-L374
[ "def", "_approximate_common_period", "(", "periods", ":", "List", "[", "float", "]", ",", "approx_denom", ":", "int", "=", "60", ",", "reject_atol", ":", "float", "=", "1e-8", ")", "->", "Optional", "[", "float", "]", ":", "if", "not", "periods", ":", ...
0827da80dd7880e5b923eb69407e980ed9bc0bd2
train
_common_rational_period
Finds the least common integer multiple of some fractions. The solution is the smallest positive integer c such that there exists integers n_k satisfying p_k * n_k = c for all k.
cirq/ops/eigen_gate.py
def _common_rational_period(rational_periods: List[fractions.Fraction] ) -> fractions.Fraction: """Finds the least common integer multiple of some fractions. The solution is the smallest positive integer c such that there exists integers n_k satisfying p_k * n_k = c for all k. ...
def _common_rational_period(rational_periods: List[fractions.Fraction] ) -> fractions.Fraction: """Finds the least common integer multiple of some fractions. The solution is the smallest positive integer c such that there exists integers n_k satisfying p_k * n_k = c for all k. ...
[ "Finds", "the", "least", "common", "integer", "multiple", "of", "some", "fractions", "." ]
quantumlib/Cirq
python
https://github.com/quantumlib/Cirq/blob/0827da80dd7880e5b923eb69407e980ed9bc0bd2/cirq/ops/eigen_gate.py#L377-L389
[ "def", "_common_rational_period", "(", "rational_periods", ":", "List", "[", "fractions", ".", "Fraction", "]", ")", "->", "fractions", ".", "Fraction", ":", "assert", "rational_periods", ",", "\"no well-defined solution for an empty list\"", "common_denom", "=", "_lcm"...
0827da80dd7880e5b923eb69407e980ed9bc0bd2
train
LabelEncoder.fit
Fit label encoder Parameters ---------- y : array-like of shape (n_samples,) Target values. Returns ------- self : returns an instance of self.
python/mleap/sklearn/preprocessing/data.py
def fit(self, X): """Fit label encoder Parameters ---------- y : array-like of shape (n_samples,) Target values. Returns ------- self : returns an instance of self. """ X = column_or_1d(X, warn=True) _check_numpy_unicode_bug(X...
def fit(self, X): """Fit label encoder Parameters ---------- y : array-like of shape (n_samples,) Target values. Returns ------- self : returns an instance of self. """ X = column_or_1d(X, warn=True) _check_numpy_unicode_bug(X...
[ "Fit", "label", "encoder" ]
combust/mleap
python
https://github.com/combust/mleap/blob/dc6b79db03ec27a0ba08b289842551e73d517ab3/python/mleap/sklearn/preprocessing/data.py#L361-L376
[ "def", "fit", "(", "self", ",", "X", ")", ":", "X", "=", "column_or_1d", "(", "X", ",", "warn", "=", "True", ")", "_check_numpy_unicode_bug", "(", "X", ")", "self", ".", "classes_", "=", "np", ".", "unique", "(", "X", ")", "return", "self" ]
dc6b79db03ec27a0ba08b289842551e73d517ab3
train
LabelEncoder.fit_transform
Fit label encoder and return encoded labels Parameters ---------- y : array-like of shape [n_samples] Target values. Returns ------- y : array-like of shape [n_samples]
python/mleap/sklearn/preprocessing/data.py
def fit_transform(self, X, y=None, **fit_params): """Fit label encoder and return encoded labels Parameters ---------- y : array-like of shape [n_samples] Target values. Returns ------- y : array-like of shape [n_samples] """ y = colu...
def fit_transform(self, X, y=None, **fit_params): """Fit label encoder and return encoded labels Parameters ---------- y : array-like of shape [n_samples] Target values. Returns ------- y : array-like of shape [n_samples] """ y = colu...
[ "Fit", "label", "encoder", "and", "return", "encoded", "labels" ]
combust/mleap
python
https://github.com/combust/mleap/blob/dc6b79db03ec27a0ba08b289842551e73d517ab3/python/mleap/sklearn/preprocessing/data.py#L378-L393
[ "def", "fit_transform", "(", "self", ",", "X", ",", "y", "=", "None", ",", "*", "*", "fit_params", ")", ":", "y", "=", "column_or_1d", "(", "X", ",", "warn", "=", "True", ")", "_check_numpy_unicode_bug", "(", "X", ")", "self", ".", "classes_", ",", ...
dc6b79db03ec27a0ba08b289842551e73d517ab3
train
LabelEncoder.transform
Transform labels to normalized encoding. Parameters ---------- y : array-like of shape [n_samples] Target values. Returns ------- y : array-like of shape [n_samples]
python/mleap/sklearn/preprocessing/data.py
def transform(self, y): """Transform labels to normalized encoding. Parameters ---------- y : array-like of shape [n_samples] Target values. Returns ------- y : array-like of shape [n_samples] """ check_is_fitted(self, 'classes_') ...
def transform(self, y): """Transform labels to normalized encoding. Parameters ---------- y : array-like of shape [n_samples] Target values. Returns ------- y : array-like of shape [n_samples] """ check_is_fitted(self, 'classes_') ...
[ "Transform", "labels", "to", "normalized", "encoding", "." ]
combust/mleap
python
https://github.com/combust/mleap/blob/dc6b79db03ec27a0ba08b289842551e73d517ab3/python/mleap/sklearn/preprocessing/data.py#L395-L415
[ "def", "transform", "(", "self", ",", "y", ")", ":", "check_is_fitted", "(", "self", ",", "'classes_'", ")", "y", "=", "column_or_1d", "(", "y", ",", "warn", "=", "True", ")", "classes", "=", "np", ".", "unique", "(", "y", ")", "_check_numpy_unicode_bu...
dc6b79db03ec27a0ba08b289842551e73d517ab3
train
LabelEncoder.inverse_transform
Transform labels back to original encoding. Parameters ---------- y : numpy array of shape [n_samples] Target values. Returns ------- y : numpy array of shape [n_samples]
python/mleap/sklearn/preprocessing/data.py
def inverse_transform(self, y): """Transform labels back to original encoding. Parameters ---------- y : numpy array of shape [n_samples] Target values. Returns ------- y : numpy array of shape [n_samples] """ check_is_fitted(self, 'c...
def inverse_transform(self, y): """Transform labels back to original encoding. Parameters ---------- y : numpy array of shape [n_samples] Target values. Returns ------- y : numpy array of shape [n_samples] """ check_is_fitted(self, 'c...
[ "Transform", "labels", "back", "to", "original", "encoding", "." ]
combust/mleap
python
https://github.com/combust/mleap/blob/dc6b79db03ec27a0ba08b289842551e73d517ab3/python/mleap/sklearn/preprocessing/data.py#L417-L435
[ "def", "inverse_transform", "(", "self", ",", "y", ")", ":", "check_is_fitted", "(", "self", ",", "'classes_'", ")", "diff", "=", "np", ".", "setdiff1d", "(", "y", ",", "np", ".", "arange", "(", "len", "(", "self", ".", "classes_", ")", ")", ")", "...
dc6b79db03ec27a0ba08b289842551e73d517ab3
train
MathUnary.transform
Transform features per specified math function. :param y: :return:
python/mleap/sklearn/preprocessing/data.py
def transform(self, y): """ Transform features per specified math function. :param y: :return: """ if self.transform_type == 'log': return np.log(y) elif self.transform_type == 'exp': return np.exp(y) elif self.transform_type == 'sq...
def transform(self, y): """ Transform features per specified math function. :param y: :return: """ if self.transform_type == 'log': return np.log(y) elif self.transform_type == 'exp': return np.exp(y) elif self.transform_type == 'sq...
[ "Transform", "features", "per", "specified", "math", "function", ".", ":", "param", "y", ":", ":", "return", ":" ]
combust/mleap
python
https://github.com/combust/mleap/blob/dc6b79db03ec27a0ba08b289842551e73d517ab3/python/mleap/sklearn/preprocessing/data.py#L907-L926
[ "def", "transform", "(", "self", ",", "y", ")", ":", "if", "self", ".", "transform_type", "==", "'log'", ":", "return", "np", ".", "log", "(", "y", ")", "elif", "self", ".", "transform_type", "==", "'exp'", ":", "return", "np", ".", "exp", "(", "y"...
dc6b79db03ec27a0ba08b289842551e73d517ab3
train
MathBinary.fit
Fit Unary Math Operator :param y: :return:
python/mleap/sklearn/preprocessing/data.py
def fit(self, X, y=None, **fit_params): """ Fit Unary Math Operator :param y: :return: """ if self.transform_type not in self.valid_transforms: warnings.warn("Invalid transform type.", stacklevel=2) return self
def fit(self, X, y=None, **fit_params): """ Fit Unary Math Operator :param y: :return: """ if self.transform_type not in self.valid_transforms: warnings.warn("Invalid transform type.", stacklevel=2) return self
[ "Fit", "Unary", "Math", "Operator", ":", "param", "y", ":", ":", "return", ":" ]
combust/mleap
python
https://github.com/combust/mleap/blob/dc6b79db03ec27a0ba08b289842551e73d517ab3/python/mleap/sklearn/preprocessing/data.py#L994-L1002
[ "def", "fit", "(", "self", ",", "X", ",", "y", "=", "None", ",", "*", "*", "fit_params", ")", ":", "if", "self", ".", "transform_type", "not", "in", "self", ".", "valid_transforms", ":", "warnings", ".", "warn", "(", "\"Invalid transform type.\"", ",", ...
dc6b79db03ec27a0ba08b289842551e73d517ab3
train
MathBinary.transform
Transform features per specified math function. :param y: :return:
python/mleap/sklearn/preprocessing/data.py
def transform(self, y): """ Transform features per specified math function. :param y: :return: """ if isinstance(y, pd.DataFrame): x = y.ix[:,0] y = y.ix[:,1] else: x = y[:,0] y = y[:,1] if self.transform_typ...
def transform(self, y): """ Transform features per specified math function. :param y: :return: """ if isinstance(y, pd.DataFrame): x = y.ix[:,0] y = y.ix[:,1] else: x = y[:,0] y = y[:,1] if self.transform_typ...
[ "Transform", "features", "per", "specified", "math", "function", ".", ":", "param", "y", ":", ":", "return", ":" ]
combust/mleap
python
https://github.com/combust/mleap/blob/dc6b79db03ec27a0ba08b289842551e73d517ab3/python/mleap/sklearn/preprocessing/data.py#L1004-L1027
[ "def", "transform", "(", "self", ",", "y", ")", ":", "if", "isinstance", "(", "y", ",", "pd", ".", "DataFrame", ")", ":", "x", "=", "y", ".", "ix", "[", ":", ",", "0", "]", "y", "=", "y", ".", "ix", "[", ":", ",", "1", "]", "else", ":", ...
dc6b79db03ec27a0ba08b289842551e73d517ab3
train
SimpleSerializer.serialize_tree
:type feature_names: list :type tree: sklearn.tree.tree.BaseDecisionTree :param tree: sklearn.tree.tree :param feature_names: :return:
python/mleap/sklearn/tree/tree.py
def serialize_tree(tree, feature_names, outfile): """ :type feature_names: list :type tree: sklearn.tree.tree.BaseDecisionTree :param tree: sklearn.tree.tree :param feature_names: :return: """ tree_ = tree.tree_ feature_name = [feature_names[i] if...
def serialize_tree(tree, feature_names, outfile): """ :type feature_names: list :type tree: sklearn.tree.tree.BaseDecisionTree :param tree: sklearn.tree.tree :param feature_names: :return: """ tree_ = tree.tree_ feature_name = [feature_names[i] if...
[ ":", "type", "feature_names", ":", "list", ":", "type", "tree", ":", "sklearn", ".", "tree", ".", "tree", ".", "BaseDecisionTree", ":", "param", "tree", ":", "sklearn", ".", "tree", ".", "tree", ":", "param", "feature_names", ":", ":", "return", ":" ]
combust/mleap
python
https://github.com/combust/mleap/blob/dc6b79db03ec27a0ba08b289842551e73d517ab3/python/mleap/sklearn/tree/tree.py#L54-L100
[ "def", "serialize_tree", "(", "tree", ",", "feature_names", ",", "outfile", ")", ":", "tree_", "=", "tree", ".", "tree_", "feature_name", "=", "[", "feature_names", "[", "i", "]", "if", "i", "!=", "_tree", ".", "TREE_UNDEFINED", "else", "'n/a'", "for", "...
dc6b79db03ec27a0ba08b289842551e73d517ab3
train
SimpleSerializer.serialize_to_bundle
:type transformer: sklearn.tree.tree.BaseDecisionTree :type path: str :type model_name: str :type serialize_node: bool :param transformer: :param path: :param model_name: :return:
python/mleap/sklearn/tree/tree.py
def serialize_to_bundle(self, transformer, path, model_name, serialize_node=True): """ :type transformer: sklearn.tree.tree.BaseDecisionTree :type path: str :type model_name: str :type serialize_node: bool :param transformer: :param path: :param model_name...
def serialize_to_bundle(self, transformer, path, model_name, serialize_node=True): """ :type transformer: sklearn.tree.tree.BaseDecisionTree :type path: str :type model_name: str :type serialize_node: bool :param transformer: :param path: :param model_name...
[ ":", "type", "transformer", ":", "sklearn", ".", "tree", ".", "tree", ".", "BaseDecisionTree", ":", "type", "path", ":", "str", ":", "type", "model_name", ":", "str", ":", "type", "serialize_node", ":", "bool", ":", "param", "transformer", ":", ":", "par...
combust/mleap
python
https://github.com/combust/mleap/blob/dc6b79db03ec27a0ba08b289842551e73d517ab3/python/mleap/sklearn/tree/tree.py#L102-L141
[ "def", "serialize_to_bundle", "(", "self", ",", "transformer", ",", "path", ",", "model_name", ",", "serialize_node", "=", "True", ")", ":", "# Define attributes", "attributes", "=", "list", "(", ")", "attributes", ".", "append", "(", "(", "'num_features'", ",...
dc6b79db03ec27a0ba08b289842551e73d517ab3
train
SimpleSparkSerializer.sent2vec
Used with sqrt kernel :param words: :param transformer: :return:
python/mleap/gensim/word2vec.py
def sent2vec(self, words, transformer): """ Used with sqrt kernel :param words: :param transformer: :return: """ sent_vec = np.zeros(transformer.vector_size) numw = 0 for w in words: try: sent_vec = np.add(sent_vec, tran...
def sent2vec(self, words, transformer): """ Used with sqrt kernel :param words: :param transformer: :return: """ sent_vec = np.zeros(transformer.vector_size) numw = 0 for w in words: try: sent_vec = np.add(sent_vec, tran...
[ "Used", "with", "sqrt", "kernel", ":", "param", "words", ":", ":", "param", "transformer", ":", ":", "return", ":" ]
combust/mleap
python
https://github.com/combust/mleap/blob/dc6b79db03ec27a0ba08b289842551e73d517ab3/python/mleap/gensim/word2vec.py#L85-L100
[ "def", "sent2vec", "(", "self", ",", "words", ",", "transformer", ")", ":", "sent_vec", "=", "np", ".", "zeros", "(", "transformer", ".", "vector_size", ")", "numw", "=", "0", "for", "w", "in", "words", ":", "try", ":", "sent_vec", "=", "np", ".", ...
dc6b79db03ec27a0ba08b289842551e73d517ab3
train
SimpleSerializer.serialize_to_bundle
:param transformer: Random Forest Regressor or Classifier :param path: Root path where to serialize the model :param model: Name of the model to be serialized :type transformer: sklearn.ensemble.forest.BaseForest :type path: str :type model: str :return: None
python/mleap/sklearn/ensemble/forest.py
def serialize_to_bundle(self, transformer, path, model): """ :param transformer: Random Forest Regressor or Classifier :param path: Root path where to serialize the model :param model: Name of the model to be serialized :type transformer: sklearn.ensemble.forest.BaseForest ...
def serialize_to_bundle(self, transformer, path, model): """ :param transformer: Random Forest Regressor or Classifier :param path: Root path where to serialize the model :param model: Name of the model to be serialized :type transformer: sklearn.ensemble.forest.BaseForest ...
[ ":", "param", "transformer", ":", "Random", "Forest", "Regressor", "or", "Classifier", ":", "param", "path", ":", "Root", "path", "where", "to", "serialize", "the", "model", ":", "param", "model", ":", "Name", "of", "the", "model", "to", "be", "serialized"...
combust/mleap
python
https://github.com/combust/mleap/blob/dc6b79db03ec27a0ba08b289842551e73d517ab3/python/mleap/sklearn/ensemble/forest.py#L53-L107
[ "def", "serialize_to_bundle", "(", "self", ",", "transformer", ",", "path", ",", "model", ")", ":", "# Define Node Inputs and Outputs", "inputs", "=", "[", "{", "\"name\"", ":", "transformer", ".", "input_features", ",", "\"port\"", ":", "\"features\"", "}", "]"...
dc6b79db03ec27a0ba08b289842551e73d517ab3
train
MLeapSerializer.get_mleap_model
Generates the model.json given a list of attributes, which are a tuple comprised of: - name - value Type is figured out automatically, but we should consider specifying it explicitly. Note: this only supports doubles and tensors that are vectors/lists of doubles. :param t...
python/mleap/bundle/serialize.py
def get_mleap_model(self, transformer, attributes_to_serialize=None): """ Generates the model.json given a list of attributes, which are a tuple comprised of: - name - value Type is figured out automatically, but we should consider specifying it explicitly. Note: ...
def get_mleap_model(self, transformer, attributes_to_serialize=None): """ Generates the model.json given a list of attributes, which are a tuple comprised of: - name - value Type is figured out automatically, but we should consider specifying it explicitly. Note: ...
[ "Generates", "the", "model", ".", "json", "given", "a", "list", "of", "attributes", "which", "are", "a", "tuple", "comprised", "of", ":", "-", "name", "-", "value", "Type", "is", "figured", "out", "automatically", "but", "we", "should", "consider", "specif...
combust/mleap
python
https://github.com/combust/mleap/blob/dc6b79db03ec27a0ba08b289842551e73d517ab3/python/mleap/bundle/serialize.py#L29-L129
[ "def", "get_mleap_model", "(", "self", ",", "transformer", ",", "attributes_to_serialize", "=", "None", ")", ":", "js", "=", "{", "'op'", ":", "transformer", ".", "op", "}", "# If the transformer doesn't have any attributes, return just the op name", "if", "attributes_t...
dc6b79db03ec27a0ba08b289842551e73d517ab3
train
MLeapDeserializer.deserialize_single_input_output
:attributes_map: Map of attributes names. For example StandardScaler has `mean_` but is serialized as `mean` :param transformer: Scikit or Pandas transformer :param node: bundle.ml node json file :param model: bundle.ml model json file :return: Transformer
python/mleap/bundle/serialize.py
def deserialize_single_input_output(self, transformer, node_path, attributes_map=None): """ :attributes_map: Map of attributes names. For example StandardScaler has `mean_` but is serialized as `mean` :param transformer: Scikit or Pandas transformer :param node: bundle.ml node json file ...
def deserialize_single_input_output(self, transformer, node_path, attributes_map=None): """ :attributes_map: Map of attributes names. For example StandardScaler has `mean_` but is serialized as `mean` :param transformer: Scikit or Pandas transformer :param node: bundle.ml node json file ...
[ ":", "attributes_map", ":", "Map", "of", "attributes", "names", ".", "For", "example", "StandardScaler", "has", "mean_", "but", "is", "serialized", "as", "mean", ":", "param", "transformer", ":", "Scikit", "or", "Pandas", "transformer", ":", "param", "node", ...
combust/mleap
python
https://github.com/combust/mleap/blob/dc6b79db03ec27a0ba08b289842551e73d517ab3/python/mleap/bundle/serialize.py#L187-L219
[ "def", "deserialize_single_input_output", "(", "self", ",", "transformer", ",", "node_path", ",", "attributes_map", "=", "None", ")", ":", "# Load the model file", "with", "open", "(", "\"{}/model.json\"", ".", "format", "(", "node_path", ")", ")", "as", "json_dat...
dc6b79db03ec27a0ba08b289842551e73d517ab3
train
wait_until
Wait until `what` return True Args: what (Callable[bool]): Call `wait()` again and again until it returns True times (int): Maximum times of trials before giving up Returns: True if success, False if times threshold reached
tools/harness-automation/autothreadharness/harness_case.py
def wait_until(what, times=-1): """Wait until `what` return True Args: what (Callable[bool]): Call `wait()` again and again until it returns True times (int): Maximum times of trials before giving up Returns: True if success, False if times threshold reached """ while time...
def wait_until(what, times=-1): """Wait until `what` return True Args: what (Callable[bool]): Call `wait()` again and again until it returns True times (int): Maximum times of trials before giving up Returns: True if success, False if times threshold reached """ while time...
[ "Wait", "until", "what", "return", "True" ]
openthread/openthread
python
https://github.com/openthread/openthread/blob/0208d10563aa21c518092985c78ecf9cd223ab74/tools/harness-automation/autothreadharness/harness_case.py#L64-L87
[ "def", "wait_until", "(", "what", ",", "times", "=", "-", "1", ")", ":", "while", "times", ":", "logger", ".", "info", "(", "'Waiting times left %d'", ",", "times", ")", "try", ":", "if", "what", "(", ")", "is", "True", ":", "return", "True", "except...
0208d10563aa21c518092985c78ecf9cd223ab74
train
HarnessCase._init_devices
Reboot all usb devices. Note: If PDU_CONTROLLER_TYPE is not valid, usb devices is not rebooted.
tools/harness-automation/autothreadharness/harness_case.py
def _init_devices(self): """Reboot all usb devices. Note: If PDU_CONTROLLER_TYPE is not valid, usb devices is not rebooted. """ if not settings.PDU_CONTROLLER_TYPE: if settings.AUTO_DUT: return for device in settings.GOLDEN_DEVICES: ...
def _init_devices(self): """Reboot all usb devices. Note: If PDU_CONTROLLER_TYPE is not valid, usb devices is not rebooted. """ if not settings.PDU_CONTROLLER_TYPE: if settings.AUTO_DUT: return for device in settings.GOLDEN_DEVICES: ...
[ "Reboot", "all", "usb", "devices", "." ]
openthread/openthread
python
https://github.com/openthread/openthread/blob/0208d10563aa21c518092985c78ecf9cd223ab74/tools/harness-automation/autothreadharness/harness_case.py#L170-L213
[ "def", "_init_devices", "(", "self", ")", ":", "if", "not", "settings", ".", "PDU_CONTROLLER_TYPE", ":", "if", "settings", ".", "AUTO_DUT", ":", "return", "for", "device", "in", "settings", ".", "GOLDEN_DEVICES", ":", "port", ",", "_", "=", "device", "try"...
0208d10563aa21c518092985c78ecf9cd223ab74
train
HarnessCase._init_harness
Restart harness backend service. Please start the harness controller before running the cases, otherwise, nothing happens
tools/harness-automation/autothreadharness/harness_case.py
def _init_harness(self): """Restart harness backend service. Please start the harness controller before running the cases, otherwise, nothing happens """ self._hc = HarnessController(self.result_dir) self._hc.stop() time.sleep(1) self._hc.start() time.sle...
def _init_harness(self): """Restart harness backend service. Please start the harness controller before running the cases, otherwise, nothing happens """ self._hc = HarnessController(self.result_dir) self._hc.stop() time.sleep(1) self._hc.start() time.sle...
[ "Restart", "harness", "backend", "service", "." ]
openthread/openthread
python
https://github.com/openthread/openthread/blob/0208d10563aa21c518092985c78ecf9cd223ab74/tools/harness-automation/autothreadharness/harness_case.py#L215-L236
[ "def", "_init_harness", "(", "self", ")", ":", "self", ".", "_hc", "=", "HarnessController", "(", "self", ".", "result_dir", ")", "self", ".", "_hc", ".", "stop", "(", ")", "time", ".", "sleep", "(", "1", ")", "self", ".", "_hc", ".", "start", "(",...
0208d10563aa21c518092985c78ecf9cd223ab74
train
HarnessCase._init_dut
Initialize the DUT. DUT will be restarted. and openthread will started.
tools/harness-automation/autothreadharness/harness_case.py
def _init_dut(self): """Initialize the DUT. DUT will be restarted. and openthread will started. """ if self.auto_dut: self.dut = None return dut_port = settings.DUT_DEVICE[0] dut = OpenThreadController(dut_port) self.dut = dut
def _init_dut(self): """Initialize the DUT. DUT will be restarted. and openthread will started. """ if self.auto_dut: self.dut = None return dut_port = settings.DUT_DEVICE[0] dut = OpenThreadController(dut_port) self.dut = dut
[ "Initialize", "the", "DUT", "." ]
openthread/openthread
python
https://github.com/openthread/openthread/blob/0208d10563aa21c518092985c78ecf9cd223ab74/tools/harness-automation/autothreadharness/harness_case.py#L246-L257
[ "def", "_init_dut", "(", "self", ")", ":", "if", "self", ".", "auto_dut", ":", "self", ".", "dut", "=", "None", "return", "dut_port", "=", "settings", ".", "DUT_DEVICE", "[", "0", "]", "dut", "=", "OpenThreadController", "(", "dut_port", ")", "self", "...
0208d10563aa21c518092985c78ecf9cd223ab74
train
HarnessCase._init_browser
Open harness web page. Open a quiet chrome which: 1. disables extensions, 2. ignore certificate errors and 3. always allow notifications.
tools/harness-automation/autothreadharness/harness_case.py
def _init_browser(self): """Open harness web page. Open a quiet chrome which: 1. disables extensions, 2. ignore certificate errors and 3. always allow notifications. """ chrome_options = webdriver.ChromeOptions() chrome_options.add_argument('--disable-ext...
def _init_browser(self): """Open harness web page. Open a quiet chrome which: 1. disables extensions, 2. ignore certificate errors and 3. always allow notifications. """ chrome_options = webdriver.ChromeOptions() chrome_options.add_argument('--disable-ext...
[ "Open", "harness", "web", "page", "." ]
openthread/openthread
python
https://github.com/openthread/openthread/blob/0208d10563aa21c518092985c78ecf9cd223ab74/tools/harness-automation/autothreadharness/harness_case.py#L262-L285
[ "def", "_init_browser", "(", "self", ")", ":", "chrome_options", "=", "webdriver", ".", "ChromeOptions", "(", ")", "chrome_options", ".", "add_argument", "(", "'--disable-extensions'", ")", "chrome_options", ".", "add_argument", "(", "'--disable-infobars'", ")", "ch...
0208d10563aa21c518092985c78ecf9cd223ab74
train
HarnessCase.setUp
Prepare to run test case. Start harness service, init golden devices, reset DUT and open browser.
tools/harness-automation/autothreadharness/harness_case.py
def setUp(self): """Prepare to run test case. Start harness service, init golden devices, reset DUT and open browser. """ if self.__class__ is HarnessCase: return logger.info('Setting up') # clear files logger.info('Deleting all .pdf') os.sys...
def setUp(self): """Prepare to run test case. Start harness service, init golden devices, reset DUT and open browser. """ if self.__class__ is HarnessCase: return logger.info('Setting up') # clear files logger.info('Deleting all .pdf') os.sys...
[ "Prepare", "to", "run", "test", "case", "." ]
openthread/openthread
python
https://github.com/openthread/openthread/blob/0208d10563aa21c518092985c78ecf9cd223ab74/tools/harness-automation/autothreadharness/harness_case.py#L305-L331
[ "def", "setUp", "(", "self", ")", ":", "if", "self", ".", "__class__", "is", "HarnessCase", ":", "return", "logger", ".", "info", "(", "'Setting up'", ")", "# clear files", "logger", ".", "info", "(", "'Deleting all .pdf'", ")", "os", ".", "system", "(", ...
0208d10563aa21c518092985c78ecf9cd223ab74
train
HarnessCase.tearDown
Clean up after each case. Stop harness service, close browser and close DUT.
tools/harness-automation/autothreadharness/harness_case.py
def tearDown(self): """Clean up after each case. Stop harness service, close browser and close DUT. """ if self.__class__ is HarnessCase: return logger.info('Tearing down') self._destroy_harness() self._destroy_browser() self._destroy_dut() ...
def tearDown(self): """Clean up after each case. Stop harness service, close browser and close DUT. """ if self.__class__ is HarnessCase: return logger.info('Tearing down') self._destroy_harness() self._destroy_browser() self._destroy_dut() ...
[ "Clean", "up", "after", "each", "case", "." ]
openthread/openthread
python
https://github.com/openthread/openthread/blob/0208d10563aa21c518092985c78ecf9cd223ab74/tools/harness-automation/autothreadharness/harness_case.py#L333-L345
[ "def", "tearDown", "(", "self", ")", ":", "if", "self", ".", "__class__", "is", "HarnessCase", ":", "return", "logger", ".", "info", "(", "'Tearing down'", ")", "self", ".", "_destroy_harness", "(", ")", "self", ".", "_destroy_browser", "(", ")", "self", ...
0208d10563aa21c518092985c78ecf9cd223ab74
train
HarnessCase._setup_page
Do sniffer settings and general settings
tools/harness-automation/autothreadharness/harness_case.py
def _setup_page(self): """Do sniffer settings and general settings """ if not self.started: self.started = time.time() if time.time() - self.started > 5*len(settings.GOLDEN_DEVICES): self._browser.refresh() return # Detect Sniffer try...
def _setup_page(self): """Do sniffer settings and general settings """ if not self.started: self.started = time.time() if time.time() - self.started > 5*len(settings.GOLDEN_DEVICES): self._browser.refresh() return # Detect Sniffer try...
[ "Do", "sniffer", "settings", "and", "general", "settings" ]
openthread/openthread
python
https://github.com/openthread/openthread/blob/0208d10563aa21c518092985c78ecf9cd223ab74/tools/harness-automation/autothreadharness/harness_case.py#L347-L440
[ "def", "_setup_page", "(", "self", ")", ":", "if", "not", "self", ".", "started", ":", "self", ".", "started", "=", "time", ".", "time", "(", ")", "if", "time", ".", "time", "(", ")", "-", "self", ".", "started", ">", "5", "*", "len", "(", "set...
0208d10563aa21c518092985c78ecf9cd223ab74
train
HarnessCase._select_case
Select the test case.
tools/harness-automation/autothreadharness/harness_case.py
def _select_case(self, role, case): """Select the test case. """ # select the case elem = Select(self._browser.find_element_by_id('select-dut')) elem.select_by_value(str(role)) time.sleep(1) checkbox = None wait_until(lambda: self._browser.find_elements_b...
def _select_case(self, role, case): """Select the test case. """ # select the case elem = Select(self._browser.find_element_by_id('select-dut')) elem.select_by_value(str(role)) time.sleep(1) checkbox = None wait_until(lambda: self._browser.find_elements_b...
[ "Select", "the", "test", "case", "." ]
openthread/openthread
python
https://github.com/openthread/openthread/blob/0208d10563aa21c518092985c78ecf9cd223ab74/tools/harness-automation/autothreadharness/harness_case.py#L642-L676
[ "def", "_select_case", "(", "self", ",", "role", ",", "case", ")", ":", "# select the case", "elem", "=", "Select", "(", "self", ".", "_browser", ".", "find_element_by_id", "(", "'select-dut'", ")", ")", "elem", ".", "select_by_value", "(", "str", "(", "ro...
0208d10563aa21c518092985c78ecf9cd223ab74
train
HarnessCase._collect_result
Collect test result. Generate PDF, excel and pcap file
tools/harness-automation/autothreadharness/harness_case.py
def _collect_result(self): """Collect test result. Generate PDF, excel and pcap file """ # generate pdf self._browser.find_element_by_class_name('save-pdf').click() time.sleep(1) try: dialog = self._browser.find_element_by_id('Testinfo') excep...
def _collect_result(self): """Collect test result. Generate PDF, excel and pcap file """ # generate pdf self._browser.find_element_by_class_name('save-pdf').click() time.sleep(1) try: dialog = self._browser.find_element_by_id('Testinfo') excep...
[ "Collect", "test", "result", "." ]
openthread/openthread
python
https://github.com/openthread/openthread/blob/0208d10563aa21c518092985c78ecf9cd223ab74/tools/harness-automation/autothreadharness/harness_case.py#L678-L729
[ "def", "_collect_result", "(", "self", ")", ":", "# generate pdf", "self", ".", "_browser", ".", "find_element_by_class_name", "(", "'save-pdf'", ")", ".", "click", "(", ")", "time", ".", "sleep", "(", "1", ")", "try", ":", "dialog", "=", "self", ".", "_...
0208d10563aa21c518092985c78ecf9cd223ab74
train
HarnessCase._wait_dialog
Wait for dialogs and handle them until done.
tools/harness-automation/autothreadharness/harness_case.py
def _wait_dialog(self): """Wait for dialogs and handle them until done. """ logger.debug('waiting for dialog') done = False error = False logger.info("self timeout %d",self.timeout) while not done and self.timeout: try: dialog = self._...
def _wait_dialog(self): """Wait for dialogs and handle them until done. """ logger.debug('waiting for dialog') done = False error = False logger.info("self timeout %d",self.timeout) while not done and self.timeout: try: dialog = self._...
[ "Wait", "for", "dialogs", "and", "handle", "them", "until", "done", "." ]
openthread/openthread
python
https://github.com/openthread/openthread/blob/0208d10563aa21c518092985c78ecf9cd223ab74/tools/harness-automation/autothreadharness/harness_case.py#L731-L790
[ "def", "_wait_dialog", "(", "self", ")", ":", "logger", ".", "debug", "(", "'waiting for dialog'", ")", "done", "=", "False", "error", "=", "False", "logger", ".", "info", "(", "\"self timeout %d\"", ",", "self", ".", "timeout", ")", "while", "not", "done"...
0208d10563aa21c518092985c78ecf9cd223ab74
train
HarnessCase._handle_dialog
Handle a dialog. Returns: bool True if no more dialogs expected, False if more dialogs needed, and None if not handled
tools/harness-automation/autothreadharness/harness_case.py
def _handle_dialog(self, dialog, title): """Handle a dialog. Returns: bool True if no more dialogs expected, False if more dialogs needed, and None if not handled """ done = self.on_dialog(dialog, title) if isinstance(done, bool): ...
def _handle_dialog(self, dialog, title): """Handle a dialog. Returns: bool True if no more dialogs expected, False if more dialogs needed, and None if not handled """ done = self.on_dialog(dialog, title) if isinstance(done, bool): ...
[ "Handle", "a", "dialog", "." ]
openthread/openthread
python
https://github.com/openthread/openthread/blob/0208d10563aa21c518092985c78ecf9cd223ab74/tools/harness-automation/autothreadharness/harness_case.py#L792-L918
[ "def", "_handle_dialog", "(", "self", ",", "dialog", ",", "title", ")", ":", "done", "=", "self", ".", "on_dialog", "(", "dialog", ",", "title", ")", "if", "isinstance", "(", "done", ",", "bool", ")", ":", "return", "done", "if", "title", ".", "start...
0208d10563aa21c518092985c78ecf9cd223ab74
train
list_devices
List devices in settings file and print versions
tools/harness-automation/autothreadharness/runner.py
def list_devices(names=None, continue_from=None, **kwargs): """List devices in settings file and print versions""" if not names: names = [device for device, _type in settings.GOLDEN_DEVICES if _type == 'OpenThread'] if continue_from: continue_from = names.index(continue_from) else: ...
def list_devices(names=None, continue_from=None, **kwargs): """List devices in settings file and print versions""" if not names: names = [device for device, _type in settings.GOLDEN_DEVICES if _type == 'OpenThread'] if continue_from: continue_from = names.index(continue_from) else: ...
[ "List", "devices", "in", "settings", "file", "and", "print", "versions" ]
openthread/openthread
python
https://github.com/openthread/openthread/blob/0208d10563aa21c518092985c78ecf9cd223ab74/tools/harness-automation/autothreadharness/runner.py#L151-L167
[ "def", "list_devices", "(", "names", "=", "None", ",", "continue_from", "=", "None", ",", "*", "*", "kwargs", ")", ":", "if", "not", "names", ":", "names", "=", "[", "device", "for", "device", ",", "_type", "in", "settings", ".", "GOLDEN_DEVICES", "if"...
0208d10563aa21c518092985c78ecf9cd223ab74
train
discover
Discover all test cases and skip those passed Args: pattern (str): Pattern to match case modules, refer python's unittest documentation for more details skip (str): types cases to skip
tools/harness-automation/autothreadharness/runner.py
def discover(names=None, pattern=['*.py'], skip='efp', dry_run=False, blacklist=None, name_greps=None, manual_reset=False, delete_history=False, max_devices=0, continue_from=None, result_file='./result.json', auto_reboot=False, keep_explorer=False, add_all_devices=False): """D...
def discover(names=None, pattern=['*.py'], skip='efp', dry_run=False, blacklist=None, name_greps=None, manual_reset=False, delete_history=False, max_devices=0, continue_from=None, result_file='./result.json', auto_reboot=False, keep_explorer=False, add_all_devices=False): """D...
[ "Discover", "all", "test", "cases", "and", "skip", "those", "passed" ]
openthread/openthread
python
https://github.com/openthread/openthread/blob/0208d10563aa21c518092985c78ecf9cd223ab74/tools/harness-automation/autothreadharness/runner.py#L169-L292
[ "def", "discover", "(", "names", "=", "None", ",", "pattern", "=", "[", "'*.py'", "]", ",", "skip", "=", "'efp'", ",", "dry_run", "=", "False", ",", "blacklist", "=", "None", ",", "name_greps", "=", "None", ",", "manual_reset", "=", "False", ",", "de...
0208d10563aa21c518092985c78ecf9cd223ab74
train
OpenThread._expect
Find the `expected` line within `times` trials. Args: expected str: the expected string times int: number of trials
tools/harness-thci/OpenThread.py
def _expect(self, expected, times=50): """Find the `expected` line within `times` trials. Args: expected str: the expected string times int: number of trials """ print '[%s] Expecting [%s]' % (self.port, expected) retry_times = 10 while ...
def _expect(self, expected, times=50): """Find the `expected` line within `times` trials. Args: expected str: the expected string times int: number of trials """ print '[%s] Expecting [%s]' % (self.port, expected) retry_times = 10 while ...
[ "Find", "the", "expected", "line", "within", "times", "trials", "." ]
openthread/openthread
python
https://github.com/openthread/openthread/blob/0208d10563aa21c518092985c78ecf9cd223ab74/tools/harness-thci/OpenThread.py#L89-L113
[ "def", "_expect", "(", "self", ",", "expected", ",", "times", "=", "50", ")", ":", "print", "'[%s] Expecting [%s]'", "%", "(", "self", ".", "port", ",", "expected", ")", "retry_times", "=", "10", "while", "times", ">", "0", "and", "retry_times", ">", "...
0208d10563aa21c518092985c78ecf9cd223ab74
train
OpenThread._readline
Read exactly one line from the device Returns: None on no data
tools/harness-thci/OpenThread.py
def _readline(self): """Read exactly one line from the device Returns: None on no data """ logging.info('%s: reading line', self.port) if len(self._lines) > 1: return self._lines.pop(0) tail = '' if len(self._lines): tail = se...
def _readline(self): """Read exactly one line from the device Returns: None on no data """ logging.info('%s: reading line', self.port) if len(self._lines) > 1: return self._lines.pop(0) tail = '' if len(self._lines): tail = se...
[ "Read", "exactly", "one", "line", "from", "the", "device" ]
openthread/openthread
python
https://github.com/openthread/openthread/blob/0208d10563aa21c518092985c78ecf9cd223ab74/tools/harness-thci/OpenThread.py#L129-L151
[ "def", "_readline", "(", "self", ")", ":", "logging", ".", "info", "(", "'%s: reading line'", ",", "self", ".", "port", ")", "if", "len", "(", "self", ".", "_lines", ")", ">", "1", ":", "return", "self", ".", "_lines", ".", "pop", "(", "0", ")", ...
0208d10563aa21c518092985c78ecf9cd223ab74
train
OpenThread._sendline
Send exactly one line to the device Args: line str: data send to device
tools/harness-thci/OpenThread.py
def _sendline(self, line): """Send exactly one line to the device Args: line str: data send to device """ logging.info('%s: sending line', self.port) # clear buffer self._lines = [] try: self._read() except socket.error: ...
def _sendline(self, line): """Send exactly one line to the device Args: line str: data send to device """ logging.info('%s: sending line', self.port) # clear buffer self._lines = [] try: self._read() except socket.error: ...
[ "Send", "exactly", "one", "line", "to", "the", "device" ]
openthread/openthread
python
https://github.com/openthread/openthread/blob/0208d10563aa21c518092985c78ecf9cd223ab74/tools/harness-thci/OpenThread.py#L153-L171
[ "def", "_sendline", "(", "self", ",", "line", ")", ":", "logging", ".", "info", "(", "'%s: sending line'", ",", "self", ".", "port", ")", "# clear buffer", "self", ".", "_lines", "=", "[", "]", "try", ":", "self", ".", "_read", "(", ")", "except", "s...
0208d10563aa21c518092985c78ecf9cd223ab74
train
OpenThread.__sendCommand
send specific command to reference unit over serial port Args: cmd: OpenThread CLI string Returns: Done: successfully send the command to reference unit and parse it Value: successfully retrieve the desired value from reference unit Error: some errors oc...
tools/harness-thci/OpenThread.py
def __sendCommand(self, cmd): """send specific command to reference unit over serial port Args: cmd: OpenThread CLI string Returns: Done: successfully send the command to reference unit and parse it Value: successfully retrieve the desired value from referen...
def __sendCommand(self, cmd): """send specific command to reference unit over serial port Args: cmd: OpenThread CLI string Returns: Done: successfully send the command to reference unit and parse it Value: successfully retrieve the desired value from referen...
[ "send", "specific", "command", "to", "reference", "unit", "over", "serial", "port" ]
openthread/openthread
python
https://github.com/openthread/openthread/blob/0208d10563aa21c518092985c78ecf9cd223ab74/tools/harness-thci/OpenThread.py#L173-L224
[ "def", "__sendCommand", "(", "self", ",", "cmd", ")", ":", "logging", ".", "info", "(", "'%s: sendCommand[%s]'", ",", "self", ".", "port", ",", "cmd", ")", "if", "self", ".", "logThreadStatus", "==", "self", ".", "logStatus", "[", "'running'", "]", ":", ...
0208d10563aa21c518092985c78ecf9cd223ab74
train
OpenThread.__getIp6Address
get specific type of IPv6 address configured on thread device Args: addressType: the specific type of IPv6 address link local: link local unicast IPv6 address that's within one-hop scope global: global unicast IPv6 address rloc: mesh local unicast IPv6 address f...
tools/harness-thci/OpenThread.py
def __getIp6Address(self, addressType): """get specific type of IPv6 address configured on thread device Args: addressType: the specific type of IPv6 address link local: link local unicast IPv6 address that's within one-hop scope global: global unicast IPv6 address ...
def __getIp6Address(self, addressType): """get specific type of IPv6 address configured on thread device Args: addressType: the specific type of IPv6 address link local: link local unicast IPv6 address that's within one-hop scope global: global unicast IPv6 address ...
[ "get", "specific", "type", "of", "IPv6", "address", "configured", "on", "thread", "device" ]
openthread/openthread
python
https://github.com/openthread/openthread/blob/0208d10563aa21c518092985c78ecf9cd223ab74/tools/harness-thci/OpenThread.py#L226-L281
[ "def", "__getIp6Address", "(", "self", ",", "addressType", ")", ":", "addrType", "=", "[", "'link local'", ",", "'global'", ",", "'rloc'", ",", "'mesh EID'", "]", "addrs", "=", "[", "]", "globalAddr", "=", "[", "]", "linkLocal64Addr", "=", "''", "rlocAddr"...
0208d10563aa21c518092985c78ecf9cd223ab74
train
OpenThread.__setRouterUpgradeThreshold
set router upgrade threshold Args: iThreshold: the number of active routers on the Thread network partition below which a REED may decide to become a Router. Returns: True: successful to set the ROUTER_UPGRADE_THRESHOLD False: fail to set ROU...
tools/harness-thci/OpenThread.py
def __setRouterUpgradeThreshold(self, iThreshold): """set router upgrade threshold Args: iThreshold: the number of active routers on the Thread network partition below which a REED may decide to become a Router. Returns: True: successful to set t...
def __setRouterUpgradeThreshold(self, iThreshold): """set router upgrade threshold Args: iThreshold: the number of active routers on the Thread network partition below which a REED may decide to become a Router. Returns: True: successful to set t...
[ "set", "router", "upgrade", "threshold" ]
openthread/openthread
python
https://github.com/openthread/openthread/blob/0208d10563aa21c518092985c78ecf9cd223ab74/tools/harness-thci/OpenThread.py#L305-L322
[ "def", "__setRouterUpgradeThreshold", "(", "self", ",", "iThreshold", ")", ":", "print", "'call __setRouterUpgradeThreshold'", "try", ":", "cmd", "=", "'routerupgradethreshold %s'", "%", "str", "(", "iThreshold", ")", "print", "cmd", "return", "self", ".", "__sendCo...
0208d10563aa21c518092985c78ecf9cd223ab74
train
OpenThread.__setRouterSelectionJitter
set ROUTER_SELECTION_JITTER parameter for REED to upgrade to Router Args: iRouterJitter: a random period prior to request Router ID for REED Returns: True: successful to set the ROUTER_SELECTION_JITTER False: fail to set ROUTER_SELECTION_JITTER
tools/harness-thci/OpenThread.py
def __setRouterSelectionJitter(self, iRouterJitter): """set ROUTER_SELECTION_JITTER parameter for REED to upgrade to Router Args: iRouterJitter: a random period prior to request Router ID for REED Returns: True: successful to set the ROUTER_SELECTION_JITTER ...
def __setRouterSelectionJitter(self, iRouterJitter): """set ROUTER_SELECTION_JITTER parameter for REED to upgrade to Router Args: iRouterJitter: a random period prior to request Router ID for REED Returns: True: successful to set the ROUTER_SELECTION_JITTER ...
[ "set", "ROUTER_SELECTION_JITTER", "parameter", "for", "REED", "to", "upgrade", "to", "Router" ]
openthread/openthread
python
https://github.com/openthread/openthread/blob/0208d10563aa21c518092985c78ecf9cd223ab74/tools/harness-thci/OpenThread.py#L344-L360
[ "def", "__setRouterSelectionJitter", "(", "self", ",", "iRouterJitter", ")", ":", "print", "'call _setRouterSelectionJitter'", "try", ":", "cmd", "=", "'routerselectionjitter %s'", "%", "str", "(", "iRouterJitter", ")", "print", "cmd", "return", "self", ".", "__send...
0208d10563aa21c518092985c78ecf9cd223ab74
train
OpenThread.__setAddressfilterMode
set address filter mode Returns: True: successful to set address filter mode. False: fail to set address filter mode.
tools/harness-thci/OpenThread.py
def __setAddressfilterMode(self, mode): """set address filter mode Returns: True: successful to set address filter mode. False: fail to set address filter mode. """ print 'call setAddressFilterMode() ' + mode try: cmd = 'macfilter addr ' + mo...
def __setAddressfilterMode(self, mode): """set address filter mode Returns: True: successful to set address filter mode. False: fail to set address filter mode. """ print 'call setAddressFilterMode() ' + mode try: cmd = 'macfilter addr ' + mo...
[ "set", "address", "filter", "mode" ]
openthread/openthread
python
https://github.com/openthread/openthread/blob/0208d10563aa21c518092985c78ecf9cd223ab74/tools/harness-thci/OpenThread.py#L362-L376
[ "def", "__setAddressfilterMode", "(", "self", ",", "mode", ")", ":", "print", "'call setAddressFilterMode() '", "+", "mode", "try", ":", "cmd", "=", "'macfilter addr '", "+", "mode", "if", "self", ".", "__sendCommand", "(", "cmd", ")", "[", "0", "]", "==", ...
0208d10563aa21c518092985c78ecf9cd223ab74
train
OpenThread.__startOpenThread
start OpenThread stack Returns: True: successful to start OpenThread stack and thread interface up False: fail to start OpenThread stack
tools/harness-thci/OpenThread.py
def __startOpenThread(self): """start OpenThread stack Returns: True: successful to start OpenThread stack and thread interface up False: fail to start OpenThread stack """ print 'call startOpenThread' try: if self.hasActiveDatasetToCommit: ...
def __startOpenThread(self): """start OpenThread stack Returns: True: successful to start OpenThread stack and thread interface up False: fail to start OpenThread stack """ print 'call startOpenThread' try: if self.hasActiveDatasetToCommit: ...
[ "start", "OpenThread", "stack" ]
openthread/openthread
python
https://github.com/openthread/openthread/blob/0208d10563aa21c518092985c78ecf9cd223ab74/tools/harness-thci/OpenThread.py#L378-L414
[ "def", "__startOpenThread", "(", "self", ")", ":", "print", "'call startOpenThread'", "try", ":", "if", "self", ".", "hasActiveDatasetToCommit", ":", "if", "self", ".", "__sendCommand", "(", "'dataset commit active'", ")", "[", "0", "]", "!=", "'Done'", ":", "...
0208d10563aa21c518092985c78ecf9cd223ab74
train
OpenThread.__stopOpenThread
stop OpenThread stack Returns: True: successful to stop OpenThread stack and thread interface down False: fail to stop OpenThread stack
tools/harness-thci/OpenThread.py
def __stopOpenThread(self): """stop OpenThread stack Returns: True: successful to stop OpenThread stack and thread interface down False: fail to stop OpenThread stack """ print 'call stopOpenThread' try: if self.__sendCommand('thread stop')[0]...
def __stopOpenThread(self): """stop OpenThread stack Returns: True: successful to stop OpenThread stack and thread interface down False: fail to stop OpenThread stack """ print 'call stopOpenThread' try: if self.__sendCommand('thread stop')[0]...
[ "stop", "OpenThread", "stack" ]
openthread/openthread
python
https://github.com/openthread/openthread/blob/0208d10563aa21c518092985c78ecf9cd223ab74/tools/harness-thci/OpenThread.py#L416-L430
[ "def", "__stopOpenThread", "(", "self", ")", ":", "print", "'call stopOpenThread'", "try", ":", "if", "self", ".", "__sendCommand", "(", "'thread stop'", ")", "[", "0", "]", "==", "'Done'", ":", "return", "self", ".", "__sendCommand", "(", "'ifconfig down'", ...
0208d10563aa21c518092985c78ecf9cd223ab74
train
OpenThread.__convertRlocToRouterId
mapping Rloc16 to router id Args: xRloc16: hex rloc16 short address Returns: actual router id allocated by leader
tools/harness-thci/OpenThread.py
def __convertRlocToRouterId(self, xRloc16): """mapping Rloc16 to router id Args: xRloc16: hex rloc16 short address Returns: actual router id allocated by leader """ routerList = [] routerList = self.__sendCommand('router list')[0].split() ...
def __convertRlocToRouterId(self, xRloc16): """mapping Rloc16 to router id Args: xRloc16: hex rloc16 short address Returns: actual router id allocated by leader """ routerList = [] routerList = self.__sendCommand('router list')[0].split() ...
[ "mapping", "Rloc16", "to", "router", "id" ]
openthread/openthread
python
https://github.com/openthread/openthread/blob/0208d10563aa21c518092985c78ecf9cd223ab74/tools/harness-thci/OpenThread.py#L443-L483
[ "def", "__convertRlocToRouterId", "(", "self", ",", "xRloc16", ")", ":", "routerList", "=", "[", "]", "routerList", "=", "self", ".", "__sendCommand", "(", "'router list'", ")", "[", "0", "]", ".", "split", "(", ")", "print", "routerList", "print", "xRloc1...
0208d10563aa21c518092985c78ecf9cd223ab74
train
OpenThread.__convertIp6PrefixStringToIp6Address
convert IPv6 prefix string to IPv6 dotted-quad format for example: 2001000000000000 -> 2001:: Args: strIp6Prefix: IPv6 address string Returns: IPv6 address dotted-quad format
tools/harness-thci/OpenThread.py
def __convertIp6PrefixStringToIp6Address(self, strIp6Prefix): """convert IPv6 prefix string to IPv6 dotted-quad format for example: 2001000000000000 -> 2001:: Args: strIp6Prefix: IPv6 address string Returns: IPv6 address dotted-quad format ...
def __convertIp6PrefixStringToIp6Address(self, strIp6Prefix): """convert IPv6 prefix string to IPv6 dotted-quad format for example: 2001000000000000 -> 2001:: Args: strIp6Prefix: IPv6 address string Returns: IPv6 address dotted-quad format ...
[ "convert", "IPv6", "prefix", "string", "to", "IPv6", "dotted", "-", "quad", "format", "for", "example", ":", "2001000000000000", "-", ">", "2001", "::" ]
openthread/openthread
python
https://github.com/openthread/openthread/blob/0208d10563aa21c518092985c78ecf9cd223ab74/tools/harness-thci/OpenThread.py#L485-L503
[ "def", "__convertIp6PrefixStringToIp6Address", "(", "self", ",", "strIp6Prefix", ")", ":", "prefix1", "=", "strIp6Prefix", ".", "rstrip", "(", "'L'", ")", "prefix2", "=", "prefix1", ".", "lstrip", "(", "\"0x\"", ")", "hexPrefix", "=", "str", "(", "prefix2", ...
0208d10563aa21c518092985c78ecf9cd223ab74
train
OpenThread.__convertLongToString
convert a long hex integer to string remove '0x' and 'L' return string Args: iValue: long integer in hex format Returns: string of this long integer without "0x" and "L"
tools/harness-thci/OpenThread.py
def __convertLongToString(self, iValue): """convert a long hex integer to string remove '0x' and 'L' return string Args: iValue: long integer in hex format Returns: string of this long integer without "0x" and "L" """ string = '' strVa...
def __convertLongToString(self, iValue): """convert a long hex integer to string remove '0x' and 'L' return string Args: iValue: long integer in hex format Returns: string of this long integer without "0x" and "L" """ string = '' strVa...
[ "convert", "a", "long", "hex", "integer", "to", "string", "remove", "0x", "and", "L", "return", "string" ]
openthread/openthread
python
https://github.com/openthread/openthread/blob/0208d10563aa21c518092985c78ecf9cd223ab74/tools/harness-thci/OpenThread.py#L505-L521
[ "def", "__convertLongToString", "(", "self", ",", "iValue", ")", ":", "string", "=", "''", "strValue", "=", "str", "(", "hex", "(", "iValue", ")", ")", "string", "=", "strValue", ".", "lstrip", "(", "'0x'", ")", "string", "=", "string", ".", "rstrip", ...
0208d10563aa21c518092985c78ecf9cd223ab74
train
OpenThread.__readCommissioningLogs
read logs during the commissioning process Args: durationInSeconds: time duration for reading commissioning logs Returns: Commissioning logs
tools/harness-thci/OpenThread.py
def __readCommissioningLogs(self, durationInSeconds): """read logs during the commissioning process Args: durationInSeconds: time duration for reading commissioning logs Returns: Commissioning logs """ self.logThreadStatus = self.logStatus['running'] ...
def __readCommissioningLogs(self, durationInSeconds): """read logs during the commissioning process Args: durationInSeconds: time duration for reading commissioning logs Returns: Commissioning logs """ self.logThreadStatus = self.logStatus['running'] ...
[ "read", "logs", "during", "the", "commissioning", "process" ]
openthread/openthread
python
https://github.com/openthread/openthread/blob/0208d10563aa21c518092985c78ecf9cd223ab74/tools/harness-thci/OpenThread.py#L523-L561
[ "def", "__readCommissioningLogs", "(", "self", ",", "durationInSeconds", ")", ":", "self", ".", "logThreadStatus", "=", "self", ".", "logStatus", "[", "'running'", "]", "logs", "=", "Queue", "(", ")", "t_end", "=", "time", ".", "time", "(", ")", "+", "du...
0208d10563aa21c518092985c78ecf9cd223ab74
train
OpenThread.__convertChannelMask
convert channelsArray to bitmask format Args: channelsArray: channel array (i.e. [21, 22]) Returns: bitmask format corresponding to a given channel array
tools/harness-thci/OpenThread.py
def __convertChannelMask(self, channelsArray): """convert channelsArray to bitmask format Args: channelsArray: channel array (i.e. [21, 22]) Returns: bitmask format corresponding to a given channel array """ maskSet = 0 for eachChannel in channe...
def __convertChannelMask(self, channelsArray): """convert channelsArray to bitmask format Args: channelsArray: channel array (i.e. [21, 22]) Returns: bitmask format corresponding to a given channel array """ maskSet = 0 for eachChannel in channe...
[ "convert", "channelsArray", "to", "bitmask", "format" ]
openthread/openthread
python
https://github.com/openthread/openthread/blob/0208d10563aa21c518092985c78ecf9cd223ab74/tools/harness-thci/OpenThread.py#L563-L578
[ "def", "__convertChannelMask", "(", "self", ",", "channelsArray", ")", ":", "maskSet", "=", "0", "for", "eachChannel", "in", "channelsArray", ":", "mask", "=", "1", "<<", "eachChannel", "maskSet", "=", "(", "maskSet", "|", "mask", ")", "return", "maskSet" ]
0208d10563aa21c518092985c78ecf9cd223ab74
train
OpenThread.__setKeySwitchGuardTime
set the Key switch guard time Args: iKeySwitchGuardTime: key switch guard time Returns: True: successful to set key switch guard time False: fail to set key switch guard time
tools/harness-thci/OpenThread.py
def __setKeySwitchGuardTime(self, iKeySwitchGuardTime): """ set the Key switch guard time Args: iKeySwitchGuardTime: key switch guard time Returns: True: successful to set key switch guard time False: fail to set key switch guard time """ pri...
def __setKeySwitchGuardTime(self, iKeySwitchGuardTime): """ set the Key switch guard time Args: iKeySwitchGuardTime: key switch guard time Returns: True: successful to set key switch guard time False: fail to set key switch guard time """ pri...
[ "set", "the", "Key", "switch", "guard", "time" ]
openthread/openthread
python
https://github.com/openthread/openthread/blob/0208d10563aa21c518092985c78ecf9cd223ab74/tools/harness-thci/OpenThread.py#L598-L618
[ "def", "__setKeySwitchGuardTime", "(", "self", ",", "iKeySwitchGuardTime", ")", ":", "print", "'%s call setKeySwitchGuardTime'", "%", "self", ".", "port", "print", "iKeySwitchGuardTime", "try", ":", "cmd", "=", "'keysequence guardtime %s'", "%", "str", "(", "iKeySwitc...
0208d10563aa21c518092985c78ecf9cd223ab74
train
OpenThread.closeConnection
close current serial port connection
tools/harness-thci/OpenThread.py
def closeConnection(self): """close current serial port connection""" print '%s call closeConnection' % self.port try: if self.handle: self.handle.close() self.handle = None except Exception, e: ModuleHelper.WriteIntoDebugLogger("cl...
def closeConnection(self): """close current serial port connection""" print '%s call closeConnection' % self.port try: if self.handle: self.handle.close() self.handle = None except Exception, e: ModuleHelper.WriteIntoDebugLogger("cl...
[ "close", "current", "serial", "port", "connection" ]
openthread/openthread
python
https://github.com/openthread/openthread/blob/0208d10563aa21c518092985c78ecf9cd223ab74/tools/harness-thci/OpenThread.py#L642-L650
[ "def", "closeConnection", "(", "self", ")", ":", "print", "'%s call closeConnection'", "%", "self", ".", "port", "try", ":", "if", "self", ".", "handle", ":", "self", ".", "handle", ".", "close", "(", ")", "self", ".", "handle", "=", "None", "except", ...
0208d10563aa21c518092985c78ecf9cd223ab74
train
OpenThread.intialize
initialize the serial port with baudrate, timeout parameters
tools/harness-thci/OpenThread.py
def intialize(self): """initialize the serial port with baudrate, timeout parameters""" print '%s call intialize' % self.port try: self.deviceConnected = False # init serial port self._connect() if self.firmwarePrefix in self.UIStatusMsg: ...
def intialize(self): """initialize the serial port with baudrate, timeout parameters""" print '%s call intialize' % self.port try: self.deviceConnected = False # init serial port self._connect() if self.firmwarePrefix in self.UIStatusMsg: ...
[ "initialize", "the", "serial", "port", "with", "baudrate", "timeout", "parameters" ]
openthread/openthread
python
https://github.com/openthread/openthread/blob/0208d10563aa21c518092985c78ecf9cd223ab74/tools/harness-thci/OpenThread.py#L652-L669
[ "def", "intialize", "(", "self", ")", ":", "print", "'%s call intialize'", "%", "self", ".", "port", "try", ":", "self", ".", "deviceConnected", "=", "False", "# init serial port", "self", ".", "_connect", "(", ")", "if", "self", ".", "firmwarePrefix", "in",...
0208d10563aa21c518092985c78ecf9cd223ab74
train
OpenThread.setNetworkName
set Thread Network name Args: networkName: the networkname string to be set Returns: True: successful to set the Thread Networkname False: fail to set the Thread Networkname
tools/harness-thci/OpenThread.py
def setNetworkName(self, networkName='GRL'): """set Thread Network name Args: networkName: the networkname string to be set Returns: True: successful to set the Thread Networkname False: fail to set the Thread Networkname """ print '%s call s...
def setNetworkName(self, networkName='GRL'): """set Thread Network name Args: networkName: the networkname string to be set Returns: True: successful to set the Thread Networkname False: fail to set the Thread Networkname """ print '%s call s...
[ "set", "Thread", "Network", "name" ]
openthread/openthread
python
https://github.com/openthread/openthread/blob/0208d10563aa21c518092985c78ecf9cd223ab74/tools/harness-thci/OpenThread.py#L671-L689
[ "def", "setNetworkName", "(", "self", ",", "networkName", "=", "'GRL'", ")", ":", "print", "'%s call setNetworkName'", "%", "self", ".", "port", "print", "networkName", "try", ":", "cmd", "=", "'networkname %s'", "%", "networkName", "datasetCmd", "=", "'dataset ...
0208d10563aa21c518092985c78ecf9cd223ab74
train
OpenThread.setChannel
set channel of Thread device operates on. Args: channel: (0 - 10: Reserved) (11 - 26: 2.4GHz channels) (27 - 65535: Reserved) Returns: True: successful to set the channel False: fail to set the channel
tools/harness-thci/OpenThread.py
def setChannel(self, channel=11): """set channel of Thread device operates on. Args: channel: (0 - 10: Reserved) (11 - 26: 2.4GHz channels) (27 - 65535: Reserved) Returns: True: successful to set the channel ...
def setChannel(self, channel=11): """set channel of Thread device operates on. Args: channel: (0 - 10: Reserved) (11 - 26: 2.4GHz channels) (27 - 65535: Reserved) Returns: True: successful to set the channel ...
[ "set", "channel", "of", "Thread", "device", "operates", "on", "." ]
openthread/openthread
python
https://github.com/openthread/openthread/blob/0208d10563aa21c518092985c78ecf9cd223ab74/tools/harness-thci/OpenThread.py#L696-L717
[ "def", "setChannel", "(", "self", ",", "channel", "=", "11", ")", ":", "print", "'%s call setChannel'", "%", "self", ".", "port", "print", "channel", "try", ":", "cmd", "=", "'channel %s'", "%", "channel", "datasetCmd", "=", "'dataset channel %s'", "%", "cha...
0208d10563aa21c518092985c78ecf9cd223ab74
train
OpenThread.getMAC
get one specific type of MAC address currently OpenThread only supports Random MAC address Args: bType: indicate which kind of MAC address is required Returns: specific type of MAC address
tools/harness-thci/OpenThread.py
def getMAC(self, bType=MacType.RandomMac): """get one specific type of MAC address currently OpenThread only supports Random MAC address Args: bType: indicate which kind of MAC address is required Returns: specific type of MAC address """ prin...
def getMAC(self, bType=MacType.RandomMac): """get one specific type of MAC address currently OpenThread only supports Random MAC address Args: bType: indicate which kind of MAC address is required Returns: specific type of MAC address """ prin...
[ "get", "one", "specific", "type", "of", "MAC", "address", "currently", "OpenThread", "only", "supports", "Random", "MAC", "address" ]
openthread/openthread
python
https://github.com/openthread/openthread/blob/0208d10563aa21c518092985c78ecf9cd223ab74/tools/harness-thci/OpenThread.py#L761-L785
[ "def", "getMAC", "(", "self", ",", "bType", "=", "MacType", ".", "RandomMac", ")", ":", "print", "'%s call getMAC'", "%", "self", ".", "port", "print", "bType", "# if power down happens, return extended address assigned previously", "if", "self", ".", "isPowerDown", ...
0208d10563aa21c518092985c78ecf9cd223ab74
train
OpenThread.getRloc16
get rloc16 short address
tools/harness-thci/OpenThread.py
def getRloc16(self): """get rloc16 short address""" print '%s call getRloc16' % self.port rloc16 = self.__sendCommand('rloc16')[0] return int(rloc16, 16)
def getRloc16(self): """get rloc16 short address""" print '%s call getRloc16' % self.port rloc16 = self.__sendCommand('rloc16')[0] return int(rloc16, 16)
[ "get", "rloc16", "short", "address" ]
openthread/openthread
python
https://github.com/openthread/openthread/blob/0208d10563aa21c518092985c78ecf9cd223ab74/tools/harness-thci/OpenThread.py#L797-L801
[ "def", "getRloc16", "(", "self", ")", ":", "print", "'%s call getRloc16'", "%", "self", ".", "port", "rloc16", "=", "self", ".", "__sendCommand", "(", "'rloc16'", ")", "[", "0", "]", "return", "int", "(", "rloc16", ",", "16", ")" ]
0208d10563aa21c518092985c78ecf9cd223ab74
train
OpenThread.getNetworkFragmentID
get current partition id of Thread Network Partition from LeaderData Returns: The Thread network Partition Id
tools/harness-thci/OpenThread.py
def getNetworkFragmentID(self): """get current partition id of Thread Network Partition from LeaderData Returns: The Thread network Partition Id """ print '%s call getNetworkFragmentID' % self.port if not self.__isOpenThreadRunning(): print 'OpenThread is...
def getNetworkFragmentID(self): """get current partition id of Thread Network Partition from LeaderData Returns: The Thread network Partition Id """ print '%s call getNetworkFragmentID' % self.port if not self.__isOpenThreadRunning(): print 'OpenThread is...
[ "get", "current", "partition", "id", "of", "Thread", "Network", "Partition", "from", "LeaderData" ]
openthread/openthread
python
https://github.com/openthread/openthread/blob/0208d10563aa21c518092985c78ecf9cd223ab74/tools/harness-thci/OpenThread.py#L1058-L1071
[ "def", "getNetworkFragmentID", "(", "self", ")", ":", "print", "'%s call getNetworkFragmentID'", "%", "self", ".", "port", "if", "not", "self", ".", "__isOpenThreadRunning", "(", ")", ":", "print", "'OpenThread is not running'", "return", "None", "leaderData", "=", ...
0208d10563aa21c518092985c78ecf9cd223ab74
train
OpenThread.getParentAddress
get Thread device's parent extended address and rloc16 short address Returns: The extended address of parent in hex format
tools/harness-thci/OpenThread.py
def getParentAddress(self): """get Thread device's parent extended address and rloc16 short address Returns: The extended address of parent in hex format """ print '%s call getParentAddress' % self.port parentInfo = [] parentInfo = self.__sendCommand('parent'...
def getParentAddress(self): """get Thread device's parent extended address and rloc16 short address Returns: The extended address of parent in hex format """ print '%s call getParentAddress' % self.port parentInfo = [] parentInfo = self.__sendCommand('parent'...
[ "get", "Thread", "device", "s", "parent", "extended", "address", "and", "rloc16", "short", "address" ]
openthread/openthread
python
https://github.com/openthread/openthread/blob/0208d10563aa21c518092985c78ecf9cd223ab74/tools/harness-thci/OpenThread.py#L1073-L1095
[ "def", "getParentAddress", "(", "self", ")", ":", "print", "'%s call getParentAddress'", "%", "self", ".", "port", "parentInfo", "=", "[", "]", "parentInfo", "=", "self", ".", "__sendCommand", "(", "'parent'", ")", "for", "line", "in", "parentInfo", ":", "if...
0208d10563aa21c518092985c78ecf9cd223ab74
train
OpenThread.powerDown
power down the Thread device
tools/harness-thci/OpenThread.py
def powerDown(self): """power down the Thread device""" print '%s call powerDown' % self.port self._sendline('reset') self.isPowerDown = True
def powerDown(self): """power down the Thread device""" print '%s call powerDown' % self.port self._sendline('reset') self.isPowerDown = True
[ "power", "down", "the", "Thread", "device" ]
openthread/openthread
python
https://github.com/openthread/openthread/blob/0208d10563aa21c518092985c78ecf9cd223ab74/tools/harness-thci/OpenThread.py#L1097-L1101
[ "def", "powerDown", "(", "self", ")", ":", "print", "'%s call powerDown'", "%", "self", ".", "port", "self", ".", "_sendline", "(", "'reset'", ")", "self", ".", "isPowerDown", "=", "True" ]
0208d10563aa21c518092985c78ecf9cd223ab74
train
OpenThread.powerUp
power up the Thread device
tools/harness-thci/OpenThread.py
def powerUp(self): """power up the Thread device""" print '%s call powerUp' % self.port if not self.handle: self._connect() self.isPowerDown = False if not self.__isOpenThreadRunning(): self.__startOpenThread()
def powerUp(self): """power up the Thread device""" print '%s call powerUp' % self.port if not self.handle: self._connect() self.isPowerDown = False if not self.__isOpenThreadRunning(): self.__startOpenThread()
[ "power", "up", "the", "Thread", "device" ]
openthread/openthread
python
https://github.com/openthread/openthread/blob/0208d10563aa21c518092985c78ecf9cd223ab74/tools/harness-thci/OpenThread.py#L1103-L1112
[ "def", "powerUp", "(", "self", ")", ":", "print", "'%s call powerUp'", "%", "self", ".", "port", "if", "not", "self", ".", "handle", ":", "self", ".", "_connect", "(", ")", "self", ".", "isPowerDown", "=", "False", "if", "not", "self", ".", "__isOpenTh...
0208d10563aa21c518092985c78ecf9cd223ab74
train
OpenThread.reboot
reset and rejoin to Thread Network without any timeout Returns: True: successful to reset and rejoin the Thread Network False: fail to reset and rejoin the Thread Network
tools/harness-thci/OpenThread.py
def reboot(self): """reset and rejoin to Thread Network without any timeout Returns: True: successful to reset and rejoin the Thread Network False: fail to reset and rejoin the Thread Network """ print '%s call reboot' % self.port try: self._s...
def reboot(self): """reset and rejoin to Thread Network without any timeout Returns: True: successful to reset and rejoin the Thread Network False: fail to reset and rejoin the Thread Network """ print '%s call reboot' % self.port try: self._s...
[ "reset", "and", "rejoin", "to", "Thread", "Network", "without", "any", "timeout" ]
openthread/openthread
python
https://github.com/openthread/openthread/blob/0208d10563aa21c518092985c78ecf9cd223ab74/tools/harness-thci/OpenThread.py#L1114-L1136
[ "def", "reboot", "(", "self", ")", ":", "print", "'%s call reboot'", "%", "self", ".", "port", "try", ":", "self", ".", "_sendline", "(", "'reset'", ")", "self", ".", "isPowerDown", "=", "True", "time", ".", "sleep", "(", "3", ")", "self", ".", "__st...
0208d10563aa21c518092985c78ecf9cd223ab74
train
OpenThread.ping
send ICMPv6 echo request with a given length to a unicast destination address Args: destination: the unicast destination address of ICMPv6 echo request length: the size of ICMPv6 echo request payload
tools/harness-thci/OpenThread.py
def ping(self, destination, length=20): """ send ICMPv6 echo request with a given length to a unicast destination address Args: destination: the unicast destination address of ICMPv6 echo request length: the size of ICMPv6 echo request payload """ pri...
def ping(self, destination, length=20): """ send ICMPv6 echo request with a given length to a unicast destination address Args: destination: the unicast destination address of ICMPv6 echo request length: the size of ICMPv6 echo request payload """ pri...
[ "send", "ICMPv6", "echo", "request", "with", "a", "given", "length", "to", "a", "unicast", "destination", "address" ]
openthread/openthread
python
https://github.com/openthread/openthread/blob/0208d10563aa21c518092985c78ecf9cd223ab74/tools/harness-thci/OpenThread.py#L1138-L1156
[ "def", "ping", "(", "self", ",", "destination", ",", "length", "=", "20", ")", ":", "print", "'%s call ping'", "%", "self", ".", "port", "print", "'destination: %s'", "%", "destination", "try", ":", "cmd", "=", "'ping %s %s'", "%", "(", "destination", ",",...
0208d10563aa21c518092985c78ecf9cd223ab74
train
OpenThread.reset
factory reset
tools/harness-thci/OpenThread.py
def reset(self): """factory reset""" print '%s call reset' % self.port try: self._sendline('factoryreset') self._read() except Exception, e: ModuleHelper.WriteIntoDebugLogger("reset() Error: " + str(e))
def reset(self): """factory reset""" print '%s call reset' % self.port try: self._sendline('factoryreset') self._read() except Exception, e: ModuleHelper.WriteIntoDebugLogger("reset() Error: " + str(e))
[ "factory", "reset" ]
openthread/openthread
python
https://github.com/openthread/openthread/blob/0208d10563aa21c518092985c78ecf9cd223ab74/tools/harness-thci/OpenThread.py#L1213-L1221
[ "def", "reset", "(", "self", ")", ":", "print", "'%s call reset'", "%", "self", ".", "port", "try", ":", "self", ".", "_sendline", "(", "'factoryreset'", ")", "self", ".", "_read", "(", ")", "except", "Exception", ",", "e", ":", "ModuleHelper", ".", "W...
0208d10563aa21c518092985c78ecf9cd223ab74
train
OpenThread.getPollingRate
get data polling rate for sleepy end device
tools/harness-thci/OpenThread.py
def getPollingRate(self): """get data polling rate for sleepy end device""" print '%s call getPollingRate' % self.port sPollingRate = self.__sendCommand('pollperiod')[0] try: iPollingRate = int(sPollingRate)/1000 fPollingRate = round(float(sPollingRate)/1000, 3) ...
def getPollingRate(self): """get data polling rate for sleepy end device""" print '%s call getPollingRate' % self.port sPollingRate = self.__sendCommand('pollperiod')[0] try: iPollingRate = int(sPollingRate)/1000 fPollingRate = round(float(sPollingRate)/1000, 3) ...
[ "get", "data", "polling", "rate", "for", "sleepy", "end", "device" ]
openthread/openthread
python
https://github.com/openthread/openthread/blob/0208d10563aa21c518092985c78ecf9cd223ab74/tools/harness-thci/OpenThread.py#L1301-L1310
[ "def", "getPollingRate", "(", "self", ")", ":", "print", "'%s call getPollingRate'", "%", "self", ".", "port", "sPollingRate", "=", "self", ".", "__sendCommand", "(", "'pollperiod'", ")", "[", "0", "]", "try", ":", "iPollingRate", "=", "int", "(", "sPollingR...
0208d10563aa21c518092985c78ecf9cd223ab74
train
OpenThread.setLinkQuality
set custom LinkQualityIn for all receiving messages from the specified EUIadr Args: EUIadr: a given extended address LinkQuality: a given custom link quality link quality/link margin mapping table 3: 21 - 255 (dB) ...
tools/harness-thci/OpenThread.py
def setLinkQuality(self, EUIadr, LinkQuality): """set custom LinkQualityIn for all receiving messages from the specified EUIadr Args: EUIadr: a given extended address LinkQuality: a given custom link quality link quality/link margin mapping table ...
def setLinkQuality(self, EUIadr, LinkQuality): """set custom LinkQualityIn for all receiving messages from the specified EUIadr Args: EUIadr: a given extended address LinkQuality: a given custom link quality link quality/link margin mapping table ...
[ "set", "custom", "LinkQualityIn", "for", "all", "receiving", "messages", "from", "the", "specified", "EUIadr" ]
openthread/openthread
python
https://github.com/openthread/openthread/blob/0208d10563aa21c518092985c78ecf9cd223ab74/tools/harness-thci/OpenThread.py#L1333-L1369
[ "def", "setLinkQuality", "(", "self", ",", "EUIadr", ",", "LinkQuality", ")", ":", "print", "'%s call setLinkQuality'", "%", "self", ".", "port", "print", "EUIadr", "print", "LinkQuality", "try", ":", "# process EUIadr", "euiHex", "=", "hex", "(", "EUIadr", ")...
0208d10563aa21c518092985c78ecf9cd223ab74
train
OpenThread.setOutBoundLinkQuality
set custom LinkQualityIn for all receiving messages from the any address Args: LinkQuality: a given custom link quality link quality/link margin mapping table 3: 21 - 255 (dB) 2: 11 - 20 (dB) 1: 3 - ...
tools/harness-thci/OpenThread.py
def setOutBoundLinkQuality(self, LinkQuality): """set custom LinkQualityIn for all receiving messages from the any address Args: LinkQuality: a given custom link quality link quality/link margin mapping table 3: 21 - 255 (dB) ...
def setOutBoundLinkQuality(self, LinkQuality): """set custom LinkQualityIn for all receiving messages from the any address Args: LinkQuality: a given custom link quality link quality/link margin mapping table 3: 21 - 255 (dB) ...
[ "set", "custom", "LinkQualityIn", "for", "all", "receiving", "messages", "from", "the", "any", "address" ]
openthread/openthread
python
https://github.com/openthread/openthread/blob/0208d10563aa21c518092985c78ecf9cd223ab74/tools/harness-thci/OpenThread.py#L1371-L1393
[ "def", "setOutBoundLinkQuality", "(", "self", ",", "LinkQuality", ")", ":", "print", "'%s call setOutBoundLinkQuality'", "%", "self", ".", "port", "print", "LinkQuality", "try", ":", "cmd", "=", "'macfilter rss add-lqi * %s'", "%", "str", "(", "LinkQuality", ")", ...
0208d10563aa21c518092985c78ecf9cd223ab74
train
OpenThread.removeRouterPrefix
remove the configured prefix on a border router Args: prefixEntry: a on-mesh prefix entry Returns: True: successful to remove the prefix entry from border router False: fail to remove the prefix entry from border router
tools/harness-thci/OpenThread.py
def removeRouterPrefix(self, prefixEntry): """remove the configured prefix on a border router Args: prefixEntry: a on-mesh prefix entry Returns: True: successful to remove the prefix entry from border router False: fail to remove the prefix entry from border...
def removeRouterPrefix(self, prefixEntry): """remove the configured prefix on a border router Args: prefixEntry: a on-mesh prefix entry Returns: True: successful to remove the prefix entry from border router False: fail to remove the prefix entry from border...
[ "remove", "the", "configured", "prefix", "on", "a", "border", "router" ]
openthread/openthread
python
https://github.com/openthread/openthread/blob/0208d10563aa21c518092985c78ecf9cd223ab74/tools/harness-thci/OpenThread.py#L1395-L1418
[ "def", "removeRouterPrefix", "(", "self", ",", "prefixEntry", ")", ":", "print", "'%s call removeRouterPrefix'", "%", "self", ".", "port", "print", "prefixEntry", "prefix", "=", "self", ".", "__convertIp6PrefixStringToIp6Address", "(", "str", "(", "prefixEntry", ")"...
0208d10563aa21c518092985c78ecf9cd223ab74
train
OpenThread.resetAndRejoin
reset and join back Thread Network with a given timeout delay Args: timeout: a timeout interval before rejoin Thread Network Returns: True: successful to reset and rejoin Thread Network False: fail to reset and rejoin the Thread Network
tools/harness-thci/OpenThread.py
def resetAndRejoin(self, timeout): """reset and join back Thread Network with a given timeout delay Args: timeout: a timeout interval before rejoin Thread Network Returns: True: successful to reset and rejoin Thread Network False: fail to reset and rejoin th...
def resetAndRejoin(self, timeout): """reset and join back Thread Network with a given timeout delay Args: timeout: a timeout interval before rejoin Thread Network Returns: True: successful to reset and rejoin Thread Network False: fail to reset and rejoin th...
[ "reset", "and", "join", "back", "Thread", "Network", "with", "a", "given", "timeout", "delay" ]
openthread/openthread
python
https://github.com/openthread/openthread/blob/0208d10563aa21c518092985c78ecf9cd223ab74/tools/harness-thci/OpenThread.py#L1420-L1448
[ "def", "resetAndRejoin", "(", "self", ",", "timeout", ")", ":", "print", "'%s call resetAndRejoin'", "%", "self", ".", "port", "print", "timeout", "try", ":", "self", ".", "_sendline", "(", "'reset'", ")", "self", ".", "isPowerDown", "=", "True", "time", "...
0208d10563aa21c518092985c78ecf9cd223ab74
train
OpenThread.setNetworkIDTimeout
set networkid timeout for Thread device Args: iNwkIDTimeOut: a given NETWORK_ID_TIMEOUT Returns: True: successful to set NETWORK_ID_TIMEOUT False: fail to set NETWORK_ID_TIMEOUT
tools/harness-thci/OpenThread.py
def setNetworkIDTimeout(self, iNwkIDTimeOut): """set networkid timeout for Thread device Args: iNwkIDTimeOut: a given NETWORK_ID_TIMEOUT Returns: True: successful to set NETWORK_ID_TIMEOUT False: fail to set NETWORK_ID_TIMEOUT """ print '%s c...
def setNetworkIDTimeout(self, iNwkIDTimeOut): """set networkid timeout for Thread device Args: iNwkIDTimeOut: a given NETWORK_ID_TIMEOUT Returns: True: successful to set NETWORK_ID_TIMEOUT False: fail to set NETWORK_ID_TIMEOUT """ print '%s c...
[ "set", "networkid", "timeout", "for", "Thread", "device" ]
openthread/openthread
python
https://github.com/openthread/openthread/blob/0208d10563aa21c518092985c78ecf9cd223ab74/tools/harness-thci/OpenThread.py#L1514-L1532
[ "def", "setNetworkIDTimeout", "(", "self", ",", "iNwkIDTimeOut", ")", ":", "print", "'%s call setNetworkIDTimeout'", "%", "self", ".", "port", "print", "iNwkIDTimeOut", "iNwkIDTimeOut", "/=", "1000", "try", ":", "cmd", "=", "'networkidtimeout %s'", "%", "str", "("...
0208d10563aa21c518092985c78ecf9cd223ab74
train
OpenThread.setNetworkDataRequirement
set whether the Thread device requires the full network data or only requires the stable network data Args: eDataRequirement: is true if requiring the full network data Returns: True: successful to set the network requirement
tools/harness-thci/OpenThread.py
def setNetworkDataRequirement(self, eDataRequirement): """set whether the Thread device requires the full network data or only requires the stable network data Args: eDataRequirement: is true if requiring the full network data Returns: True: successful to set...
def setNetworkDataRequirement(self, eDataRequirement): """set whether the Thread device requires the full network data or only requires the stable network data Args: eDataRequirement: is true if requiring the full network data Returns: True: successful to set...
[ "set", "whether", "the", "Thread", "device", "requires", "the", "full", "network", "data", "or", "only", "requires", "the", "stable", "network", "data" ]
openthread/openthread
python
https://github.com/openthread/openthread/blob/0208d10563aa21c518092985c78ecf9cd223ab74/tools/harness-thci/OpenThread.py#L1605-L1620
[ "def", "setNetworkDataRequirement", "(", "self", ",", "eDataRequirement", ")", ":", "print", "'%s call setNetworkDataRequirement'", "%", "self", ".", "port", "print", "eDataRequirement", "if", "eDataRequirement", "==", "Device_Data_Requirement", ".", "ALL_DATA", ":", "s...
0208d10563aa21c518092985c78ecf9cd223ab74
train
OpenThread.configExternalRouter
configure border router with a given external route prefix entry Args: P_Prefix: IPv6 prefix for the route P_Stable: is true if the external route prefix is stable network data R_Preference: a two-bit signed integer indicating Router preference 1: h...
tools/harness-thci/OpenThread.py
def configExternalRouter(self, P_Prefix, P_stable, R_Preference=0): """configure border router with a given external route prefix entry Args: P_Prefix: IPv6 prefix for the route P_Stable: is true if the external route prefix is stable network data R_Preference: a two...
def configExternalRouter(self, P_Prefix, P_stable, R_Preference=0): """configure border router with a given external route prefix entry Args: P_Prefix: IPv6 prefix for the route P_Stable: is true if the external route prefix is stable network data R_Preference: a two...
[ "configure", "border", "router", "with", "a", "given", "external", "route", "prefix", "entry" ]
openthread/openthread
python
https://github.com/openthread/openthread/blob/0208d10563aa21c518092985c78ecf9cd223ab74/tools/harness-thci/OpenThread.py#L1622-L1662
[ "def", "configExternalRouter", "(", "self", ",", "P_Prefix", ",", "P_stable", ",", "R_Preference", "=", "0", ")", ":", "print", "'%s call configExternalRouter'", "%", "self", ".", "port", "print", "P_Prefix", "stable", "=", "''", "prefix", "=", "self", ".", ...
0208d10563aa21c518092985c78ecf9cd223ab74
train
OpenThread.getNeighbouringRouters
get neighboring routers information Returns: neighboring routers' extended address
tools/harness-thci/OpenThread.py
def getNeighbouringRouters(self): """get neighboring routers information Returns: neighboring routers' extended address """ print '%s call getNeighbouringRouters' % self.port try: routerInfo = [] routerList = [] routerList = self._...
def getNeighbouringRouters(self): """get neighboring routers information Returns: neighboring routers' extended address """ print '%s call getNeighbouringRouters' % self.port try: routerInfo = [] routerList = [] routerList = self._...
[ "get", "neighboring", "routers", "information" ]
openthread/openthread
python
https://github.com/openthread/openthread/blob/0208d10563aa21c518092985c78ecf9cd223ab74/tools/harness-thci/OpenThread.py#L1664-L1704
[ "def", "getNeighbouringRouters", "(", "self", ")", ":", "print", "'%s call getNeighbouringRouters'", "%", "self", ".", "port", "try", ":", "routerInfo", "=", "[", "]", "routerList", "=", "[", "]", "routerList", "=", "self", ".", "__sendCommand", "(", "'router ...
0208d10563aa21c518092985c78ecf9cd223ab74
train
OpenThread.getChildrenInfo
get all children information Returns: children's extended address
tools/harness-thci/OpenThread.py
def getChildrenInfo(self): """get all children information Returns: children's extended address """ print '%s call getChildrenInfo' % self.port try: childrenInfoAll = [] childrenInfo = {'EUI': 0, 'Rloc16': 0, 'MLEID': ''} childrenL...
def getChildrenInfo(self): """get all children information Returns: children's extended address """ print '%s call getChildrenInfo' % self.port try: childrenInfoAll = [] childrenInfo = {'EUI': 0, 'Rloc16': 0, 'MLEID': ''} childrenL...
[ "get", "all", "children", "information" ]
openthread/openthread
python
https://github.com/openthread/openthread/blob/0208d10563aa21c518092985c78ecf9cd223ab74/tools/harness-thci/OpenThread.py#L1706-L1752
[ "def", "getChildrenInfo", "(", "self", ")", ":", "print", "'%s call getChildrenInfo'", "%", "self", ".", "port", "try", ":", "childrenInfoAll", "=", "[", "]", "childrenInfo", "=", "{", "'EUI'", ":", "0", ",", "'Rloc16'", ":", "0", ",", "'MLEID'", ":", "'...
0208d10563aa21c518092985c78ecf9cd223ab74
train
OpenThread.getNeighbouringDevices
gets the neighboring devices' extended address to compute the DUT extended address automatically Returns: A list including extended address of neighboring routers, parent as well as children
tools/harness-thci/OpenThread.py
def getNeighbouringDevices(self): """gets the neighboring devices' extended address to compute the DUT extended address automatically Returns: A list including extended address of neighboring routers, parent as well as children """ print '%s call getNe...
def getNeighbouringDevices(self): """gets the neighboring devices' extended address to compute the DUT extended address automatically Returns: A list including extended address of neighboring routers, parent as well as children """ print '%s call getNe...
[ "gets", "the", "neighboring", "devices", "extended", "address", "to", "compute", "the", "DUT", "extended", "address", "automatically" ]
openthread/openthread
python
https://github.com/openthread/openthread/blob/0208d10563aa21c518092985c78ecf9cd223ab74/tools/harness-thci/OpenThread.py#L1788-L1817
[ "def", "getNeighbouringDevices", "(", "self", ")", ":", "print", "'%s call getNeighbouringDevices'", "%", "self", ".", "port", "neighbourList", "=", "[", "]", "# get parent info", "parentAddr", "=", "self", ".", "getParentAddress", "(", ")", "if", "parentAddr", "!...
0208d10563aa21c518092985c78ecf9cd223ab74
train
OpenThread.getGUA
get expected global unicast IPv6 address of Thread device Args: filterByPrefix: a given expected global IPv6 prefix to be matched Returns: a global IPv6 address
tools/harness-thci/OpenThread.py
def getGUA(self, filterByPrefix=None): """get expected global unicast IPv6 address of Thread device Args: filterByPrefix: a given expected global IPv6 prefix to be matched Returns: a global IPv6 address """ print '%s call getGUA' % self.port prin...
def getGUA(self, filterByPrefix=None): """get expected global unicast IPv6 address of Thread device Args: filterByPrefix: a given expected global IPv6 prefix to be matched Returns: a global IPv6 address """ print '%s call getGUA' % self.port prin...
[ "get", "expected", "global", "unicast", "IPv6", "address", "of", "Thread", "device" ]
openthread/openthread
python
https://github.com/openthread/openthread/blob/0208d10563aa21c518092985c78ecf9cd223ab74/tools/harness-thci/OpenThread.py#L1836-L1862
[ "def", "getGUA", "(", "self", ",", "filterByPrefix", "=", "None", ")", ":", "print", "'%s call getGUA'", "%", "self", ".", "port", "print", "filterByPrefix", "globalAddrs", "=", "[", "]", "try", ":", "# get global addrs set if multiple", "globalAddrs", "=", "sel...
0208d10563aa21c518092985c78ecf9cd223ab74
train
OpenThread.setMLPrefix
set mesh local prefix
tools/harness-thci/OpenThread.py
def setMLPrefix(self, sMeshLocalPrefix): """set mesh local prefix""" print '%s call setMLPrefix' % self.port try: cmd = 'dataset meshlocalprefix %s' % sMeshLocalPrefix self.hasActiveDatasetToCommit = True return self.__sendCommand(cmd)[0] == 'Done' exc...
def setMLPrefix(self, sMeshLocalPrefix): """set mesh local prefix""" print '%s call setMLPrefix' % self.port try: cmd = 'dataset meshlocalprefix %s' % sMeshLocalPrefix self.hasActiveDatasetToCommit = True return self.__sendCommand(cmd)[0] == 'Done' exc...
[ "set", "mesh", "local", "prefix" ]
openthread/openthread
python
https://github.com/openthread/openthread/blob/0208d10563aa21c518092985c78ecf9cd223ab74/tools/harness-thci/OpenThread.py#L1874-L1882
[ "def", "setMLPrefix", "(", "self", ",", "sMeshLocalPrefix", ")", ":", "print", "'%s call setMLPrefix'", "%", "self", ".", "port", "try", ":", "cmd", "=", "'dataset meshlocalprefix %s'", "%", "sMeshLocalPrefix", "self", ".", "hasActiveDatasetToCommit", "=", "True", ...
0208d10563aa21c518092985c78ecf9cd223ab74
train
OpenThread.forceSetSlaac
force to set a slaac IPv6 address to Thread interface Args: slaacAddress: a slaac IPv6 address to be set Returns: True: successful to set slaac address to Thread interface False: fail to set slaac address to Thread interface
tools/harness-thci/OpenThread.py
def forceSetSlaac(self, slaacAddress): """force to set a slaac IPv6 address to Thread interface Args: slaacAddress: a slaac IPv6 address to be set Returns: True: successful to set slaac address to Thread interface False: fail to set slaac address to Thread i...
def forceSetSlaac(self, slaacAddress): """force to set a slaac IPv6 address to Thread interface Args: slaacAddress: a slaac IPv6 address to be set Returns: True: successful to set slaac address to Thread interface False: fail to set slaac address to Thread i...
[ "force", "to", "set", "a", "slaac", "IPv6", "address", "to", "Thread", "interface" ]
openthread/openthread
python
https://github.com/openthread/openthread/blob/0208d10563aa21c518092985c78ecf9cd223ab74/tools/harness-thci/OpenThread.py#L1895-L1912
[ "def", "forceSetSlaac", "(", "self", ",", "slaacAddress", ")", ":", "print", "'%s call forceSetSlaac'", "%", "self", ".", "port", "print", "slaacAddress", "try", ":", "cmd", "=", "'ipaddr add %s'", "%", "str", "(", "slaacAddress", ")", "print", "cmd", "return"...
0208d10563aa21c518092985c78ecf9cd223ab74
train
OpenThread.startCollapsedCommissioner
start Collapsed Commissioner Returns: True: successful to start Commissioner False: fail to start Commissioner
tools/harness-thci/OpenThread.py
def startCollapsedCommissioner(self): """start Collapsed Commissioner Returns: True: successful to start Commissioner False: fail to start Commissioner """ print '%s call startCollapsedCommissioner' % self.port if self.__startOpenThread(): tim...
def startCollapsedCommissioner(self): """start Collapsed Commissioner Returns: True: successful to start Commissioner False: fail to start Commissioner """ print '%s call startCollapsedCommissioner' % self.port if self.__startOpenThread(): tim...
[ "start", "Collapsed", "Commissioner" ]
openthread/openthread
python
https://github.com/openthread/openthread/blob/0208d10563aa21c518092985c78ecf9cd223ab74/tools/harness-thci/OpenThread.py#L1967-L1983
[ "def", "startCollapsedCommissioner", "(", "self", ")", ":", "print", "'%s call startCollapsedCommissioner'", "%", "self", ".", "port", "if", "self", ".", "__startOpenThread", "(", ")", ":", "time", ".", "sleep", "(", "20", ")", "cmd", "=", "'commissioner start'"...
0208d10563aa21c518092985c78ecf9cd223ab74
train
OpenThread.scanJoiner
scan Joiner Args: xEUI: Joiner's EUI-64 strPSKd: Joiner's PSKd for commissioning Returns: True: successful to add Joiner's steering data False: fail to add Joiner's steering data
tools/harness-thci/OpenThread.py
def scanJoiner(self, xEUI='*', strPSKd='threadjpaketest'): """scan Joiner Args: xEUI: Joiner's EUI-64 strPSKd: Joiner's PSKd for commissioning Returns: True: successful to add Joiner's steering data False: fail to add Joiner's steering data ...
def scanJoiner(self, xEUI='*', strPSKd='threadjpaketest'): """scan Joiner Args: xEUI: Joiner's EUI-64 strPSKd: Joiner's PSKd for commissioning Returns: True: successful to add Joiner's steering data False: fail to add Joiner's steering data ...
[ "scan", "Joiner" ]
openthread/openthread
python
https://github.com/openthread/openthread/blob/0208d10563aa21c518092985c78ecf9cd223ab74/tools/harness-thci/OpenThread.py#L1988-L2021
[ "def", "scanJoiner", "(", "self", ",", "xEUI", "=", "'*'", ",", "strPSKd", "=", "'threadjpaketest'", ")", ":", "print", "'%s call scanJoiner'", "%", "self", ".", "port", "# long timeout value to avoid automatic joiner removal (in seconds)", "timeout", "=", "500", "if"...
0208d10563aa21c518092985c78ecf9cd223ab74
train
OpenThread.joinCommissioned
start joiner Args: strPSKd: Joiner's PSKd Returns: True: successful to start joiner False: fail to start joiner
tools/harness-thci/OpenThread.py
def joinCommissioned(self, strPSKd='threadjpaketest', waitTime=20): """start joiner Args: strPSKd: Joiner's PSKd Returns: True: successful to start joiner False: fail to start joiner """ print '%s call joinCommissioned' % self.port se...
def joinCommissioned(self, strPSKd='threadjpaketest', waitTime=20): """start joiner Args: strPSKd: Joiner's PSKd Returns: True: successful to start joiner False: fail to start joiner """ print '%s call joinCommissioned' % self.port se...
[ "start", "joiner" ]
openthread/openthread
python
https://github.com/openthread/openthread/blob/0208d10563aa21c518092985c78ecf9cd223ab74/tools/harness-thci/OpenThread.py#L2060-L2094
[ "def", "joinCommissioned", "(", "self", ",", "strPSKd", "=", "'threadjpaketest'", ",", "waitTime", "=", "20", ")", ":", "print", "'%s call joinCommissioned'", "%", "self", ".", "port", "self", ".", "__sendCommand", "(", "'ifconfig up'", ")", "cmd", "=", "'join...
0208d10563aa21c518092985c78ecf9cd223ab74
train
OpenThread.getCommissioningLogs
get Commissioning logs Returns: Commissioning logs
tools/harness-thci/OpenThread.py
def getCommissioningLogs(self): """get Commissioning logs Returns: Commissioning logs """ rawLogs = self.logThread.get() ProcessedLogs = [] payload = [] while not rawLogs.empty(): rawLogEach = rawLogs.get() print rawLogEach ...
def getCommissioningLogs(self): """get Commissioning logs Returns: Commissioning logs """ rawLogs = self.logThread.get() ProcessedLogs = [] payload = [] while not rawLogs.empty(): rawLogEach = rawLogs.get() print rawLogEach ...
[ "get", "Commissioning", "logs" ]
openthread/openthread
python
https://github.com/openthread/openthread/blob/0208d10563aa21c518092985c78ecf9cd223ab74/tools/harness-thci/OpenThread.py#L2096-L2146
[ "def", "getCommissioningLogs", "(", "self", ")", ":", "rawLogs", "=", "self", ".", "logThread", ".", "get", "(", ")", "ProcessedLogs", "=", "[", "]", "payload", "=", "[", "]", "while", "not", "rawLogs", ".", "empty", "(", ")", ":", "rawLogEach", "=", ...
0208d10563aa21c518092985c78ecf9cd223ab74
train
OpenThread.MGMT_ED_SCAN
send MGMT_ED_SCAN message to a given destinaition. Args: sAddr: IPv6 destination address for this message xCommissionerSessionId: commissioner session id listChannelMask: a channel array to indicate which channels to be scaned xCount: number of IEEE 802.15.4 ED S...
tools/harness-thci/OpenThread.py
def MGMT_ED_SCAN(self, sAddr, xCommissionerSessionId, listChannelMask, xCount, xPeriod, xScanDuration): """send MGMT_ED_SCAN message to a given destinaition. Args: sAddr: IPv6 destination address for this message xCommissionerSessionId: commissioner session id listCh...
def MGMT_ED_SCAN(self, sAddr, xCommissionerSessionId, listChannelMask, xCount, xPeriod, xScanDuration): """send MGMT_ED_SCAN message to a given destinaition. Args: sAddr: IPv6 destination address for this message xCommissionerSessionId: commissioner session id listCh...
[ "send", "MGMT_ED_SCAN", "message", "to", "a", "given", "destinaition", "." ]
openthread/openthread
python
https://github.com/openthread/openthread/blob/0208d10563aa21c518092985c78ecf9cd223ab74/tools/harness-thci/OpenThread.py#L2148-L2171
[ "def", "MGMT_ED_SCAN", "(", "self", ",", "sAddr", ",", "xCommissionerSessionId", ",", "listChannelMask", ",", "xCount", ",", "xPeriod", ",", "xScanDuration", ")", ":", "print", "'%s call MGMT_ED_SCAN'", "%", "self", ".", "port", "channelMask", "=", "''", "channe...
0208d10563aa21c518092985c78ecf9cd223ab74
train
OpenThread.MGMT_PANID_QUERY
send MGMT_PANID_QUERY message to a given destination Args: xPanId: a given PAN ID to check the conflicts Returns: True: successful to send MGMT_PANID_QUERY message. False: fail to send MGMT_PANID_QUERY message.
tools/harness-thci/OpenThread.py
def MGMT_PANID_QUERY(self, sAddr, xCommissionerSessionId, listChannelMask, xPanId): """send MGMT_PANID_QUERY message to a given destination Args: xPanId: a given PAN ID to check the conflicts Returns: True: successful to send MGMT_PANID_QUERY message. False:...
def MGMT_PANID_QUERY(self, sAddr, xCommissionerSessionId, listChannelMask, xPanId): """send MGMT_PANID_QUERY message to a given destination Args: xPanId: a given PAN ID to check the conflicts Returns: True: successful to send MGMT_PANID_QUERY message. False:...
[ "send", "MGMT_PANID_QUERY", "message", "to", "a", "given", "destination" ]
openthread/openthread
python
https://github.com/openthread/openthread/blob/0208d10563aa21c518092985c78ecf9cd223ab74/tools/harness-thci/OpenThread.py#L2173-L2196
[ "def", "MGMT_PANID_QUERY", "(", "self", ",", "sAddr", ",", "xCommissionerSessionId", ",", "listChannelMask", ",", "xPanId", ")", ":", "print", "'%s call MGMT_PANID_QUERY'", "%", "self", ".", "port", "panid", "=", "''", "channelMask", "=", "''", "channelMask", "=...
0208d10563aa21c518092985c78ecf9cd223ab74
train
OpenThread.MGMT_ACTIVE_SET
send MGMT_ACTIVE_SET command Returns: True: successful to send MGMT_ACTIVE_SET False: fail to send MGMT_ACTIVE_SET
tools/harness-thci/OpenThread.py
def MGMT_ACTIVE_SET(self, sAddr='', xCommissioningSessionId=None, listActiveTimestamp=None, listChannelMask=None, xExtendedPanId=None, sNetworkName=None, sPSKc=None, listSecurityPolicy=None, xChannel=None, sMeshLocalPrefix=None, xMasterKey=None, xPanId=None, xTmfPort=None...
def MGMT_ACTIVE_SET(self, sAddr='', xCommissioningSessionId=None, listActiveTimestamp=None, listChannelMask=None, xExtendedPanId=None, sNetworkName=None, sPSKc=None, listSecurityPolicy=None, xChannel=None, sMeshLocalPrefix=None, xMasterKey=None, xPanId=None, xTmfPort=None...
[ "send", "MGMT_ACTIVE_SET", "command" ]
openthread/openthread
python
https://github.com/openthread/openthread/blob/0208d10563aa21c518092985c78ecf9cd223ab74/tools/harness-thci/OpenThread.py#L2242-L2380
[ "def", "MGMT_ACTIVE_SET", "(", "self", ",", "sAddr", "=", "''", ",", "xCommissioningSessionId", "=", "None", ",", "listActiveTimestamp", "=", "None", ",", "listChannelMask", "=", "None", ",", "xExtendedPanId", "=", "None", ",", "sNetworkName", "=", "None", ","...
0208d10563aa21c518092985c78ecf9cd223ab74
train
OpenThread.MGMT_PENDING_SET
send MGMT_PENDING_SET command Returns: True: successful to send MGMT_PENDING_SET False: fail to send MGMT_PENDING_SET
tools/harness-thci/OpenThread.py
def MGMT_PENDING_SET(self, sAddr='', xCommissionerSessionId=None, listPendingTimestamp=None, listActiveTimestamp=None, xDelayTimer=None, xChannel=None, xPanId=None, xMasterKey=None, sMeshLocalPrefix=None, sNetworkName=None): """send MGMT_PENDING_SET command Returns: ...
def MGMT_PENDING_SET(self, sAddr='', xCommissionerSessionId=None, listPendingTimestamp=None, listActiveTimestamp=None, xDelayTimer=None, xChannel=None, xPanId=None, xMasterKey=None, sMeshLocalPrefix=None, sNetworkName=None): """send MGMT_PENDING_SET command Returns: ...
[ "send", "MGMT_PENDING_SET", "command" ]
openthread/openthread
python
https://github.com/openthread/openthread/blob/0208d10563aa21c518092985c78ecf9cd223ab74/tools/harness-thci/OpenThread.py#L2409-L2474
[ "def", "MGMT_PENDING_SET", "(", "self", ",", "sAddr", "=", "''", ",", "xCommissionerSessionId", "=", "None", ",", "listPendingTimestamp", "=", "None", ",", "listActiveTimestamp", "=", "None", ",", "xDelayTimer", "=", "None", ",", "xChannel", "=", "None", ",", ...
0208d10563aa21c518092985c78ecf9cd223ab74
train
OpenThread.MGMT_COMM_GET
send MGMT_COMM_GET command Returns: True: successful to send MGMT_COMM_GET False: fail to send MGMT_COMM_GET
tools/harness-thci/OpenThread.py
def MGMT_COMM_GET(self, Addr='ff02::1', TLVs=[]): """send MGMT_COMM_GET command Returns: True: successful to send MGMT_COMM_GET False: fail to send MGMT_COMM_GET """ print '%s call MGMT_COMM_GET' % self.port try: cmd = 'commissioner mgmtget' ...
def MGMT_COMM_GET(self, Addr='ff02::1', TLVs=[]): """send MGMT_COMM_GET command Returns: True: successful to send MGMT_COMM_GET False: fail to send MGMT_COMM_GET """ print '%s call MGMT_COMM_GET' % self.port try: cmd = 'commissioner mgmtget' ...
[ "send", "MGMT_COMM_GET", "command" ]
openthread/openthread
python
https://github.com/openthread/openthread/blob/0208d10563aa21c518092985c78ecf9cd223ab74/tools/harness-thci/OpenThread.py#L2476-L2497
[ "def", "MGMT_COMM_GET", "(", "self", ",", "Addr", "=", "'ff02::1'", ",", "TLVs", "=", "[", "]", ")", ":", "print", "'%s call MGMT_COMM_GET'", "%", "self", ".", "port", "try", ":", "cmd", "=", "'commissioner mgmtget'", "if", "len", "(", "TLVs", ")", "!=",...
0208d10563aa21c518092985c78ecf9cd223ab74
train
OpenThread.MGMT_COMM_SET
send MGMT_COMM_SET command Returns: True: successful to send MGMT_COMM_SET False: fail to send MGMT_COMM_SET
tools/harness-thci/OpenThread.py
def MGMT_COMM_SET(self, Addr='ff02::1', xCommissionerSessionID=None, xSteeringData=None, xBorderRouterLocator=None, xChannelTlv=None, ExceedMaxPayload=False): """send MGMT_COMM_SET command Returns: True: successful to send MGMT_COMM_SET False: fail to send ...
def MGMT_COMM_SET(self, Addr='ff02::1', xCommissionerSessionID=None, xSteeringData=None, xBorderRouterLocator=None, xChannelTlv=None, ExceedMaxPayload=False): """send MGMT_COMM_SET command Returns: True: successful to send MGMT_COMM_SET False: fail to send ...
[ "send", "MGMT_COMM_SET", "command" ]
openthread/openthread
python
https://github.com/openthread/openthread/blob/0208d10563aa21c518092985c78ecf9cd223ab74/tools/harness-thci/OpenThread.py#L2499-L2540
[ "def", "MGMT_COMM_SET", "(", "self", ",", "Addr", "=", "'ff02::1'", ",", "xCommissionerSessionID", "=", "None", ",", "xSteeringData", "=", "None", ",", "xBorderRouterLocator", "=", "None", ",", "xChannelTlv", "=", "None", ",", "ExceedMaxPayload", "=", "False", ...
0208d10563aa21c518092985c78ecf9cd223ab74
train
OpenThread.setUdpJoinerPort
set Joiner UDP Port Args: portNumber: Joiner UDP Port number Returns: True: successful to set Joiner UDP Port False: fail to set Joiner UDP Port
tools/harness-thci/OpenThread.py
def setUdpJoinerPort(self, portNumber): """set Joiner UDP Port Args: portNumber: Joiner UDP Port number Returns: True: successful to set Joiner UDP Port False: fail to set Joiner UDP Port """ print '%s call setUdpJoinerPort' % self.port ...
def setUdpJoinerPort(self, portNumber): """set Joiner UDP Port Args: portNumber: Joiner UDP Port number Returns: True: successful to set Joiner UDP Port False: fail to set Joiner UDP Port """ print '%s call setUdpJoinerPort' % self.port ...
[ "set", "Joiner", "UDP", "Port" ]
openthread/openthread
python
https://github.com/openthread/openthread/blob/0208d10563aa21c518092985c78ecf9cd223ab74/tools/harness-thci/OpenThread.py#L2567-L2580
[ "def", "setUdpJoinerPort", "(", "self", ",", "portNumber", ")", ":", "print", "'%s call setUdpJoinerPort'", "%", "self", ".", "port", "cmd", "=", "'joinerport %d'", "%", "portNumber", "print", "cmd", "return", "self", ".", "__sendCommand", "(", "cmd", ")", "["...
0208d10563aa21c518092985c78ecf9cd223ab74
train
OpenThread.commissionerUnregister
stop commissioner Returns: True: successful to stop commissioner False: fail to stop commissioner
tools/harness-thci/OpenThread.py
def commissionerUnregister(self): """stop commissioner Returns: True: successful to stop commissioner False: fail to stop commissioner """ print '%s call commissionerUnregister' % self.port cmd = 'commissioner stop' print cmd return self._...
def commissionerUnregister(self): """stop commissioner Returns: True: successful to stop commissioner False: fail to stop commissioner """ print '%s call commissionerUnregister' % self.port cmd = 'commissioner stop' print cmd return self._...
[ "stop", "commissioner" ]
openthread/openthread
python
https://github.com/openthread/openthread/blob/0208d10563aa21c518092985c78ecf9cd223ab74/tools/harness-thci/OpenThread.py#L2582-L2592
[ "def", "commissionerUnregister", "(", "self", ")", ":", "print", "'%s call commissionerUnregister'", "%", "self", ".", "port", "cmd", "=", "'commissioner stop'", "print", "cmd", "return", "self", ".", "__sendCommand", "(", "cmd", ")", "[", "0", "]", "==", "'Do...
0208d10563aa21c518092985c78ecf9cd223ab74
train
OpenThread.updateRouterStatus
force update to router as if there is child id request
tools/harness-thci/OpenThread.py
def updateRouterStatus(self): """force update to router as if there is child id request""" print '%s call updateRouterStatus' % self.port cmd = 'state' while True: state = self.__sendCommand(cmd)[0] if state == 'detached': continue elif...
def updateRouterStatus(self): """force update to router as if there is child id request""" print '%s call updateRouterStatus' % self.port cmd = 'state' while True: state = self.__sendCommand(cmd)[0] if state == 'detached': continue elif...
[ "force", "update", "to", "router", "as", "if", "there", "is", "child", "id", "request" ]
openthread/openthread
python
https://github.com/openthread/openthread/blob/0208d10563aa21c518092985c78ecf9cd223ab74/tools/harness-thci/OpenThread.py#L2599-L2613
[ "def", "updateRouterStatus", "(", "self", ")", ":", "print", "'%s call updateRouterStatus'", "%", "self", ".", "port", "cmd", "=", "'state'", "while", "True", ":", "state", "=", "self", ".", "__sendCommand", "(", "cmd", ")", "[", "0", "]", "if", "state", ...
0208d10563aa21c518092985c78ecf9cd223ab74
train
OpenThreadController._expect
Find the `expected` line within `times` trials. Args: expected str: the expected string times int: number of trials
tools/harness-automation/autothreadharness/open_thread_controller.py
def _expect(self, expected, times=50): """Find the `expected` line within `times` trials. Args: expected str: the expected string times int: number of trials """ logger.debug('[%s] Expecting [%s]', self.port, expected) retry_times = 10 wh...
def _expect(self, expected, times=50): """Find the `expected` line within `times` trials. Args: expected str: the expected string times int: number of trials """ logger.debug('[%s] Expecting [%s]', self.port, expected) retry_times = 10 wh...
[ "Find", "the", "expected", "line", "within", "times", "trials", "." ]
openthread/openthread
python
https://github.com/openthread/openthread/blob/0208d10563aa21c518092985c78ecf9cd223ab74/tools/harness-automation/autothreadharness/open_thread_controller.py#L123-L147
[ "def", "_expect", "(", "self", ",", "expected", ",", "times", "=", "50", ")", ":", "logger", ".", "debug", "(", "'[%s] Expecting [%s]'", ",", "self", ".", "port", ",", "expected", ")", "retry_times", "=", "10", "while", "times", ":", "if", "not", "retr...
0208d10563aa21c518092985c78ecf9cd223ab74
train
OpenThreadController._readline
Read exactly one line from the device, nonblocking. Returns: None on no data
tools/harness-automation/autothreadharness/open_thread_controller.py
def _readline(self): """Read exactly one line from the device, nonblocking. Returns: None on no data """ if len(self.lines) > 1: return self.lines.pop(0) tail = '' if len(self.lines): tail = self.lines.pop() try: ...
def _readline(self): """Read exactly one line from the device, nonblocking. Returns: None on no data """ if len(self.lines) > 1: return self.lines.pop(0) tail = '' if len(self.lines): tail = self.lines.pop() try: ...
[ "Read", "exactly", "one", "line", "from", "the", "device", "nonblocking", "." ]
openthread/openthread
python
https://github.com/openthread/openthread/blob/0208d10563aa21c518092985c78ecf9cd223ab74/tools/harness-automation/autothreadharness/open_thread_controller.py#L149-L170
[ "def", "_readline", "(", "self", ")", ":", "if", "len", "(", "self", ".", "lines", ")", ">", "1", ":", "return", "self", ".", "lines", ".", "pop", "(", "0", ")", "tail", "=", "''", "if", "len", "(", "self", ".", "lines", ")", ":", "tail", "="...
0208d10563aa21c518092985c78ecf9cd223ab74
train
OpenThreadController._sendline
Send exactly one line to the device Args: line str: data send to device
tools/harness-automation/autothreadharness/open_thread_controller.py
def _sendline(self, line): """Send exactly one line to the device Args: line str: data send to device """ self.lines = [] try: self._read() except socket.error: logging.debug('Nothing cleared') logger.debug('sending [%s]', lin...
def _sendline(self, line): """Send exactly one line to the device Args: line str: data send to device """ self.lines = [] try: self._read() except socket.error: logging.debug('Nothing cleared') logger.debug('sending [%s]', lin...
[ "Send", "exactly", "one", "line", "to", "the", "device" ]
openthread/openthread
python
https://github.com/openthread/openthread/blob/0208d10563aa21c518092985c78ecf9cd223ab74/tools/harness-automation/autothreadharness/open_thread_controller.py#L172-L188
[ "def", "_sendline", "(", "self", ",", "line", ")", ":", "self", ".", "lines", "=", "[", "]", "try", ":", "self", ".", "_read", "(", ")", "except", "socket", ".", "error", ":", "logging", ".", "debug", "(", "'Nothing cleared'", ")", "logger", ".", "...
0208d10563aa21c518092985c78ecf9cd223ab74
train
OpenThreadController._req
Send command and wait for response. The command will be repeated 3 times at most in case data loss of serial port. Args: req (str): Command to send, please do not include new line in the end. Returns: [str]: The output lines
tools/harness-automation/autothreadharness/open_thread_controller.py
def _req(self, req): """Send command and wait for response. The command will be repeated 3 times at most in case data loss of serial port. Args: req (str): Command to send, please do not include new line in the end. Returns: [str]: The output lines """ ...
def _req(self, req): """Send command and wait for response. The command will be repeated 3 times at most in case data loss of serial port. Args: req (str): Command to send, please do not include new line in the end. Returns: [str]: The output lines """ ...
[ "Send", "command", "and", "wait", "for", "response", "." ]
openthread/openthread
python
https://github.com/openthread/openthread/blob/0208d10563aa21c518092985c78ecf9cd223ab74/tools/harness-automation/autothreadharness/open_thread_controller.py#L190-L232
[ "def", "_req", "(", "self", ",", "req", ")", ":", "logger", ".", "debug", "(", "'DUT> %s'", ",", "req", ")", "self", ".", "_log", "and", "self", ".", "pause", "(", ")", "times", "=", "3", "res", "=", "None", "while", "times", ":", "times", "=", ...
0208d10563aa21c518092985c78ecf9cd223ab74
train
OpenThreadController.run
Threading callback
tools/harness-automation/autothreadharness/open_thread_controller.py
def run(self): """Threading callback""" self.viewing = True while self.viewing and self._lock.acquire(): try: line = self._readline() except: pass else: logger.info(line) self._lock.release() ...
def run(self): """Threading callback""" self.viewing = True while self.viewing and self._lock.acquire(): try: line = self._readline() except: pass else: logger.info(line) self._lock.release() ...
[ "Threading", "callback" ]
openthread/openthread
python
https://github.com/openthread/openthread/blob/0208d10563aa21c518092985c78ecf9cd223ab74/tools/harness-automation/autothreadharness/open_thread_controller.py#L234-L246
[ "def", "run", "(", "self", ")", ":", "self", ".", "viewing", "=", "True", "while", "self", ".", "viewing", "and", "self", ".", "_lock", ".", "acquire", "(", ")", ":", "try", ":", "line", "=", "self", ".", "_readline", "(", ")", "except", ":", "pa...
0208d10563aa21c518092985c78ecf9cd223ab74
train
OpenThreadController.reset
Reset openthread device, not equivalent to stop and start
tools/harness-automation/autothreadharness/open_thread_controller.py
def reset(self): """Reset openthread device, not equivalent to stop and start """ logger.debug('DUT> reset') self._log and self.pause() self._sendline('reset') self._read() self._log and self.resume()
def reset(self): """Reset openthread device, not equivalent to stop and start """ logger.debug('DUT> reset') self._log and self.pause() self._sendline('reset') self._read() self._log and self.resume()
[ "Reset", "openthread", "device", "not", "equivalent", "to", "stop", "and", "start" ]
openthread/openthread
python
https://github.com/openthread/openthread/blob/0208d10563aa21c518092985c78ecf9cd223ab74/tools/harness-automation/autothreadharness/open_thread_controller.py#L269-L276
[ "def", "reset", "(", "self", ")", ":", "logger", ".", "debug", "(", "'DUT> reset'", ")", "self", ".", "_log", "and", "self", ".", "pause", "(", ")", "self", ".", "_sendline", "(", "'reset'", ")", "self", ".", "_read", "(", ")", "self", ".", "_log",...
0208d10563aa21c518092985c78ecf9cd223ab74
train
OpenThreadController.add_prefix
Add network prefix. Args: prefix (str): network prefix. flags (str): network prefix flags, please refer thread documentation for details prf (str): network prf, please refer thread documentation for details
tools/harness-automation/autothreadharness/open_thread_controller.py
def add_prefix(self, prefix, flags, prf): """Add network prefix. Args: prefix (str): network prefix. flags (str): network prefix flags, please refer thread documentation for details prf (str): network prf, please refer thread documentation for details """ ...
def add_prefix(self, prefix, flags, prf): """Add network prefix. Args: prefix (str): network prefix. flags (str): network prefix flags, please refer thread documentation for details prf (str): network prf, please refer thread documentation for details """ ...
[ "Add", "network", "prefix", "." ]
openthread/openthread
python
https://github.com/openthread/openthread/blob/0208d10563aa21c518092985c78ecf9cd223ab74/tools/harness-automation/autothreadharness/open_thread_controller.py#L360-L370
[ "def", "add_prefix", "(", "self", ",", "prefix", ",", "flags", ",", "prf", ")", ":", "self", ".", "_req", "(", "'prefix add %s %s %s'", "%", "(", "prefix", ",", "flags", ",", "prf", ")", ")", "time", ".", "sleep", "(", "1", ")", "self", ".", "_req"...
0208d10563aa21c518092985c78ecf9cd223ab74