Search is not available for this dataset
identifier stringlengths 1 155 | parameters stringlengths 2 6.09k | docstring stringlengths 11 63.4k | docstring_summary stringlengths 0 63.4k | function stringlengths 29 99.8k | function_tokens list | start_point list | end_point list | language stringclasses 1
value | docstring_language stringlengths 2 7 | docstring_language_predictions stringlengths 18 23 | is_langid_reliable stringclasses 2
values |
|---|---|---|---|---|---|---|---|---|---|---|---|
apply_over_axes | (func, a, axes) |
(This docstring will be overwritten)
|
(This docstring will be overwritten)
| def apply_over_axes(func, a, axes):
"""
(This docstring will be overwritten)
"""
val = asarray(a)
N = a.ndim
if array(axes).ndim == 0:
axes = (axes,)
for axis in axes:
if axis < 0:
axis = N + axis
args = (val, axis)
res = func(*args)
if res... | [
"def",
"apply_over_axes",
"(",
"func",
",",
"a",
",",
"axes",
")",
":",
"val",
"=",
"asarray",
"(",
"a",
")",
"N",
"=",
"a",
".",
"ndim",
"if",
"array",
"(",
"axes",
")",
".",
"ndim",
"==",
"0",
":",
"axes",
"=",
"(",
"axes",
",",
")",
"for",... | [
459,
0
] | [
481,
14
] | python | en | ['en', 'error', 'th'] | False |
average | (a, axis=None, weights=None, returned=False) |
Return the weighted average of array over the given axis.
Parameters
----------
a : array_like
Data to be averaged.
Masked entries are not taken into account in the computation.
axis : int, optional
Axis along which to average `a`. If None, averaging is done over
th... |
Return the weighted average of array over the given axis. | def average(a, axis=None, weights=None, returned=False):
"""
Return the weighted average of array over the given axis.
Parameters
----------
a : array_like
Data to be averaged.
Masked entries are not taken into account in the computation.
axis : int, optional
Axis along ... | [
"def",
"average",
"(",
"a",
",",
"axis",
"=",
"None",
",",
"weights",
"=",
"None",
",",
"returned",
"=",
"False",
")",
":",
"a",
"=",
"asarray",
"(",
"a",
")",
"m",
"=",
"getmask",
"(",
"a",
")",
"# inspired by 'average' in numpy/lib/function_base.py",
"... | [
532,
0
] | [
635,
18
] | python | en | ['en', 'error', 'th'] | False |
median | (a, axis=None, out=None, overwrite_input=False, keepdims=False) |
Compute the median along the specified axis.
Returns the median of the array elements.
Parameters
----------
a : array_like
Input array or object that can be converted to an array.
axis : int, optional
Axis along which the medians are computed. The default (None) is
to... |
Compute the median along the specified axis. | def median(a, axis=None, out=None, overwrite_input=False, keepdims=False):
"""
Compute the median along the specified axis.
Returns the median of the array elements.
Parameters
----------
a : array_like
Input array or object that can be converted to an array.
axis : int, optional
... | [
"def",
"median",
"(",
"a",
",",
"axis",
"=",
"None",
",",
"out",
"=",
"None",
",",
"overwrite_input",
"=",
"False",
",",
"keepdims",
"=",
"False",
")",
":",
"if",
"not",
"hasattr",
"(",
"a",
",",
"'mask'",
")",
":",
"m",
"=",
"np",
".",
"median",... | [
638,
0
] | [
718,
16
] | python | en | ['en', 'error', 'th'] | False |
compress_nd | (x, axis=None) | Suppress slices from multiple dimensions which contain masked values.
Parameters
----------
x : array_like, MaskedArray
The array to operate on. If not a MaskedArray instance (or if no array
elements are masked), `x` is interpreted as a MaskedArray with `mask`
set to `nomask`.
a... | Suppress slices from multiple dimensions which contain masked values. | def compress_nd(x, axis=None):
"""Suppress slices from multiple dimensions which contain masked values.
Parameters
----------
x : array_like, MaskedArray
The array to operate on. If not a MaskedArray instance (or if no array
elements are masked), `x` is interpreted as a MaskedArray with... | [
"def",
"compress_nd",
"(",
"x",
",",
"axis",
"=",
"None",
")",
":",
"x",
"=",
"asarray",
"(",
"x",
")",
"m",
"=",
"getmask",
"(",
"x",
")",
"# Set axis to tuple of ints",
"if",
"axis",
"is",
"None",
":",
"axis",
"=",
"tuple",
"(",
"range",
"(",
"x"... | [
806,
0
] | [
846,
15
] | python | en | ['en', 'en', 'en'] | True |
compress_rowcols | (x, axis=None) |
Suppress the rows and/or columns of a 2-D array that contain
masked values.
The suppression behavior is selected with the `axis` parameter.
- If axis is None, both rows and columns are suppressed.
- If axis is 0, only rows are suppressed.
- If axis is 1 or -1, only columns are suppressed.
... |
Suppress the rows and/or columns of a 2-D array that contain
masked values. | def compress_rowcols(x, axis=None):
"""
Suppress the rows and/or columns of a 2-D array that contain
masked values.
The suppression behavior is selected with the `axis` parameter.
- If axis is None, both rows and columns are suppressed.
- If axis is 0, only rows are suppressed.
- If axis i... | [
"def",
"compress_rowcols",
"(",
"x",
",",
"axis",
"=",
"None",
")",
":",
"if",
"asarray",
"(",
"x",
")",
".",
"ndim",
"!=",
"2",
":",
"raise",
"NotImplementedError",
"(",
"\"compress_rowcols works for 2D arrays only.\"",
")",
"return",
"compress_nd",
"(",
"x",... | [
848,
0
] | [
900,
36
] | python | en | ['en', 'error', 'th'] | False |
compress_rows | (a) |
Suppress whole rows of a 2-D array that contain masked values.
This is equivalent to ``np.ma.compress_rowcols(a, 0)``, see
`extras.compress_rowcols` for details.
See Also
--------
extras.compress_rowcols
|
Suppress whole rows of a 2-D array that contain masked values. | def compress_rows(a):
"""
Suppress whole rows of a 2-D array that contain masked values.
This is equivalent to ``np.ma.compress_rowcols(a, 0)``, see
`extras.compress_rowcols` for details.
See Also
--------
extras.compress_rowcols
"""
a = asarray(a)
if a.ndim != 2:
rais... | [
"def",
"compress_rows",
"(",
"a",
")",
":",
"a",
"=",
"asarray",
"(",
"a",
")",
"if",
"a",
".",
"ndim",
"!=",
"2",
":",
"raise",
"NotImplementedError",
"(",
"\"compress_rows works for 2D arrays only.\"",
")",
"return",
"compress_rowcols",
"(",
"a",
",",
"0",... | [
903,
0
] | [
918,
33
] | python | en | ['en', 'error', 'th'] | False |
compress_cols | (a) |
Suppress whole columns of a 2-D array that contain masked values.
This is equivalent to ``np.ma.compress_rowcols(a, 1)``, see
`extras.compress_rowcols` for details.
See Also
--------
extras.compress_rowcols
|
Suppress whole columns of a 2-D array that contain masked values. | def compress_cols(a):
"""
Suppress whole columns of a 2-D array that contain masked values.
This is equivalent to ``np.ma.compress_rowcols(a, 1)``, see
`extras.compress_rowcols` for details.
See Also
--------
extras.compress_rowcols
"""
a = asarray(a)
if a.ndim != 2:
r... | [
"def",
"compress_cols",
"(",
"a",
")",
":",
"a",
"=",
"asarray",
"(",
"a",
")",
"if",
"a",
".",
"ndim",
"!=",
"2",
":",
"raise",
"NotImplementedError",
"(",
"\"compress_cols works for 2D arrays only.\"",
")",
"return",
"compress_rowcols",
"(",
"a",
",",
"1",... | [
920,
0
] | [
935,
33
] | python | en | ['en', 'error', 'th'] | False |
mask_rows | (a, axis=np._NoValue) |
Mask rows of a 2D array that contain masked values.
This function is a shortcut to ``mask_rowcols`` with `axis` equal to 0.
See Also
--------
mask_rowcols : Mask rows and/or columns of a 2D array.
masked_where : Mask where a condition is met.
Examples
--------
>>> import numpy.ma... |
Mask rows of a 2D array that contain masked values. | def mask_rows(a, axis=np._NoValue):
"""
Mask rows of a 2D array that contain masked values.
This function is a shortcut to ``mask_rowcols`` with `axis` equal to 0.
See Also
--------
mask_rowcols : Mask rows and/or columns of a 2D array.
masked_where : Mask where a condition is met.
Ex... | [
"def",
"mask_rows",
"(",
"a",
",",
"axis",
"=",
"np",
".",
"_NoValue",
")",
":",
"if",
"axis",
"is",
"not",
"np",
".",
"_NoValue",
":",
"# remove the axis argument when this deprecation expires",
"# NumPy 1.18.0, 2019-11-28",
"warnings",
".",
"warn",
"(",
"\"The a... | [
937,
0
] | [
985,
29
] | python | en | ['en', 'error', 'th'] | False |
mask_cols | (a, axis=np._NoValue) |
Mask columns of a 2D array that contain masked values.
This function is a shortcut to ``mask_rowcols`` with `axis` equal to 1.
See Also
--------
mask_rowcols : Mask rows and/or columns of a 2D array.
masked_where : Mask where a condition is met.
Examples
--------
>>> import numpy... |
Mask columns of a 2D array that contain masked values. | def mask_cols(a, axis=np._NoValue):
"""
Mask columns of a 2D array that contain masked values.
This function is a shortcut to ``mask_rowcols`` with `axis` equal to 1.
See Also
--------
mask_rowcols : Mask rows and/or columns of a 2D array.
masked_where : Mask where a condition is met.
... | [
"def",
"mask_cols",
"(",
"a",
",",
"axis",
"=",
"np",
".",
"_NoValue",
")",
":",
"if",
"axis",
"is",
"not",
"np",
".",
"_NoValue",
":",
"# remove the axis argument when this deprecation expires",
"# NumPy 1.18.0, 2019-11-28",
"warnings",
".",
"warn",
"(",
"\"The a... | [
987,
0
] | [
1034,
29
] | python | en | ['en', 'error', 'th'] | False |
ediff1d | (arr, to_end=None, to_begin=None) |
Compute the differences between consecutive elements of an array.
This function is the equivalent of `numpy.ediff1d` that takes masked
values into account, see `numpy.ediff1d` for details.
See Also
--------
numpy.ediff1d : Equivalent function for ndarrays.
|
Compute the differences between consecutive elements of an array. | def ediff1d(arr, to_end=None, to_begin=None):
"""
Compute the differences between consecutive elements of an array.
This function is the equivalent of `numpy.ediff1d` that takes masked
values into account, see `numpy.ediff1d` for details.
See Also
--------
numpy.ediff1d : Equivalent functi... | [
"def",
"ediff1d",
"(",
"arr",
",",
"to_end",
"=",
"None",
",",
"to_begin",
"=",
"None",
")",
":",
"arr",
"=",
"ma",
".",
"asanyarray",
"(",
"arr",
")",
".",
"flat",
"ed",
"=",
"arr",
"[",
"1",
":",
"]",
"-",
"arr",
"[",
":",
"-",
"1",
"]",
... | [
1041,
0
] | [
1067,
13
] | python | en | ['en', 'error', 'th'] | False |
unique | (ar1, return_index=False, return_inverse=False) |
Finds the unique elements of an array.
Masked values are considered the same element (masked). The output array
is always a masked array. See `numpy.unique` for more details.
See Also
--------
numpy.unique : Equivalent function for ndarrays.
|
Finds the unique elements of an array. | def unique(ar1, return_index=False, return_inverse=False):
"""
Finds the unique elements of an array.
Masked values are considered the same element (masked). The output array
is always a masked array. See `numpy.unique` for more details.
See Also
--------
numpy.unique : Equivalent function... | [
"def",
"unique",
"(",
"ar1",
",",
"return_index",
"=",
"False",
",",
"return_inverse",
"=",
"False",
")",
":",
"output",
"=",
"np",
".",
"unique",
"(",
"ar1",
",",
"return_index",
"=",
"return_index",
",",
"return_inverse",
"=",
"return_inverse",
")",
"if"... | [
1070,
0
] | [
1091,
17
] | python | en | ['en', 'error', 'th'] | False |
intersect1d | (ar1, ar2, assume_unique=False) |
Returns the unique elements common to both arrays.
Masked values are considered equal one to the other.
The output is always a masked array.
See `numpy.intersect1d` for more details.
See Also
--------
numpy.intersect1d : Equivalent function for ndarrays.
Examples
--------
>>... |
Returns the unique elements common to both arrays. | def intersect1d(ar1, ar2, assume_unique=False):
"""
Returns the unique elements common to both arrays.
Masked values are considered equal one to the other.
The output is always a masked array.
See `numpy.intersect1d` for more details.
See Also
--------
numpy.intersect1d : Equivalent f... | [
"def",
"intersect1d",
"(",
"ar1",
",",
"ar2",
",",
"assume_unique",
"=",
"False",
")",
":",
"if",
"assume_unique",
":",
"aux",
"=",
"ma",
".",
"concatenate",
"(",
"(",
"ar1",
",",
"ar2",
")",
")",
"else",
":",
"# Might be faster than unique( intersect1d( ar1... | [
1094,
0
] | [
1123,
40
] | python | en | ['en', 'error', 'th'] | False |
setxor1d | (ar1, ar2, assume_unique=False) |
Set exclusive-or of 1-D arrays with unique elements.
The output is always a masked array. See `numpy.setxor1d` for more details.
See Also
--------
numpy.setxor1d : Equivalent function for ndarrays.
|
Set exclusive-or of 1-D arrays with unique elements. | def setxor1d(ar1, ar2, assume_unique=False):
"""
Set exclusive-or of 1-D arrays with unique elements.
The output is always a masked array. See `numpy.setxor1d` for more details.
See Also
--------
numpy.setxor1d : Equivalent function for ndarrays.
"""
if not assume_unique:
ar1 ... | [
"def",
"setxor1d",
"(",
"ar1",
",",
"ar2",
",",
"assume_unique",
"=",
"False",
")",
":",
"if",
"not",
"assume_unique",
":",
"ar1",
"=",
"unique",
"(",
"ar1",
")",
"ar2",
"=",
"unique",
"(",
"ar2",
")",
"aux",
"=",
"ma",
".",
"concatenate",
"(",
"("... | [
1126,
0
] | [
1150,
21
] | python | en | ['en', 'error', 'th'] | False |
in1d | (ar1, ar2, assume_unique=False, invert=False) |
Test whether each element of an array is also present in a second
array.
The output is always a masked array. See `numpy.in1d` for more details.
We recommend using :func:`isin` instead of `in1d` for new code.
See Also
--------
isin : Version of this function that preserves the shap... |
Test whether each element of an array is also present in a second
array. | def in1d(ar1, ar2, assume_unique=False, invert=False):
"""
Test whether each element of an array is also present in a second
array.
The output is always a masked array. See `numpy.in1d` for more details.
We recommend using :func:`isin` instead of `in1d` for new code.
See Also
--------
... | [
"def",
"in1d",
"(",
"ar1",
",",
"ar2",
",",
"assume_unique",
"=",
"False",
",",
"invert",
"=",
"False",
")",
":",
"if",
"not",
"assume_unique",
":",
"ar1",
",",
"rev_idx",
"=",
"unique",
"(",
"ar1",
",",
"return_inverse",
"=",
"True",
")",
"ar2",
"="... | [
1153,
0
] | [
1192,
34
] | python | en | ['en', 'error', 'th'] | False |
isin | (element, test_elements, assume_unique=False, invert=False) |
Calculates `element in test_elements`, broadcasting over
`element` only.
The output is always a masked array of the same shape as `element`.
See `numpy.isin` for more details.
See Also
--------
in1d : Flattened version of this function.
numpy.isin : Equivalent function for ndarr... |
Calculates `element in test_elements`, broadcasting over
`element` only. | def isin(element, test_elements, assume_unique=False, invert=False):
"""
Calculates `element in test_elements`, broadcasting over
`element` only.
The output is always a masked array of the same shape as `element`.
See `numpy.isin` for more details.
See Also
--------
in1d : Flatte... | [
"def",
"isin",
"(",
"element",
",",
"test_elements",
",",
"assume_unique",
"=",
"False",
",",
"invert",
"=",
"False",
")",
":",
"element",
"=",
"ma",
".",
"asarray",
"(",
"element",
")",
"return",
"in1d",
"(",
"element",
",",
"test_elements",
",",
"assum... | [
1195,
0
] | [
1215,
53
] | python | en | ['en', 'error', 'th'] | False |
union1d | (ar1, ar2) |
Union of two arrays.
The output is always a masked array. See `numpy.union1d` for more details.
See also
--------
numpy.union1d : Equivalent function for ndarrays.
|
Union of two arrays. | def union1d(ar1, ar2):
"""
Union of two arrays.
The output is always a masked array. See `numpy.union1d` for more details.
See also
--------
numpy.union1d : Equivalent function for ndarrays.
"""
return unique(ma.concatenate((ar1, ar2), axis=None)) | [
"def",
"union1d",
"(",
"ar1",
",",
"ar2",
")",
":",
"return",
"unique",
"(",
"ma",
".",
"concatenate",
"(",
"(",
"ar1",
",",
"ar2",
")",
",",
"axis",
"=",
"None",
")",
")"
] | [
1218,
0
] | [
1229,
56
] | python | en | ['en', 'error', 'th'] | False |
setdiff1d | (ar1, ar2, assume_unique=False) |
Set difference of 1D arrays with unique elements.
The output is always a masked array. See `numpy.setdiff1d` for more
details.
See Also
--------
numpy.setdiff1d : Equivalent function for ndarrays.
Examples
--------
>>> x = np.ma.array([1, 2, 3, 4], mask=[0, 1, 0, 1])
>>> np.m... |
Set difference of 1D arrays with unique elements. | def setdiff1d(ar1, ar2, assume_unique=False):
"""
Set difference of 1D arrays with unique elements.
The output is always a masked array. See `numpy.setdiff1d` for more
details.
See Also
--------
numpy.setdiff1d : Equivalent function for ndarrays.
Examples
--------
>>> x = np.m... | [
"def",
"setdiff1d",
"(",
"ar1",
",",
"ar2",
",",
"assume_unique",
"=",
"False",
")",
":",
"if",
"assume_unique",
":",
"ar1",
"=",
"ma",
".",
"asarray",
"(",
"ar1",
")",
".",
"ravel",
"(",
")",
"else",
":",
"ar1",
"=",
"unique",
"(",
"ar1",
")",
"... | [
1232,
0
] | [
1257,
63
] | python | en | ['en', 'error', 'th'] | False |
_covhelper | (x, y=None, rowvar=True, allow_masked=True) |
Private function for the computation of covariance and correlation
coefficients.
|
Private function for the computation of covariance and correlation
coefficients. | def _covhelper(x, y=None, rowvar=True, allow_masked=True):
"""
Private function for the computation of covariance and correlation
coefficients.
"""
x = ma.array(x, ndmin=2, copy=True, dtype=float)
xmask = ma.getmaskarray(x)
# Quick exit if we can't process masked data
if not allow_maske... | [
"def",
"_covhelper",
"(",
"x",
",",
"y",
"=",
"None",
",",
"rowvar",
"=",
"True",
",",
"allow_masked",
"=",
"True",
")",
":",
"x",
"=",
"ma",
".",
"array",
"(",
"x",
",",
"ndmin",
"=",
"2",
",",
"copy",
"=",
"True",
",",
"dtype",
"=",
"float",
... | [
1265,
0
] | [
1305,
32
] | python | en | ['en', 'error', 'th'] | False |
cov | (x, y=None, rowvar=True, bias=False, allow_masked=True, ddof=None) |
Estimate the covariance matrix.
Except for the handling of missing data this function does the same as
`numpy.cov`. For more details and examples, see `numpy.cov`.
By default, masked values are recognized as such. If `x` and `y` have the
same shape, a common mask is allocated: if ``x[i,j]`` is ma... |
Estimate the covariance matrix. | def cov(x, y=None, rowvar=True, bias=False, allow_masked=True, ddof=None):
"""
Estimate the covariance matrix.
Except for the handling of missing data this function does the same as
`numpy.cov`. For more details and examples, see `numpy.cov`.
By default, masked values are recognized as such. If `x... | [
"def",
"cov",
"(",
"x",
",",
"y",
"=",
"None",
",",
"rowvar",
"=",
"True",
",",
"bias",
"=",
"False",
",",
"allow_masked",
"=",
"True",
",",
"ddof",
"=",
"None",
")",
":",
"# Check inputs",
"if",
"ddof",
"is",
"not",
"None",
"and",
"ddof",
"!=",
... | [
1308,
0
] | [
1378,
17
] | python | en | ['en', 'error', 'th'] | False |
corrcoef | (x, y=None, rowvar=True, bias=np._NoValue, allow_masked=True,
ddof=np._NoValue) |
Return Pearson product-moment correlation coefficients.
Except for the handling of missing data this function does the same as
`numpy.corrcoef`. For more details and examples, see `numpy.corrcoef`.
Parameters
----------
x : array_like
A 1-D or 2-D array containing multiple variables a... |
Return Pearson product-moment correlation coefficients. | def corrcoef(x, y=None, rowvar=True, bias=np._NoValue, allow_masked=True,
ddof=np._NoValue):
"""
Return Pearson product-moment correlation coefficients.
Except for the handling of missing data this function does the same as
`numpy.corrcoef`. For more details and examples, see `numpy.corrco... | [
"def",
"corrcoef",
"(",
"x",
",",
"y",
"=",
"None",
",",
"rowvar",
"=",
"True",
",",
"bias",
"=",
"np",
".",
"_NoValue",
",",
"allow_masked",
"=",
"True",
",",
"ddof",
"=",
"np",
".",
"_NoValue",
")",
":",
"msg",
"=",
"'bias and ddof have no effect and... | [
1381,
0
] | [
1465,
21
] | python | en | ['en', 'error', 'th'] | False |
flatnotmasked_edges | (a) |
Find the indices of the first and last unmasked values.
Expects a 1-D `MaskedArray`, returns None if all values are masked.
Parameters
----------
a : array_like
Input 1-D `MaskedArray`
Returns
-------
edges : ndarray or None
The indices of first and last non-masked va... |
Find the indices of the first and last unmasked values. | def flatnotmasked_edges(a):
"""
Find the indices of the first and last unmasked values.
Expects a 1-D `MaskedArray`, returns None if all values are masked.
Parameters
----------
a : array_like
Input 1-D `MaskedArray`
Returns
-------
edges : ndarray or None
The indi... | [
"def",
"flatnotmasked_edges",
"(",
"a",
")",
":",
"m",
"=",
"getmask",
"(",
"a",
")",
"if",
"m",
"is",
"nomask",
"or",
"not",
"np",
".",
"any",
"(",
"m",
")",
":",
"return",
"np",
".",
"array",
"(",
"[",
"0",
",",
"a",
".",
"size",
"-",
"1",
... | [
1528,
0
] | [
1580,
19
] | python | en | ['en', 'error', 'th'] | False |
notmasked_edges | (a, axis=None) |
Find the indices of the first and last unmasked values along an axis.
If all values are masked, return None. Otherwise, return a list
of two tuples, corresponding to the indices of the first and last
unmasked values respectively.
Parameters
----------
a : array_like
The input arr... |
Find the indices of the first and last unmasked values along an axis. | def notmasked_edges(a, axis=None):
"""
Find the indices of the first and last unmasked values along an axis.
If all values are masked, return None. Otherwise, return a list
of two tuples, corresponding to the indices of the first and last
unmasked values respectively.
Parameters
---------... | [
"def",
"notmasked_edges",
"(",
"a",
",",
"axis",
"=",
"None",
")",
":",
"a",
"=",
"asarray",
"(",
"a",
")",
"if",
"axis",
"is",
"None",
"or",
"a",
".",
"ndim",
"==",
"1",
":",
"return",
"flatnotmasked_edges",
"(",
"a",
")",
"m",
"=",
"getmaskarray"... | [
1583,
0
] | [
1631,
76
] | python | en | ['en', 'error', 'th'] | False |
flatnotmasked_contiguous | (a) |
Find contiguous unmasked data in a masked array along the given axis.
Parameters
----------
a : narray
The input array.
Returns
-------
slice_list : list
A sorted sequence of `slice` objects (start index, end index).
..versionchanged:: 1.15.0
Now retur... |
Find contiguous unmasked data in a masked array along the given axis. | def flatnotmasked_contiguous(a):
"""
Find contiguous unmasked data in a masked array along the given axis.
Parameters
----------
a : narray
The input array.
Returns
-------
slice_list : list
A sorted sequence of `slice` objects (start index, end index).
..versi... | [
"def",
"flatnotmasked_contiguous",
"(",
"a",
")",
":",
"m",
"=",
"getmask",
"(",
"a",
")",
"if",
"m",
"is",
"nomask",
":",
"return",
"[",
"slice",
"(",
"0",
",",
"a",
".",
"size",
")",
"]",
"i",
"=",
"0",
"result",
"=",
"[",
"]",
"for",
"(",
... | [
1634,
0
] | [
1688,
17
] | python | en | ['en', 'error', 'th'] | False |
notmasked_contiguous | (a, axis=None) |
Find contiguous unmasked data in a masked array along the given axis.
Parameters
----------
a : array_like
The input array.
axis : int, optional
Axis along which to perform the operation.
If None (default), applies to a flattened version of the array, and this
is th... |
Find contiguous unmasked data in a masked array along the given axis. | def notmasked_contiguous(a, axis=None):
"""
Find contiguous unmasked data in a masked array along the given axis.
Parameters
----------
a : array_like
The input array.
axis : int, optional
Axis along which to perform the operation.
If None (default), applies to a flatten... | [
"def",
"notmasked_contiguous",
"(",
"a",
",",
"axis",
"=",
"None",
")",
":",
"a",
"=",
"asarray",
"(",
"a",
")",
"nd",
"=",
"a",
".",
"ndim",
"if",
"nd",
">",
"2",
":",
"raise",
"NotImplementedError",
"(",
"\"Currently limited to atmost 2D array.\"",
")",
... | [
1690,
0
] | [
1764,
17
] | python | en | ['en', 'error', 'th'] | False |
_ezclump | (mask) |
Finds the clumps (groups of data with the same values) for a 1D bool array.
Returns a series of slices.
|
Finds the clumps (groups of data with the same values) for a 1D bool array. | def _ezclump(mask):
"""
Finds the clumps (groups of data with the same values) for a 1D bool array.
Returns a series of slices.
"""
if mask.ndim > 1:
mask = mask.ravel()
idx = (mask[1:] ^ mask[:-1]).nonzero()
idx = idx[0] + 1
if mask[0]:
if len(idx) == 0:
re... | [
"def",
"_ezclump",
"(",
"mask",
")",
":",
"if",
"mask",
".",
"ndim",
">",
"1",
":",
"mask",
"=",
"mask",
".",
"ravel",
"(",
")",
"idx",
"=",
"(",
"mask",
"[",
"1",
":",
"]",
"^",
"mask",
"[",
":",
"-",
"1",
"]",
")",
".",
"nonzero",
"(",
... | [
1767,
0
] | [
1793,
12
] | python | en | ['en', 'error', 'th'] | False |
clump_unmasked | (a) |
Return list of slices corresponding to the unmasked clumps of a 1-D array.
(A "clump" is defined as a contiguous region of the array).
Parameters
----------
a : ndarray
A one-dimensional masked array.
Returns
-------
slices : list of slice
The list of slices, one for e... |
Return list of slices corresponding to the unmasked clumps of a 1-D array.
(A "clump" is defined as a contiguous region of the array). | def clump_unmasked(a):
"""
Return list of slices corresponding to the unmasked clumps of a 1-D array.
(A "clump" is defined as a contiguous region of the array).
Parameters
----------
a : ndarray
A one-dimensional masked array.
Returns
-------
slices : list of slice
... | [
"def",
"clump_unmasked",
"(",
"a",
")",
":",
"mask",
"=",
"getattr",
"(",
"a",
",",
"'_mask'",
",",
"nomask",
")",
"if",
"mask",
"is",
"nomask",
":",
"return",
"[",
"slice",
"(",
"0",
",",
"a",
".",
"size",
")",
"]",
"return",
"_ezclump",
"(",
"~... | [
1796,
0
] | [
1832,
26
] | python | en | ['en', 'error', 'th'] | False |
clump_masked | (a) |
Returns a list of slices corresponding to the masked clumps of a 1-D array.
(A "clump" is defined as a contiguous region of the array).
Parameters
----------
a : ndarray
A one-dimensional masked array.
Returns
-------
slices : list of slice
The list of slices, one for ... |
Returns a list of slices corresponding to the masked clumps of a 1-D array.
(A "clump" is defined as a contiguous region of the array). | def clump_masked(a):
"""
Returns a list of slices corresponding to the masked clumps of a 1-D array.
(A "clump" is defined as a contiguous region of the array).
Parameters
----------
a : ndarray
A one-dimensional masked array.
Returns
-------
slices : list of slice
... | [
"def",
"clump_masked",
"(",
"a",
")",
":",
"mask",
"=",
"ma",
".",
"getmask",
"(",
"a",
")",
"if",
"mask",
"is",
"nomask",
":",
"return",
"[",
"]",
"return",
"_ezclump",
"(",
"mask",
")"
] | [
1835,
0
] | [
1871,
25
] | python | en | ['en', 'error', 'th'] | False |
vander | (x, n=None) |
Masked values in the input array result in rows of zeros.
|
Masked values in the input array result in rows of zeros. | def vander(x, n=None):
"""
Masked values in the input array result in rows of zeros.
"""
_vander = np.vander(x, n)
m = getmask(x)
if m is not nomask:
_vander[m] = 0
return _vander | [
"def",
"vander",
"(",
"x",
",",
"n",
"=",
"None",
")",
":",
"_vander",
"=",
"np",
".",
"vander",
"(",
"x",
",",
"n",
")",
"m",
"=",
"getmask",
"(",
"x",
")",
"if",
"m",
"is",
"not",
"nomask",
":",
"_vander",
"[",
"m",
"]",
"=",
"0",
"return... | [
1879,
0
] | [
1888,
18
] | python | en | ['en', 'error', 'th'] | False |
polyfit | (x, y, deg, rcond=None, full=False, w=None, cov=False) |
Any masked values in x is propagated in y, and vice-versa.
|
Any masked values in x is propagated in y, and vice-versa. | def polyfit(x, y, deg, rcond=None, full=False, w=None, cov=False):
"""
Any masked values in x is propagated in y, and vice-versa.
"""
x = asarray(x)
y = asarray(y)
m = getmask(x)
if y.ndim == 1:
m = mask_or(m, getmask(y))
elif y.ndim == 2:
my = getmask(mask_rows(y))
... | [
"def",
"polyfit",
"(",
"x",
",",
"y",
",",
"deg",
",",
"rcond",
"=",
"None",
",",
"full",
"=",
"False",
",",
"w",
"=",
"None",
",",
"cov",
"=",
"False",
")",
":",
"x",
"=",
"asarray",
"(",
"x",
")",
"y",
"=",
"asarray",
"(",
"y",
")",
"m",
... | [
1893,
0
] | [
1925,
57
] | python | en | ['en', 'error', 'th'] | False |
_fromnxfunction.getdoc | (self) |
Retrieve the docstring and signature from the function.
The ``__doc__`` attribute of the function is used as the docstring for
the new masked array version of the function. A note on application
of the function to the mask is appended.
.. warning::
If the function do... |
Retrieve the docstring and signature from the function. | def getdoc(self):
"""
Retrieve the docstring and signature from the function.
The ``__doc__`` attribute of the function is used as the docstring for
the new masked array version of the function. A note on application
of the function to the mask is appended.
.. warning::... | [
"def",
"getdoc",
"(",
"self",
")",
":",
"npfunc",
"=",
"getattr",
"(",
"np",
",",
"self",
".",
"__name__",
",",
"None",
")",
"doc",
"=",
"getattr",
"(",
"npfunc",
",",
"'__doc__'",
",",
"None",
")",
"if",
"doc",
":",
"sig",
"=",
"self",
".",
"__n... | [
238,
4
] | [
263,
14
] | python | en | ['en', 'error', 'th'] | False |
setup_platform | (hass, config, add_entities, discovery_info=None) | Find and return DIN III Relay switch. | Find and return DIN III Relay switch. | def setup_platform(hass, config, add_entities, discovery_info=None):
"""Find and return DIN III Relay switch."""
host = config[CONF_HOST]
controller_name = config[CONF_NAME]
user = config[CONF_USERNAME]
pswd = config[CONF_PASSWORD]
tout = config[CONF_TIMEOUT]
cycl = config[CONF_CYCLETIME]
... | [
"def",
"setup_platform",
"(",
"hass",
",",
"config",
",",
"add_entities",
",",
"discovery_info",
"=",
"None",
")",
":",
"host",
"=",
"config",
"[",
"CONF_HOST",
"]",
"controller_name",
"=",
"config",
"[",
"CONF_NAME",
"]",
"user",
"=",
"config",
"[",
"CONF... | [
46,
0
] | [
71,
25
] | python | en | ['en', 'en', 'en'] | True |
DINRelay.__init__ | (self, controller_name, parent_device, outlet) | Initialize the DIN III Relay switch. | Initialize the DIN III Relay switch. | def __init__(self, controller_name, parent_device, outlet):
"""Initialize the DIN III Relay switch."""
self._controller_name = controller_name
self._parent_device = parent_device
self._outlet = outlet
self._outlet_number = self._outlet.outlet_number
self._name = self._ou... | [
"def",
"__init__",
"(",
"self",
",",
"controller_name",
",",
"parent_device",
",",
"outlet",
")",
":",
"self",
".",
"_controller_name",
"=",
"controller_name",
"self",
".",
"_parent_device",
"=",
"parent_device",
"self",
".",
"_outlet",
"=",
"outlet",
"self",
... | [
77,
4
] | [
85,
48
] | python | en | ['en', 'en', 'en'] | True |
DINRelay.name | (self) | Return the display name of this relay. | Return the display name of this relay. | def name(self):
"""Return the display name of this relay."""
return f"{self._controller_name}_{self._name}" | [
"def",
"name",
"(",
"self",
")",
":",
"return",
"f\"{self._controller_name}_{self._name}\""
] | [
88,
4
] | [
90,
54
] | python | en | ['en', 'en', 'en'] | True |
DINRelay.is_on | (self) | Return true if relay is on. | Return true if relay is on. | def is_on(self):
"""Return true if relay is on."""
return self._state | [
"def",
"is_on",
"(",
"self",
")",
":",
"return",
"self",
".",
"_state"
] | [
93,
4
] | [
95,
26
] | python | en | ['en', 'en', 'en'] | True |
DINRelay.turn_on | (self, **kwargs) | Instruct the relay to turn on. | Instruct the relay to turn on. | def turn_on(self, **kwargs):
"""Instruct the relay to turn on."""
self._outlet.on() | [
"def",
"turn_on",
"(",
"self",
",",
"*",
"*",
"kwargs",
")",
":",
"self",
".",
"_outlet",
".",
"on",
"(",
")"
] | [
97,
4
] | [
99,
25
] | python | en | ['en', 'en', 'en'] | True |
DINRelay.turn_off | (self, **kwargs) | Instruct the relay to turn off. | Instruct the relay to turn off. | def turn_off(self, **kwargs):
"""Instruct the relay to turn off."""
self._outlet.off() | [
"def",
"turn_off",
"(",
"self",
",",
"*",
"*",
"kwargs",
")",
":",
"self",
".",
"_outlet",
".",
"off",
"(",
")"
] | [
101,
4
] | [
103,
26
] | python | en | ['en', 'en', 'en'] | True |
DINRelay.update | (self) | Trigger update for all switches on the parent device. | Trigger update for all switches on the parent device. | def update(self):
"""Trigger update for all switches on the parent device."""
self._parent_device.update()
outlet_status = self._parent_device.get_outlet_status(self._outlet_number)
self._name = outlet_status[1]
self._state = outlet_status[2] == "ON" | [
"def",
"update",
"(",
"self",
")",
":",
"self",
".",
"_parent_device",
".",
"update",
"(",
")",
"outlet_status",
"=",
"self",
".",
"_parent_device",
".",
"get_outlet_status",
"(",
"self",
".",
"_outlet_number",
")",
"self",
".",
"_name",
"=",
"outlet_status"... | [
105,
4
] | [
112,
46
] | python | en | ['en', 'en', 'en'] | True |
DINRelayDevice.__init__ | (self, power_switch) | Initialize the DINRelay device. | Initialize the DINRelay device. | def __init__(self, power_switch):
"""Initialize the DINRelay device."""
self._power_switch = power_switch
self._statuslist = None | [
"def",
"__init__",
"(",
"self",
",",
"power_switch",
")",
":",
"self",
".",
"_power_switch",
"=",
"power_switch",
"self",
".",
"_statuslist",
"=",
"None"
] | [
118,
4
] | [
121,
31
] | python | en | ['en', 'en', 'en'] | True |
DINRelayDevice.get_outlet_status | (self, outlet_number) | Get status of outlet from cached status list. | Get status of outlet from cached status list. | def get_outlet_status(self, outlet_number):
"""Get status of outlet from cached status list."""
return self._statuslist[outlet_number - 1] | [
"def",
"get_outlet_status",
"(",
"self",
",",
"outlet_number",
")",
":",
"return",
"self",
".",
"_statuslist",
"[",
"outlet_number",
"-",
"1",
"]"
] | [
123,
4
] | [
125,
50
] | python | en | ['en', 'en', 'en'] | True |
DINRelayDevice.update | (self) | Fetch new state data for this device. | Fetch new state data for this device. | def update(self):
"""Fetch new state data for this device."""
self._statuslist = self._power_switch.statuslist() | [
"def",
"update",
"(",
"self",
")",
":",
"self",
".",
"_statuslist",
"=",
"self",
".",
"_power_switch",
".",
"statuslist",
"(",
")"
] | [
128,
4
] | [
130,
58
] | python | en | ['en', 'en', 'en'] | True |
async_setup_scanner_from_yaml | (hass, config, async_see, discovery_info=None) | Set up the MQTT tracker. | Set up the MQTT tracker. | async def async_setup_scanner_from_yaml(hass, config, async_see, discovery_info=None):
"""Set up the MQTT tracker."""
devices = config[CONF_DEVICES]
qos = config[CONF_QOS]
payload_home = config[CONF_PAYLOAD_HOME]
payload_not_home = config[CONF_PAYLOAD_NOT_HOME]
source_type = config.get(CONF_SOUR... | [
"async",
"def",
"async_setup_scanner_from_yaml",
"(",
"hass",
",",
"config",
",",
"async_see",
",",
"discovery_info",
"=",
"None",
")",
":",
"devices",
"=",
"config",
"[",
"CONF_DEVICES",
"]",
"qos",
"=",
"config",
"[",
"CONF_QOS",
"]",
"payload_home",
"=",
... | [
26,
0
] | [
54,
15
] | python | en | ['en', 'mt', 'en'] | True |
FakeClassnameTags123Api.test_classname | (self, body, **kwargs) | To test class name in snake case # noqa: E501
To test class name in snake case # noqa: E501
This method makes a synchronous HTTP request by default. To make an
asynchronous HTTP request, please pass async_req=True
>>> thread = api.test_classname(body, async_req=True)
>>> resu... | To test class name in snake case # noqa: E501 | def test_classname(self, body, **kwargs): # noqa: E501
"""To test class name in snake case # noqa: E501
To test class name in snake case # noqa: E501
This method makes a synchronous HTTP request by default. To make an
asynchronous HTTP request, please pass async_req=True
>>>... | [
"def",
"test_classname",
"(",
"self",
",",
"body",
",",
"*",
"*",
"kwargs",
")",
":",
"# noqa: E501",
"kwargs",
"[",
"'_return_http_data_only'",
"]",
"=",
"True",
"return",
"self",
".",
"test_classname_with_http_info",
"(",
"body",
",",
"*",
"*",
"kwargs",
"... | [
38,
4
] | [
66,
65
] | python | en | ['en', 'en', 'sw'] | True |
FakeClassnameTags123Api.test_classname_with_http_info | (self, body, **kwargs) | To test class name in snake case # noqa: E501
To test class name in snake case # noqa: E501
This method makes a synchronous HTTP request by default. To make an
asynchronous HTTP request, please pass async_req=True
>>> thread = api.test_classname_with_http_info(body, async_req=True)
... | To test class name in snake case # noqa: E501 | def test_classname_with_http_info(self, body, **kwargs): # noqa: E501
"""To test class name in snake case # noqa: E501
To test class name in snake case # noqa: E501
This method makes a synchronous HTTP request by default. To make an
asynchronous HTTP request, please pass async_req=Tr... | [
"def",
"test_classname_with_http_info",
"(",
"self",
",",
"body",
",",
"*",
"*",
"kwargs",
")",
":",
"# noqa: E501",
"local_var_params",
"=",
"locals",
"(",
")",
"all_params",
"=",
"[",
"'body'",
"]",
"all_params",
".",
"extend",
"(",
"[",
"'async_req'",
","... | [
68,
4
] | [
175,
64
] | python | en | ['en', 'en', 'sw'] | True |
Client.__init__ | (self, client=None, local_vars_configuration=None) | Client - a model defined in OpenAPI | Client - a model defined in OpenAPI | def __init__(self, client=None, local_vars_configuration=None): # noqa: E501
"""Client - a model defined in OpenAPI""" # noqa: E501
if local_vars_configuration is None:
local_vars_configuration = Configuration.get_default_copy()
self.local_vars_configuration = local_vars_configurat... | [
"def",
"__init__",
"(",
"self",
",",
"client",
"=",
"None",
",",
"local_vars_configuration",
"=",
"None",
")",
":",
"# noqa: E501",
"# noqa: E501",
"if",
"local_vars_configuration",
"is",
"None",
":",
"local_vars_configuration",
"=",
"Configuration",
".",
"get_defau... | [
42,
4
] | [
52,
32
] | python | en | ['en', 'en', 'en'] | True |
Client.client | (self) | Gets the client of this Client. # noqa: E501
:return: The client of this Client. # noqa: E501
:rtype: str
| Gets the client of this Client. # noqa: E501 | def client(self):
"""Gets the client of this Client. # noqa: E501
:return: The client of this Client. # noqa: E501
:rtype: str
"""
return self._client | [
"def",
"client",
"(",
"self",
")",
":",
"return",
"self",
".",
"_client"
] | [
55,
4
] | [
62,
27
] | python | en | ['en', 'en', 'en'] | True |
Client.client | (self, client) | Sets the client of this Client.
:param client: The client of this Client. # noqa: E501
:type client: str
| Sets the client of this Client. | def client(self, client):
"""Sets the client of this Client.
:param client: The client of this Client. # noqa: E501
:type client: str
"""
self._client = client | [
"def",
"client",
"(",
"self",
",",
"client",
")",
":",
"self",
".",
"_client",
"=",
"client"
] | [
65,
4
] | [
73,
29
] | python | en | ['en', 'en', 'en'] | True |
Client.to_dict | (self, serialize=False) | Returns the model properties as a dict | Returns the model properties as a dict | def to_dict(self, serialize=False):
"""Returns the model properties as a dict"""
result = {}
def convert(x):
if hasattr(x, "to_dict"):
args = inspect.getargspec(x.to_dict).args
if len(args) == 1:
return x.to_dict()
... | [
"def",
"to_dict",
"(",
"self",
",",
"serialize",
"=",
"False",
")",
":",
"result",
"=",
"{",
"}",
"def",
"convert",
"(",
"x",
")",
":",
"if",
"hasattr",
"(",
"x",
",",
"\"to_dict\"",
")",
":",
"args",
"=",
"inspect",
".",
"getargspec",
"(",
"x",
... | [
75,
4
] | [
105,
21
] | python | en | ['en', 'en', 'en'] | True |
Client.to_str | (self) | Returns the string representation of the model | Returns the string representation of the model | def to_str(self):
"""Returns the string representation of the model"""
return pprint.pformat(self.to_dict()) | [
"def",
"to_str",
"(",
"self",
")",
":",
"return",
"pprint",
".",
"pformat",
"(",
"self",
".",
"to_dict",
"(",
")",
")"
] | [
107,
4
] | [
109,
45
] | python | en | ['en', 'en', 'en'] | True |
Client.__repr__ | (self) | For `print` and `pprint` | For `print` and `pprint` | def __repr__(self):
"""For `print` and `pprint`"""
return self.to_str() | [
"def",
"__repr__",
"(",
"self",
")",
":",
"return",
"self",
".",
"to_str",
"(",
")"
] | [
111,
4
] | [
113,
28
] | python | en | ['en', 'en', 'en'] | True |
Client.__eq__ | (self, other) | Returns true if both objects are equal | Returns true if both objects are equal | def __eq__(self, other):
"""Returns true if both objects are equal"""
if not isinstance(other, Client):
return False
return self.to_dict() == other.to_dict() | [
"def",
"__eq__",
"(",
"self",
",",
"other",
")",
":",
"if",
"not",
"isinstance",
"(",
"other",
",",
"Client",
")",
":",
"return",
"False",
"return",
"self",
".",
"to_dict",
"(",
")",
"==",
"other",
".",
"to_dict",
"(",
")"
] | [
115,
4
] | [
120,
48
] | python | en | ['en', 'en', 'en'] | True |
Client.__ne__ | (self, other) | Returns true if both objects are not equal | Returns true if both objects are not equal | def __ne__(self, other):
"""Returns true if both objects are not equal"""
if not isinstance(other, Client):
return True
return self.to_dict() != other.to_dict() | [
"def",
"__ne__",
"(",
"self",
",",
"other",
")",
":",
"if",
"not",
"isinstance",
"(",
"other",
",",
"Client",
")",
":",
"return",
"True",
"return",
"self",
".",
"to_dict",
"(",
")",
"!=",
"other",
".",
"to_dict",
"(",
")"
] | [
122,
4
] | [
127,
48
] | python | en | ['en', 'en', 'en'] | True |
kill_subprocess | (
# pylint: disable=unsubscriptable-object # https://github.com/PyCQA/pylint/issues/4369
process: subprocess.Popen[Any],
) | Force kill a subprocess and wait for it to exit. | Force kill a subprocess and wait for it to exit. | def kill_subprocess(
# pylint: disable=unsubscriptable-object # https://github.com/PyCQA/pylint/issues/4369
process: subprocess.Popen[Any],
) -> None:
"""Force kill a subprocess and wait for it to exit."""
process.kill()
process.communicate()
process.wait()
del process | [
"def",
"kill_subprocess",
"(",
"# pylint: disable=unsubscriptable-object # https://github.com/PyCQA/pylint/issues/4369",
"process",
":",
"subprocess",
".",
"Popen",
"[",
"Any",
"]",
",",
")",
"->",
"None",
":",
"process",
".",
"kill",
"(",
")",
"process",
".",
"commun... | [
10,
0
] | [
19,
15
] | python | en | ['en', 'en', 'en'] | True |
async_setup_entry | (hass, config_entry, async_add_entities) | Set up the Gree HVAC device from a config entry. | Set up the Gree HVAC device from a config entry. | async def async_setup_entry(hass, config_entry, async_add_entities):
"""Set up the Gree HVAC device from a config entry."""
@callback
def init_device(coordinator):
"""Register the device."""
async_add_entities(
[
GreePanelLightSwitchEntity(coordinator),
... | [
"async",
"def",
"async_setup_entry",
"(",
"hass",
",",
"config_entry",
",",
"async_add_entities",
")",
":",
"@",
"callback",
"def",
"init_device",
"(",
"coordinator",
")",
":",
"\"\"\"Register the device.\"\"\"",
"async_add_entities",
"(",
"[",
"GreePanelLightSwitchEnti... | [
11,
0
] | [
31,
5
] | python | en | ['en', 'en', 'en'] | True |
GreePanelLightSwitchEntity.__init__ | (self, coordinator) | Initialize the Gree device. | Initialize the Gree device. | def __init__(self, coordinator):
"""Initialize the Gree device."""
super().__init__(coordinator, "Panel Light") | [
"def",
"__init__",
"(",
"self",
",",
"coordinator",
")",
":",
"super",
"(",
")",
".",
"__init__",
"(",
"coordinator",
",",
"\"Panel Light\"",
")"
] | [
37,
4
] | [
39,
52
] | python | en | ['en', 'en', 'en'] | True |
GreePanelLightSwitchEntity.icon | (self) | Return the icon for the device. | Return the icon for the device. | def icon(self) -> str | None:
"""Return the icon for the device."""
return "mdi:lightbulb" | [
"def",
"icon",
"(",
"self",
")",
"->",
"str",
"|",
"None",
":",
"return",
"\"mdi:lightbulb\""
] | [
42,
4
] | [
44,
30
] | python | en | ['en', 'en', 'en'] | True |
GreePanelLightSwitchEntity.device_class | (self) | Return the class of this device, from component DEVICE_CLASSES. | Return the class of this device, from component DEVICE_CLASSES. | def device_class(self):
"""Return the class of this device, from component DEVICE_CLASSES."""
return DEVICE_CLASS_SWITCH | [
"def",
"device_class",
"(",
"self",
")",
":",
"return",
"DEVICE_CLASS_SWITCH"
] | [
47,
4
] | [
49,
34
] | python | en | ['en', 'en', 'en'] | True |
GreePanelLightSwitchEntity.is_on | (self) | Return if the light is turned on. | Return if the light is turned on. | def is_on(self) -> bool:
"""Return if the light is turned on."""
return self.coordinator.device.light | [
"def",
"is_on",
"(",
"self",
")",
"->",
"bool",
":",
"return",
"self",
".",
"coordinator",
".",
"device",
".",
"light"
] | [
52,
4
] | [
54,
44
] | python | en | ['en', 'en', 'en'] | True |
GreePanelLightSwitchEntity.async_turn_on | (self, **kwargs) | Turn the entity on. | Turn the entity on. | async def async_turn_on(self, **kwargs):
"""Turn the entity on."""
self.coordinator.device.light = True
await self.coordinator.push_state_update()
self.async_write_ha_state() | [
"async",
"def",
"async_turn_on",
"(",
"self",
",",
"*",
"*",
"kwargs",
")",
":",
"self",
".",
"coordinator",
".",
"device",
".",
"light",
"=",
"True",
"await",
"self",
".",
"coordinator",
".",
"push_state_update",
"(",
")",
"self",
".",
"async_write_ha_sta... | [
56,
4
] | [
60,
35
] | python | en | ['en', 'en', 'en'] | True |
GreePanelLightSwitchEntity.async_turn_off | (self, **kwargs) | Turn the entity off. | Turn the entity off. | async def async_turn_off(self, **kwargs):
"""Turn the entity off."""
self.coordinator.device.light = False
await self.coordinator.push_state_update()
self.async_write_ha_state() | [
"async",
"def",
"async_turn_off",
"(",
"self",
",",
"*",
"*",
"kwargs",
")",
":",
"self",
".",
"coordinator",
".",
"device",
".",
"light",
"=",
"False",
"await",
"self",
".",
"coordinator",
".",
"push_state_update",
"(",
")",
"self",
".",
"async_write_ha_s... | [
62,
4
] | [
66,
35
] | python | en | ['en', 'en', 'en'] | True |
GreeQuietModeSwitchEntity.__init__ | (self, coordinator) | Initialize the Gree device. | Initialize the Gree device. | def __init__(self, coordinator):
"""Initialize the Gree device."""
super().__init__(coordinator, "Quiet") | [
"def",
"__init__",
"(",
"self",
",",
"coordinator",
")",
":",
"super",
"(",
")",
".",
"__init__",
"(",
"coordinator",
",",
"\"Quiet\"",
")"
] | [
72,
4
] | [
74,
46
] | python | en | ['en', 'en', 'en'] | True |
GreeQuietModeSwitchEntity.device_class | (self) | Return the class of this device, from component DEVICE_CLASSES. | Return the class of this device, from component DEVICE_CLASSES. | def device_class(self):
"""Return the class of this device, from component DEVICE_CLASSES."""
return DEVICE_CLASS_SWITCH | [
"def",
"device_class",
"(",
"self",
")",
":",
"return",
"DEVICE_CLASS_SWITCH"
] | [
77,
4
] | [
79,
34
] | python | en | ['en', 'en', 'en'] | True |
GreeQuietModeSwitchEntity.is_on | (self) | Return if the state is turned on. | Return if the state is turned on. | def is_on(self) -> bool:
"""Return if the state is turned on."""
return self.coordinator.device.quiet | [
"def",
"is_on",
"(",
"self",
")",
"->",
"bool",
":",
"return",
"self",
".",
"coordinator",
".",
"device",
".",
"quiet"
] | [
82,
4
] | [
84,
44
] | python | en | ['en', 'en', 'en'] | True |
GreeQuietModeSwitchEntity.async_turn_on | (self, **kwargs) | Turn the entity on. | Turn the entity on. | async def async_turn_on(self, **kwargs):
"""Turn the entity on."""
self.coordinator.device.quiet = True
await self.coordinator.push_state_update()
self.async_write_ha_state() | [
"async",
"def",
"async_turn_on",
"(",
"self",
",",
"*",
"*",
"kwargs",
")",
":",
"self",
".",
"coordinator",
".",
"device",
".",
"quiet",
"=",
"True",
"await",
"self",
".",
"coordinator",
".",
"push_state_update",
"(",
")",
"self",
".",
"async_write_ha_sta... | [
86,
4
] | [
90,
35
] | python | en | ['en', 'en', 'en'] | True |
GreeQuietModeSwitchEntity.async_turn_off | (self, **kwargs) | Turn the entity off. | Turn the entity off. | async def async_turn_off(self, **kwargs):
"""Turn the entity off."""
self.coordinator.device.quiet = False
await self.coordinator.push_state_update()
self.async_write_ha_state() | [
"async",
"def",
"async_turn_off",
"(",
"self",
",",
"*",
"*",
"kwargs",
")",
":",
"self",
".",
"coordinator",
".",
"device",
".",
"quiet",
"=",
"False",
"await",
"self",
".",
"coordinator",
".",
"push_state_update",
"(",
")",
"self",
".",
"async_write_ha_s... | [
92,
4
] | [
96,
35
] | python | en | ['en', 'en', 'en'] | True |
GreeFreshAirSwitchEntity.__init__ | (self, coordinator) | Initialize the Gree device. | Initialize the Gree device. | def __init__(self, coordinator):
"""Initialize the Gree device."""
super().__init__(coordinator, "Fresh Air") | [
"def",
"__init__",
"(",
"self",
",",
"coordinator",
")",
":",
"super",
"(",
")",
".",
"__init__",
"(",
"coordinator",
",",
"\"Fresh Air\"",
")"
] | [
102,
4
] | [
104,
50
] | python | en | ['en', 'en', 'en'] | True |
GreeFreshAirSwitchEntity.device_class | (self) | Return the class of this device, from component DEVICE_CLASSES. | Return the class of this device, from component DEVICE_CLASSES. | def device_class(self):
"""Return the class of this device, from component DEVICE_CLASSES."""
return DEVICE_CLASS_SWITCH | [
"def",
"device_class",
"(",
"self",
")",
":",
"return",
"DEVICE_CLASS_SWITCH"
] | [
107,
4
] | [
109,
34
] | python | en | ['en', 'en', 'en'] | True |
GreeFreshAirSwitchEntity.is_on | (self) | Return if the state is turned on. | Return if the state is turned on. | def is_on(self) -> bool:
"""Return if the state is turned on."""
return self.coordinator.device.fresh_air | [
"def",
"is_on",
"(",
"self",
")",
"->",
"bool",
":",
"return",
"self",
".",
"coordinator",
".",
"device",
".",
"fresh_air"
] | [
112,
4
] | [
114,
48
] | python | en | ['en', 'en', 'en'] | True |
GreeFreshAirSwitchEntity.async_turn_on | (self, **kwargs) | Turn the entity on. | Turn the entity on. | async def async_turn_on(self, **kwargs):
"""Turn the entity on."""
self.coordinator.device.fresh_air = True
await self.coordinator.push_state_update()
self.async_write_ha_state() | [
"async",
"def",
"async_turn_on",
"(",
"self",
",",
"*",
"*",
"kwargs",
")",
":",
"self",
".",
"coordinator",
".",
"device",
".",
"fresh_air",
"=",
"True",
"await",
"self",
".",
"coordinator",
".",
"push_state_update",
"(",
")",
"self",
".",
"async_write_ha... | [
116,
4
] | [
120,
35
] | python | en | ['en', 'en', 'en'] | True |
GreeFreshAirSwitchEntity.async_turn_off | (self, **kwargs) | Turn the entity off. | Turn the entity off. | async def async_turn_off(self, **kwargs):
"""Turn the entity off."""
self.coordinator.device.fresh_air = False
await self.coordinator.push_state_update()
self.async_write_ha_state() | [
"async",
"def",
"async_turn_off",
"(",
"self",
",",
"*",
"*",
"kwargs",
")",
":",
"self",
".",
"coordinator",
".",
"device",
".",
"fresh_air",
"=",
"False",
"await",
"self",
".",
"coordinator",
".",
"push_state_update",
"(",
")",
"self",
".",
"async_write_... | [
122,
4
] | [
126,
35
] | python | en | ['en', 'en', 'en'] | True |
GreeXFanSwitchEntity.__init__ | (self, coordinator) | Initialize the Gree device. | Initialize the Gree device. | def __init__(self, coordinator):
"""Initialize the Gree device."""
super().__init__(coordinator, "XFan") | [
"def",
"__init__",
"(",
"self",
",",
"coordinator",
")",
":",
"super",
"(",
")",
".",
"__init__",
"(",
"coordinator",
",",
"\"XFan\"",
")"
] | [
132,
4
] | [
134,
45
] | python | en | ['en', 'en', 'en'] | True |
GreeXFanSwitchEntity.device_class | (self) | Return the class of this device, from component DEVICE_CLASSES. | Return the class of this device, from component DEVICE_CLASSES. | def device_class(self):
"""Return the class of this device, from component DEVICE_CLASSES."""
return DEVICE_CLASS_SWITCH | [
"def",
"device_class",
"(",
"self",
")",
":",
"return",
"DEVICE_CLASS_SWITCH"
] | [
137,
4
] | [
139,
34
] | python | en | ['en', 'en', 'en'] | True |
GreeXFanSwitchEntity.is_on | (self) | Return if the state is turned on. | Return if the state is turned on. | def is_on(self) -> bool:
"""Return if the state is turned on."""
return self.coordinator.device.xfan | [
"def",
"is_on",
"(",
"self",
")",
"->",
"bool",
":",
"return",
"self",
".",
"coordinator",
".",
"device",
".",
"xfan"
] | [
142,
4
] | [
144,
43
] | python | en | ['en', 'en', 'en'] | True |
GreeXFanSwitchEntity.async_turn_on | (self, **kwargs) | Turn the entity on. | Turn the entity on. | async def async_turn_on(self, **kwargs):
"""Turn the entity on."""
self.coordinator.device.xfan = True
await self.coordinator.push_state_update()
self.async_write_ha_state() | [
"async",
"def",
"async_turn_on",
"(",
"self",
",",
"*",
"*",
"kwargs",
")",
":",
"self",
".",
"coordinator",
".",
"device",
".",
"xfan",
"=",
"True",
"await",
"self",
".",
"coordinator",
".",
"push_state_update",
"(",
")",
"self",
".",
"async_write_ha_stat... | [
146,
4
] | [
150,
35
] | python | en | ['en', 'en', 'en'] | True |
GreeXFanSwitchEntity.async_turn_off | (self, **kwargs) | Turn the entity off. | Turn the entity off. | async def async_turn_off(self, **kwargs):
"""Turn the entity off."""
self.coordinator.device.xfan = False
await self.coordinator.push_state_update()
self.async_write_ha_state() | [
"async",
"def",
"async_turn_off",
"(",
"self",
",",
"*",
"*",
"kwargs",
")",
":",
"self",
".",
"coordinator",
".",
"device",
".",
"xfan",
"=",
"False",
"await",
"self",
".",
"coordinator",
".",
"push_state_update",
"(",
")",
"self",
".",
"async_write_ha_st... | [
152,
4
] | [
156,
35
] | python | en | ['en', 'en', 'en'] | True |
test_attributes | (hass) | Test the humidifier attributes are correct. | Test the humidifier attributes are correct. | async def test_attributes(hass):
"""Test the humidifier attributes are correct."""
await setup_platform(hass, HUMIDIFIER_DOMAIN)
state = hass.states.get(DEVICE_ID)
assert state.state == STATE_ON
assert state.attributes.get(ATTR_MIN_HUMIDITY) == DEFAULT_MIN_HUMIDITY
assert state.attributes.get(A... | [
"async",
"def",
"test_attributes",
"(",
"hass",
")",
":",
"await",
"setup_platform",
"(",
"hass",
",",
"HUMIDIFIER_DOMAIN",
")",
"state",
"=",
"hass",
".",
"states",
".",
"get",
"(",
"DEVICE_ID",
")",
"assert",
"state",
".",
"state",
"==",
"STATE_ON",
"ass... | [
37,
0
] | [
53,
73
] | python | en | ['en', 'en', 'en'] | True |
test_turn_on | (hass) | Test the humidifer can be turned on. | Test the humidifer can be turned on. | async def test_turn_on(hass):
"""Test the humidifer can be turned on."""
with patch("pyecobee.Ecobee.set_humidifier_mode") as mock_turn_on:
await setup_platform(hass, HUMIDIFIER_DOMAIN)
await hass.services.async_call(
HUMIDIFIER_DOMAIN,
SERVICE_TURN_ON,
{ATTR... | [
"async",
"def",
"test_turn_on",
"(",
"hass",
")",
":",
"with",
"patch",
"(",
"\"pyecobee.Ecobee.set_humidifier_mode\"",
")",
"as",
"mock_turn_on",
":",
"await",
"setup_platform",
"(",
"hass",
",",
"HUMIDIFIER_DOMAIN",
")",
"await",
"hass",
".",
"services",
".",
... | [
56,
0
] | [
68,
57
] | python | en | ['en', 'en', 'en'] | True |
test_turn_off | (hass) | Test the humidifer can be turned off. | Test the humidifer can be turned off. | async def test_turn_off(hass):
"""Test the humidifer can be turned off."""
with patch("pyecobee.Ecobee.set_humidifier_mode") as mock_turn_off:
await setup_platform(hass, HUMIDIFIER_DOMAIN)
await hass.services.async_call(
HUMIDIFIER_DOMAIN,
SERVICE_TURN_OFF,
{... | [
"async",
"def",
"test_turn_off",
"(",
"hass",
")",
":",
"with",
"patch",
"(",
"\"pyecobee.Ecobee.set_humidifier_mode\"",
")",
"as",
"mock_turn_off",
":",
"await",
"setup_platform",
"(",
"hass",
",",
"HUMIDIFIER_DOMAIN",
")",
"await",
"hass",
".",
"services",
".",
... | [
71,
0
] | [
83,
59
] | python | en | ['en', 'en', 'en'] | True |
test_set_mode | (hass) | Test the humidifer can change modes. | Test the humidifer can change modes. | async def test_set_mode(hass):
"""Test the humidifer can change modes."""
with patch("pyecobee.Ecobee.set_humidifier_mode") as mock_set_mode:
await setup_platform(hass, HUMIDIFIER_DOMAIN)
await hass.services.async_call(
HUMIDIFIER_DOMAIN,
SERVICE_SET_MODE,
{A... | [
"async",
"def",
"test_set_mode",
"(",
"hass",
")",
":",
"with",
"patch",
"(",
"\"pyecobee.Ecobee.set_humidifier_mode\"",
")",
"as",
"mock_set_mode",
":",
"await",
"setup_platform",
"(",
"hass",
",",
"HUMIDIFIER_DOMAIN",
")",
"await",
"hass",
".",
"services",
".",
... | [
86,
0
] | [
115,
13
] | python | en | ['en', 'en', 'en'] | True |
test_set_humidity | (hass) | Test the humidifer can set humidity level. | Test the humidifer can set humidity level. | async def test_set_humidity(hass):
"""Test the humidifer can set humidity level."""
with patch("pyecobee.Ecobee.set_humidity") as mock_set_humidity:
await setup_platform(hass, HUMIDIFIER_DOMAIN)
await hass.services.async_call(
HUMIDIFIER_DOMAIN,
SERVICE_SET_HUMIDITY,
... | [
"async",
"def",
"test_set_humidity",
"(",
"hass",
")",
":",
"with",
"patch",
"(",
"\"pyecobee.Ecobee.set_humidity\"",
")",
"as",
"mock_set_humidity",
":",
"await",
"setup_platform",
"(",
"hass",
",",
"HUMIDIFIER_DOMAIN",
")",
"await",
"hass",
".",
"services",
".",... | [
118,
0
] | [
130,
56
] | python | en | ['en', 'en', 'en'] | True |
TestWorkdaySetup.setup_method | (self) | Set up things to be run when tests are started. | Set up things to be run when tests are started. | def setup_method(self):
"""Set up things to be run when tests are started."""
self.hass = get_test_home_assistant()
# Set valid default config for test
self.config_province = {
"binary_sensor": {"platform": "workday", "country": "DE", "province": "BW"}
}
sel... | [
"def",
"setup_method",
"(",
"self",
")",
":",
"self",
".",
"hass",
"=",
"get_test_home_assistant",
"(",
")",
"# Set valid default config for test",
"self",
".",
"config_province",
"=",
"{",
"\"binary_sensor\"",
":",
"{",
"\"platform\"",
":",
"\"workday\"",
",",
"\... | [
18,
4
] | [
107,
9
] | python | en | ['en', 'en', 'en'] | True |
TestWorkdaySetup.teardown_method | (self) | Stop everything that was started. | Stop everything that was started. | def teardown_method(self):
"""Stop everything that was started."""
self.hass.stop() | [
"def",
"teardown_method",
"(",
"self",
")",
":",
"self",
".",
"hass",
".",
"stop",
"(",
")"
] | [
109,
4
] | [
111,
24
] | python | en | ['en', 'en', 'en'] | True |
TestWorkdaySetup.test_valid_country | (self) | Test topic name/filter validation. | Test topic name/filter validation. | def test_valid_country(self):
"""Test topic name/filter validation."""
# Invalid UTF-8, must not contain U+D800 to U+DFFF
with pytest.raises(vol.Invalid):
binary_sensor.valid_country("\ud800")
with pytest.raises(vol.Invalid):
binary_sensor.valid_country("\udfff")
... | [
"def",
"test_valid_country",
"(",
"self",
")",
":",
"# Invalid UTF-8, must not contain U+D800 to U+DFFF",
"with",
"pytest",
".",
"raises",
"(",
"vol",
".",
"Invalid",
")",
":",
"binary_sensor",
".",
"valid_country",
"(",
"\"\\ud800\"",
")",
"with",
"pytest",
".",
... | [
113,
4
] | [
125,
60
] | python | en | ['en', 'en', 'en'] | True |
TestWorkdaySetup.test_setup_component_province | (self) | Set up workday component. | Set up workday component. | def test_setup_component_province(self):
"""Set up workday component."""
with assert_setup_component(1, "binary_sensor"):
setup_component(self.hass, "binary_sensor", self.config_province)
self.hass.block_till_done()
entity = self.hass.states.get("binary_sensor.workday_se... | [
"def",
"test_setup_component_province",
"(",
"self",
")",
":",
"with",
"assert_setup_component",
"(",
"1",
",",
"\"binary_sensor\"",
")",
":",
"setup_component",
"(",
"self",
".",
"hass",
",",
"\"binary_sensor\"",
",",
"self",
".",
"config_province",
")",
"self",
... | [
127,
4
] | [
134,
33
] | python | en | ['en', 'en', 'en'] | True |
TestWorkdaySetup.test_workday_province | (self, mock_date) | Test if workdays are reported correctly. | Test if workdays are reported correctly. | def test_workday_province(self, mock_date):
"""Test if workdays are reported correctly."""
with assert_setup_component(1, "binary_sensor"):
setup_component(self.hass, "binary_sensor", self.config_province)
self.hass.block_till_done()
self.hass.start()
entity = s... | [
"def",
"test_workday_province",
"(",
"self",
",",
"mock_date",
")",
":",
"with",
"assert_setup_component",
"(",
"1",
",",
"\"binary_sensor\"",
")",
":",
"setup_component",
"(",
"self",
".",
"hass",
",",
"\"binary_sensor\"",
",",
"self",
".",
"config_province",
"... | [
138,
4
] | [
147,
35
] | python | en | ['en', 'en', 'en'] | True |
TestWorkdaySetup.test_weekend_province | (self, mock_date) | Test if weekends are reported correctly. | Test if weekends are reported correctly. | def test_weekend_province(self, mock_date):
"""Test if weekends are reported correctly."""
with assert_setup_component(1, "binary_sensor"):
setup_component(self.hass, "binary_sensor", self.config_province)
self.hass.block_till_done()
self.hass.start()
entity = s... | [
"def",
"test_weekend_province",
"(",
"self",
",",
"mock_date",
")",
":",
"with",
"assert_setup_component",
"(",
"1",
",",
"\"binary_sensor\"",
")",
":",
"setup_component",
"(",
"self",
".",
"hass",
",",
"\"binary_sensor\"",
",",
"self",
".",
"config_province",
"... | [
151,
4
] | [
160,
36
] | python | en | ['en', 'en', 'en'] | True |
TestWorkdaySetup.test_public_holiday_province | (self, mock_date) | Test if public holidays are reported correctly. | Test if public holidays are reported correctly. | def test_public_holiday_province(self, mock_date):
"""Test if public holidays are reported correctly."""
with assert_setup_component(1, "binary_sensor"):
setup_component(self.hass, "binary_sensor", self.config_province)
self.hass.block_till_done()
self.hass.start()
... | [
"def",
"test_public_holiday_province",
"(",
"self",
",",
"mock_date",
")",
":",
"with",
"assert_setup_component",
"(",
"1",
",",
"\"binary_sensor\"",
")",
":",
"setup_component",
"(",
"self",
".",
"hass",
",",
"\"binary_sensor\"",
",",
"self",
".",
"config_provinc... | [
164,
4
] | [
173,
36
] | python | en | ['en', 'en', 'en'] | True |
TestWorkdaySetup.test_setup_component_noprovince | (self) | Set up workday component. | Set up workday component. | def test_setup_component_noprovince(self):
"""Set up workday component."""
with assert_setup_component(1, "binary_sensor"):
setup_component(self.hass, "binary_sensor", self.config_noprovince)
self.hass.block_till_done()
entity = self.hass.states.get("binary_sensor.workda... | [
"def",
"test_setup_component_noprovince",
"(",
"self",
")",
":",
"with",
"assert_setup_component",
"(",
"1",
",",
"\"binary_sensor\"",
")",
":",
"setup_component",
"(",
"self",
".",
"hass",
",",
"\"binary_sensor\"",
",",
"self",
".",
"config_noprovince",
")",
"sel... | [
175,
4
] | [
182,
33
] | python | en | ['en', 'en', 'en'] | True |
TestWorkdaySetup.test_public_holiday_noprovince | (self, mock_date) | Test if public holidays are reported correctly. | Test if public holidays are reported correctly. | def test_public_holiday_noprovince(self, mock_date):
"""Test if public holidays are reported correctly."""
with assert_setup_component(1, "binary_sensor"):
setup_component(self.hass, "binary_sensor", self.config_noprovince)
self.hass.block_till_done()
self.hass.start()
... | [
"def",
"test_public_holiday_noprovince",
"(",
"self",
",",
"mock_date",
")",
":",
"with",
"assert_setup_component",
"(",
"1",
",",
"\"binary_sensor\"",
")",
":",
"setup_component",
"(",
"self",
".",
"hass",
",",
"\"binary_sensor\"",
",",
"self",
".",
"config_nopro... | [
186,
4
] | [
195,
35
] | python | en | ['en', 'en', 'en'] | True |
TestWorkdaySetup.test_public_holiday_state | (self, mock_date) | Test if public holidays are reported correctly. | Test if public holidays are reported correctly. | def test_public_holiday_state(self, mock_date):
"""Test if public holidays are reported correctly."""
with assert_setup_component(1, "binary_sensor"):
setup_component(self.hass, "binary_sensor", self.config_state)
self.hass.start()
entity = self.hass.states.get("binary_sens... | [
"def",
"test_public_holiday_state",
"(",
"self",
",",
"mock_date",
")",
":",
"with",
"assert_setup_component",
"(",
"1",
",",
"\"binary_sensor\"",
")",
":",
"setup_component",
"(",
"self",
".",
"hass",
",",
"\"binary_sensor\"",
",",
"self",
".",
"config_state",
... | [
199,
4
] | [
207,
36
] | python | en | ['en', 'en', 'en'] | True |
TestWorkdaySetup.test_public_holiday_nostate | (self, mock_date) | Test if public holidays are reported correctly. | Test if public holidays are reported correctly. | def test_public_holiday_nostate(self, mock_date):
"""Test if public holidays are reported correctly."""
with assert_setup_component(1, "binary_sensor"):
setup_component(self.hass, "binary_sensor", self.config_nostate)
self.hass.start()
entity = self.hass.states.get("binary_... | [
"def",
"test_public_holiday_nostate",
"(",
"self",
",",
"mock_date",
")",
":",
"with",
"assert_setup_component",
"(",
"1",
",",
"\"binary_sensor\"",
")",
":",
"setup_component",
"(",
"self",
".",
"hass",
",",
"\"binary_sensor\"",
",",
"self",
".",
"config_nostate"... | [
211,
4
] | [
219,
35
] | python | en | ['en', 'en', 'en'] | True |
TestWorkdaySetup.test_setup_component_invalidprovince | (self) | Set up workday component. | Set up workday component. | def test_setup_component_invalidprovince(self):
"""Set up workday component."""
with assert_setup_component(1, "binary_sensor"):
setup_component(self.hass, "binary_sensor", self.config_invalidprovince)
entity = self.hass.states.get("binary_sensor.workday_sensor")
assert enti... | [
"def",
"test_setup_component_invalidprovince",
"(",
"self",
")",
":",
"with",
"assert_setup_component",
"(",
"1",
",",
"\"binary_sensor\"",
")",
":",
"setup_component",
"(",
"self",
".",
"hass",
",",
"\"binary_sensor\"",
",",
"self",
".",
"config_invalidprovince",
"... | [
221,
4
] | [
227,
29
] | python | en | ['en', 'en', 'en'] | True |
TestWorkdaySetup.test_public_holiday_includeholiday | (self, mock_date) | Test if public holidays are reported correctly. | Test if public holidays are reported correctly. | def test_public_holiday_includeholiday(self, mock_date):
"""Test if public holidays are reported correctly."""
with assert_setup_component(1, "binary_sensor"):
setup_component(self.hass, "binary_sensor", self.config_includeholiday)
self.hass.start()
entity = self.hass.state... | [
"def",
"test_public_holiday_includeholiday",
"(",
"self",
",",
"mock_date",
")",
":",
"with",
"assert_setup_component",
"(",
"1",
",",
"\"binary_sensor\"",
")",
":",
"setup_component",
"(",
"self",
".",
"hass",
",",
"\"binary_sensor\"",
",",
"self",
".",
"config_i... | [
231,
4
] | [
239,
35
] | python | en | ['en', 'en', 'en'] | True |
TestWorkdaySetup.test_tomorrow | (self, mock_date) | Test if tomorrow are reported correctly. | Test if tomorrow are reported correctly. | def test_tomorrow(self, mock_date):
"""Test if tomorrow are reported correctly."""
with assert_setup_component(1, "binary_sensor"):
setup_component(self.hass, "binary_sensor", self.config_tomorrow)
self.hass.start()
entity = self.hass.states.get("binary_sensor.workday_senso... | [
"def",
"test_tomorrow",
"(",
"self",
",",
"mock_date",
")",
":",
"with",
"assert_setup_component",
"(",
"1",
",",
"\"binary_sensor\"",
")",
":",
"setup_component",
"(",
"self",
".",
"hass",
",",
"\"binary_sensor\"",
",",
"self",
".",
"config_tomorrow",
")",
"s... | [
243,
4
] | [
251,
36
] | python | en | ['en', 'en', 'en'] | True |
TestWorkdaySetup.test_day_after_tomorrow | (self, mock_date) | Test if the day after tomorrow are reported correctly. | Test if the day after tomorrow are reported correctly. | def test_day_after_tomorrow(self, mock_date):
"""Test if the day after tomorrow are reported correctly."""
with assert_setup_component(1, "binary_sensor"):
setup_component(self.hass, "binary_sensor", self.config_day_after_tomorrow)
self.hass.start()
entity = self.hass.state... | [
"def",
"test_day_after_tomorrow",
"(",
"self",
",",
"mock_date",
")",
":",
"with",
"assert_setup_component",
"(",
"1",
",",
"\"binary_sensor\"",
")",
":",
"setup_component",
"(",
"self",
".",
"hass",
",",
"\"binary_sensor\"",
",",
"self",
".",
"config_day_after_to... | [
255,
4
] | [
263,
35
] | python | en | ['en', 'en', 'en'] | True |
TestWorkdaySetup.test_yesterday | (self, mock_date) | Test if yesterday are reported correctly. | Test if yesterday are reported correctly. | def test_yesterday(self, mock_date):
"""Test if yesterday are reported correctly."""
with assert_setup_component(1, "binary_sensor"):
setup_component(self.hass, "binary_sensor", self.config_yesterday)
self.hass.start()
entity = self.hass.states.get("binary_sensor.workday_se... | [
"def",
"test_yesterday",
"(",
"self",
",",
"mock_date",
")",
":",
"with",
"assert_setup_component",
"(",
"1",
",",
"\"binary_sensor\"",
")",
":",
"setup_component",
"(",
"self",
".",
"hass",
",",
"\"binary_sensor\"",
",",
"self",
".",
"config_yesterday",
")",
... | [
267,
4
] | [
275,
35
] | python | en | ['en', 'en', 'en'] | True |
TestWorkdaySetup.test_config_example1_holiday | (self, mock_date) | Test if public holidays are reported correctly. | Test if public holidays are reported correctly. | def test_config_example1_holiday(self, mock_date):
"""Test if public holidays are reported correctly."""
with assert_setup_component(1, "binary_sensor"):
setup_component(self.hass, "binary_sensor", self.config_example1)
self.hass.start()
entity = self.hass.states.get("binar... | [
"def",
"test_config_example1_holiday",
"(",
"self",
",",
"mock_date",
")",
":",
"with",
"assert_setup_component",
"(",
"1",
",",
"\"binary_sensor\"",
")",
":",
"setup_component",
"(",
"self",
".",
"hass",
",",
"\"binary_sensor\"",
",",
"self",
".",
"config_example... | [
280,
4
] | [
288,
35
] | python | en | ['en', 'en', 'en'] | True |
TestWorkdaySetup.test_config_example2_tue | (self, mock_date) | Test if public holidays are reported correctly. | Test if public holidays are reported correctly. | def test_config_example2_tue(self, mock_date):
"""Test if public holidays are reported correctly."""
with assert_setup_component(1, "binary_sensor"):
setup_component(self.hass, "binary_sensor", self.config_example2)
self.hass.start()
entity = self.hass.states.get("binary_se... | [
"def",
"test_config_example2_tue",
"(",
"self",
",",
"mock_date",
")",
":",
"with",
"assert_setup_component",
"(",
"1",
",",
"\"binary_sensor\"",
")",
":",
"setup_component",
"(",
"self",
".",
"hass",
",",
"\"binary_sensor\"",
",",
"self",
".",
"config_example2",
... | [
292,
4
] | [
300,
36
] | python | en | ['en', 'en', 'en'] | True |
TestWorkdaySetup.test_config_example2_add_holiday | (self, mock_date) | Test if public holidays are reported correctly. | Test if public holidays are reported correctly. | def test_config_example2_add_holiday(self, mock_date):
"""Test if public holidays are reported correctly."""
with assert_setup_component(1, "binary_sensor"):
setup_component(self.hass, "binary_sensor", self.config_example2)
self.hass.start()
entity = self.hass.states.get("b... | [
"def",
"test_config_example2_add_holiday",
"(",
"self",
",",
"mock_date",
")",
":",
"with",
"assert_setup_component",
"(",
"1",
",",
"\"binary_sensor\"",
")",
":",
"setup_component",
"(",
"self",
".",
"hass",
",",
"\"binary_sensor\"",
",",
"self",
".",
"config_exa... | [
304,
4
] | [
312,
36
] | python | en | ['en', 'en', 'en'] | True |
TestWorkdaySetup.test_day_to_string | (self) | Test if day_to_string is behaving correctly. | Test if day_to_string is behaving correctly. | def test_day_to_string(self):
"""Test if day_to_string is behaving correctly."""
assert binary_sensor.day_to_string(0) == "mon"
assert binary_sensor.day_to_string(1) == "tue"
assert binary_sensor.day_to_string(7) == "holiday"
assert binary_sensor.day_to_string(8) is None | [
"def",
"test_day_to_string",
"(",
"self",
")",
":",
"assert",
"binary_sensor",
".",
"day_to_string",
"(",
"0",
")",
"==",
"\"mon\"",
"assert",
"binary_sensor",
".",
"day_to_string",
"(",
"1",
")",
"==",
"\"tue\"",
"assert",
"binary_sensor",
".",
"day_to_string",... | [
314,
4
] | [
319,
53
] | python | en | ['en', 'en', 'en'] | True |
TestWorkdaySetup.test_config_remove_holidays_xmas | (self, mock_date) | Test if removed holidays are reported correctly. | Test if removed holidays are reported correctly. | def test_config_remove_holidays_xmas(self, mock_date):
"""Test if removed holidays are reported correctly."""
with assert_setup_component(1, "binary_sensor"):
setup_component(self.hass, "binary_sensor", self.config_remove_holidays)
self.hass.start()
entity = self.hass.state... | [
"def",
"test_config_remove_holidays_xmas",
"(",
"self",
",",
"mock_date",
")",
":",
"with",
"assert_setup_component",
"(",
"1",
",",
"\"binary_sensor\"",
")",
":",
"setup_component",
"(",
"self",
".",
"hass",
",",
"\"binary_sensor\"",
",",
"self",
".",
"config_rem... | [
323,
4
] | [
331,
35
] | python | en | ['en', 'en', 'en'] | True |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.