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
AugustEntityMixin.should_poll
(self)
Return False, updates are controlled via the hub.
Return False, updates are controlled via the hub.
def should_poll(self): """Return False, updates are controlled via the hub.""" return False
[ "def", "should_poll", "(", "self", ")", ":", "return", "False" ]
[ 18, 4 ]
[ 20, 20 ]
python
en
['en', 'sm', 'en']
True
AugustEntityMixin.device_info
(self)
Return the device_info of the device.
Return the device_info of the device.
def device_info(self): """Return the device_info of the device.""" return { "identifiers": {(DOMAIN, self._device_id)}, "name": self._device.device_name, "manufacturer": MANUFACTURER, "sw_version": self._detail.firmware_version, "model": self._...
[ "def", "device_info", "(", "self", ")", ":", "return", "{", "\"identifiers\"", ":", "{", "(", "DOMAIN", ",", "self", ".", "_device_id", ")", "}", ",", "\"name\"", ":", "self", ".", "_device", ".", "device_name", ",", "\"manufacturer\"", ":", "MANUFACTURER"...
[ 31, 4 ]
[ 39, 9 ]
python
en
['en', 'en', 'en']
True
AugustEntityMixin.async_added_to_hass
(self)
Subscribe to updates.
Subscribe to updates.
async def async_added_to_hass(self): """Subscribe to updates.""" self.async_on_remove( self._data.async_subscribe_device_id( self._device_id, self._update_from_data_and_write_state ) ) self.async_on_remove( self._data.activity_stream.as...
[ "async", "def", "async_added_to_hass", "(", "self", ")", ":", "self", ".", "async_on_remove", "(", "self", ".", "_data", ".", "async_subscribe_device_id", "(", "self", ".", "_device_id", ",", "self", ".", "_update_from_data_and_write_state", ")", ")", "self", "....
[ 46, 4 ]
[ 57, 9 ]
python
en
['en', 'en', 'en']
True
init_config_flow
(hass, side_effect=None)
Init a configuration flow.
Init a configuration flow.
def init_config_flow(hass, side_effect=None): """Init a configuration flow.""" config_flow.register_flow_implementation(hass, DOMAIN, "id", "secret") flow = config_flow.PointFlowHandler() flow._get_authorization_url = AsyncMock( # pylint: disable=protected-access return_value="https://example.c...
[ "def", "init_config_flow", "(", "hass", ",", "side_effect", "=", "None", ")", ":", "config_flow", ".", "register_flow_implementation", "(", "hass", ",", "DOMAIN", ",", "\"id\"", ",", "\"secret\"", ")", "flow", "=", "config_flow", ".", "PointFlowHandler", "(", ...
[ 12, 0 ]
[ 20, 15 ]
python
en
['es', 'fr', 'en']
False
is_authorized
()
Set PointSession authorized.
Set PointSession authorized.
def is_authorized(): """Set PointSession authorized.""" return True
[ "def", "is_authorized", "(", ")", ":", "return", "True" ]
[ 24, 0 ]
[ 26, 15 ]
python
de
['de', 'zu', 'en']
False
mock_pypoint
(is_authorized)
Mock pypoint.
Mock pypoint.
def mock_pypoint(is_authorized): # pylint: disable=redefined-outer-name """Mock pypoint.""" with patch( "homeassistant.components.point.config_flow.PointSession" ) as PointSession: PointSession.return_value.get_access_token = AsyncMock( return_value={"access_token": "boo"} ...
[ "def", "mock_pypoint", "(", "is_authorized", ")", ":", "# pylint: disable=redefined-outer-name", "with", "patch", "(", "\"homeassistant.components.point.config_flow.PointSession\"", ")", "as", "PointSession", ":", "PointSession", ".", "return_value", ".", "get_access_token", ...
[ 30, 0 ]
[ 42, 26 ]
python
en
['en', 'en', 'en']
False
test_abort_if_no_implementation_registered
(hass)
Test we abort if no implementation is registered.
Test we abort if no implementation is registered.
async def test_abort_if_no_implementation_registered(hass): """Test we abort if no implementation is registered.""" flow = config_flow.PointFlowHandler() flow.hass = hass result = await flow.async_step_user() assert result["type"] == data_entry_flow.RESULT_TYPE_ABORT assert result["reason"] == ...
[ "async", "def", "test_abort_if_no_implementation_registered", "(", "hass", ")", ":", "flow", "=", "config_flow", ".", "PointFlowHandler", "(", ")", "flow", ".", "hass", "=", "hass", "result", "=", "await", "flow", ".", "async_step_user", "(", ")", "assert", "r...
[ 45, 0 ]
[ 52, 41 ]
python
en
['en', 'en', 'en']
True
test_abort_if_already_setup
(hass)
Test we abort if Point is already setup.
Test we abort if Point is already setup.
async def test_abort_if_already_setup(hass): """Test we abort if Point is already setup.""" flow = init_config_flow(hass) with patch.object(hass.config_entries, "async_entries", return_value=[{}]): result = await flow.async_step_user() assert result["type"] == data_entry_flow.RESULT_TYPE_ABORT ...
[ "async", "def", "test_abort_if_already_setup", "(", "hass", ")", ":", "flow", "=", "init_config_flow", "(", "hass", ")", "with", "patch", ".", "object", "(", "hass", ".", "config_entries", ",", "\"async_entries\"", ",", "return_value", "=", "[", "{", "}", "]...
[ 55, 0 ]
[ 67, 46 ]
python
en
['en', 'en', 'en']
True
test_full_flow_implementation
( hass, mock_pypoint # pylint: disable=redefined-outer-name )
Test registering an implementation and finishing flow works.
Test registering an implementation and finishing flow works.
async def test_full_flow_implementation( hass, mock_pypoint # pylint: disable=redefined-outer-name ): """Test registering an implementation and finishing flow works.""" config_flow.register_flow_implementation(hass, "test-other", None, None) flow = init_config_flow(hass) result = await flow.async_...
[ "async", "def", "test_full_flow_implementation", "(", "hass", ",", "mock_pypoint", "# pylint: disable=redefined-outer-name", ")", ":", "config_flow", ".", "register_flow_implementation", "(", "hass", ",", "\"test-other\"", ",", "None", ",", "None", ")", "flow", "=", "...
[ 70, 0 ]
[ 95, 61 ]
python
en
['en', 'en', 'en']
True
test_step_import
(hass, mock_pypoint)
Test that we trigger import when configuring with client.
Test that we trigger import when configuring with client.
async def test_step_import(hass, mock_pypoint): # pylint: disable=redefined-outer-name """Test that we trigger import when configuring with client.""" flow = init_config_flow(hass) result = await flow.async_step_import() assert result["type"] == data_entry_flow.RESULT_TYPE_FORM assert result["step...
[ "async", "def", "test_step_import", "(", "hass", ",", "mock_pypoint", ")", ":", "# pylint: disable=redefined-outer-name", "flow", "=", "init_config_flow", "(", "hass", ")", "result", "=", "await", "flow", ".", "async_step_import", "(", ")", "assert", "result", "["...
[ 98, 0 ]
[ 104, 38 ]
python
en
['en', 'en', 'en']
True
test_wrong_code_flow_implementation
( hass, mock_pypoint )
Test wrong code.
Test wrong code.
async def test_wrong_code_flow_implementation( hass, mock_pypoint ): # pylint: disable=redefined-outer-name """Test wrong code.""" flow = init_config_flow(hass) result = await flow.async_step_code("123ABC") assert result["type"] == data_entry_flow.RESULT_TYPE_ABORT assert result["reason"] == "...
[ "async", "def", "test_wrong_code_flow_implementation", "(", "hass", ",", "mock_pypoint", ")", ":", "# pylint: disable=redefined-outer-name", "flow", "=", "init_config_flow", "(", "hass", ")", "result", "=", "await", "flow", ".", "async_step_code", "(", "\"123ABC\"", "...
[ 108, 0 ]
[ 116, 43 ]
python
en
['en', 'en', 'en']
True
test_not_pick_implementation_if_only_one
(hass)
Test we allow picking implementation if we have one flow_imp.
Test we allow picking implementation if we have one flow_imp.
async def test_not_pick_implementation_if_only_one(hass): """Test we allow picking implementation if we have one flow_imp.""" flow = init_config_flow(hass) result = await flow.async_step_user() assert result["type"] == data_entry_flow.RESULT_TYPE_FORM assert result["step_id"] == "auth"
[ "async", "def", "test_not_pick_implementation_if_only_one", "(", "hass", ")", ":", "flow", "=", "init_config_flow", "(", "hass", ")", "result", "=", "await", "flow", ".", "async_step_user", "(", ")", "assert", "result", "[", "\"type\"", "]", "==", "data_entry_fl...
[ 119, 0 ]
[ 125, 38 ]
python
en
['en', 'en', 'en']
True
test_abort_if_timeout_generating_auth_url
(hass)
Test we abort if generating authorize url fails.
Test we abort if generating authorize url fails.
async def test_abort_if_timeout_generating_auth_url(hass): """Test we abort if generating authorize url fails.""" flow = init_config_flow(hass, side_effect=asyncio.TimeoutError) result = await flow.async_step_user() assert result["type"] == data_entry_flow.RESULT_TYPE_ABORT assert result["reason"] ...
[ "async", "def", "test_abort_if_timeout_generating_auth_url", "(", "hass", ")", ":", "flow", "=", "init_config_flow", "(", "hass", ",", "side_effect", "=", "asyncio", ".", "TimeoutError", ")", "result", "=", "await", "flow", ".", "async_step_user", "(", ")", "ass...
[ 128, 0 ]
[ 134, 54 ]
python
en
['en', 'zu', 'en']
True
test_abort_if_exception_generating_auth_url
(hass)
Test we abort if generating authorize url blows up.
Test we abort if generating authorize url blows up.
async def test_abort_if_exception_generating_auth_url(hass): """Test we abort if generating authorize url blows up.""" flow = init_config_flow(hass, side_effect=ValueError) result = await flow.async_step_user() assert result["type"] == data_entry_flow.RESULT_TYPE_ABORT assert result["reason"] == "a...
[ "async", "def", "test_abort_if_exception_generating_auth_url", "(", "hass", ")", ":", "flow", "=", "init_config_flow", "(", "hass", ",", "side_effect", "=", "ValueError", ")", "result", "=", "await", "flow", ".", "async_step_user", "(", ")", "assert", "result", ...
[ 137, 0 ]
[ 143, 51 ]
python
en
['de', 'en', 'en']
True
test_abort_no_code
(hass)
Test if no code is given to step_code.
Test if no code is given to step_code.
async def test_abort_no_code(hass): """Test if no code is given to step_code.""" flow = init_config_flow(hass) result = await flow.async_step_code() assert result["type"] == data_entry_flow.RESULT_TYPE_ABORT assert result["reason"] == "no_code"
[ "async", "def", "test_abort_no_code", "(", "hass", ")", ":", "flow", "=", "init_config_flow", "(", "hass", ")", "result", "=", "await", "flow", ".", "async_step_code", "(", ")", "assert", "result", "[", "\"type\"", "]", "==", "data_entry_flow", ".", "RESULT_...
[ 146, 0 ]
[ 152, 40 ]
python
en
['en', 'en', 'en']
True
device_reg
(hass)
Return an empty, loaded, registry.
Return an empty, loaded, registry.
def device_reg(hass): """Return an empty, loaded, registry.""" return mock_device_registry(hass)
[ "def", "device_reg", "(", "hass", ")", ":", "return", "mock_device_registry", "(", "hass", ")" ]
[ 22, 0 ]
[ 24, 37 ]
python
en
['en', 'fy', 'en']
True
calls
(hass)
Track calls to a mock service.
Track calls to a mock service.
def calls(hass): """Track calls to a mock service.""" return async_mock_service(hass, "test", "automation")
[ "def", "calls", "(", "hass", ")", ":", "return", "async_mock_service", "(", "hass", ",", "\"test\"", ",", "\"automation\"", ")" ]
[ 28, 0 ]
[ 30, 57 ]
python
en
['en', 'en', 'en']
True
test_get_triggers
(hass, mock_bridge, device_reg)
Test we get the expected triggers from a hue remote.
Test we get the expected triggers from a hue remote.
async def test_get_triggers(hass, mock_bridge, device_reg): """Test we get the expected triggers from a hue remote.""" mock_bridge.mock_sensor_responses.append(REMOTES_RESPONSE) await setup_bridge(hass, mock_bridge) assert len(mock_bridge.mock_requests) == 1 # 2 remotes, just 1 battery sensor a...
[ "async", "def", "test_get_triggers", "(", "hass", ",", "mock_bridge", ",", "device_reg", ")", ":", "mock_bridge", ".", "mock_sensor_responses", ".", "append", "(", "REMOTES_RESPONSE", ")", "await", "setup_bridge", "(", "hass", ",", "mock_bridge", ")", "assert", ...
[ 33, 0 ]
[ 86, 50 ]
python
en
['en', 'en', 'en']
True
test_if_fires_on_state_change
(hass, mock_bridge, device_reg, calls)
Test for button press trigger firing.
Test for button press trigger firing.
async def test_if_fires_on_state_change(hass, mock_bridge, device_reg, calls): """Test for button press trigger firing.""" mock_bridge.mock_sensor_responses.append(REMOTES_RESPONSE) await setup_bridge(hass, mock_bridge) assert len(mock_bridge.mock_requests) == 1 assert len(hass.states.async_all()) =...
[ "async", "def", "test_if_fires_on_state_change", "(", "hass", ",", "mock_bridge", ",", "device_reg", ",", "calls", ")", ":", "mock_bridge", ".", "mock_sensor_responses", ".", "append", "(", "REMOTES_RESPONSE", ")", "await", "setup_bridge", "(", "hass", ",", "mock_...
[ 89, 0 ]
[ 168, 26 ]
python
en
['en', 'lb', 'en']
True
supports_encryption
()
Test if we support encryption.
Test if we support encryption.
def supports_encryption() -> bool: """Test if we support encryption.""" return nacl is not None
[ "def", "supports_encryption", "(", ")", "->", "bool", ":", "return", "nacl", "is", "not", "None" ]
[ 7, 0 ]
[ 9, 27 ]
python
en
['fr', 'en', 'en']
True
detach_variable
(inputs)
Detach variables Parameters ---------- inputs : pytorch tensors pytorch tensors
Detach variables
def detach_variable(inputs): """ Detach variables Parameters ---------- inputs : pytorch tensors pytorch tensors """ if isinstance(inputs, tuple): return tuple([detach_variable(x) for x in inputs]) else: x = inputs.detach() x.requires_grad = inputs.requir...
[ "def", "detach_variable", "(", "inputs", ")", ":", "if", "isinstance", "(", "inputs", ",", "tuple", ")", ":", "return", "tuple", "(", "[", "detach_variable", "(", "x", ")", "for", "x", "in", "inputs", "]", ")", "else", ":", "x", "=", "inputs", ".", ...
[ 6, 0 ]
[ 20, 16 ]
python
en
['en', 'error', 'th']
False
cross_entropy_with_label_smoothing
(pred, target, label_smoothing=0.1)
Parameters ---------- pred : pytorch tensor predicted value target : pytorch tensor label label_smoothing : float the degree of label smoothing Returns ------- pytorch tensor cross entropy
Parameters ---------- pred : pytorch tensor predicted value target : pytorch tensor label label_smoothing : float the degree of label smoothing
def cross_entropy_with_label_smoothing(pred, target, label_smoothing=0.1): """ Parameters ---------- pred : pytorch tensor predicted value target : pytorch tensor label label_smoothing : float the degree of label smoothing Returns ------- pytorch tensor ...
[ "def", "cross_entropy_with_label_smoothing", "(", "pred", ",", "target", ",", "label_smoothing", "=", "0.1", ")", ":", "logsoftmax", "=", "nn", ".", "LogSoftmax", "(", ")", "n_classes", "=", "pred", ".", "size", "(", "1", ")", "# convert to one-hot", "target",...
[ 22, 0 ]
[ 46, 69 ]
python
en
['en', 'error', 'th']
False
accuracy
(output, target, topk=(1,))
Computes the precision@k for the specified values of k Parameters ---------- output : pytorch tensor output, e.g., predicted value target : pytorch tensor label topk : tuple specify top1 and top5 Returns ------- list accuracy of top1 and top5
Computes the precision@k for the specified values of k
def accuracy(output, target, topk=(1,)): """ Computes the precision@k for the specified values of k Parameters ---------- output : pytorch tensor output, e.g., predicted value target : pytorch tensor label topk : tuple specify top1 and top5 Returns ------- ...
[ "def", "accuracy", "(", "output", ",", "target", ",", "topk", "=", "(", "1", ",", ")", ")", ":", "maxk", "=", "max", "(", "topk", ")", "batch_size", "=", "target", ".", "size", "(", "0", ")", "_", ",", "pred", "=", "output", ".", "topk", "(", ...
[ 48, 0 ]
[ 77, 14 ]
python
en
['en', 'error', 'th']
False
load_vocab
(vocab_file)
Loads a vocabulary file into a dictionary.
Loads a vocabulary file into a dictionary.
def load_vocab(vocab_file): """Loads a vocabulary file into a dictionary.""" vocab = collections.OrderedDict() with open(vocab_file, "r", encoding="utf-8") as reader: tokens = reader.readlines() for index, token in enumerate(tokens): token = token.rstrip("\n") vocab[token] = inde...
[ "def", "load_vocab", "(", "vocab_file", ")", ":", "vocab", "=", "collections", ".", "OrderedDict", "(", ")", "with", "open", "(", "vocab_file", ",", "\"r\"", ",", "encoding", "=", "\"utf-8\"", ")", "as", "reader", ":", "tokens", "=", "reader", ".", "read...
[ 45, 0 ]
[ 53, 16 ]
python
en
['en', 'en', 'en']
True
whitespace_tokenize
(text)
Runs basic whitespace cleaning and splitting on a piece of text.
Runs basic whitespace cleaning and splitting on a piece of text.
def whitespace_tokenize(text): """Runs basic whitespace cleaning and splitting on a piece of text.""" text = text.strip() if not text: return [] tokens = text.split() return tokens
[ "def", "whitespace_tokenize", "(", "text", ")", ":", "text", "=", "text", ".", "strip", "(", ")", "if", "not", "text", ":", "return", "[", "]", "tokens", "=", "text", ".", "split", "(", ")", "return", "tokens" ]
[ 56, 0 ]
[ 62, 17 ]
python
en
['en', 'en', 'en']
True
MPNetTokenizer._convert_token_to_id
(self, token)
Converts a token (str) in an id using the vocab.
Converts a token (str) in an id using the vocab.
def _convert_token_to_id(self, token): """ Converts a token (str) in an id using the vocab. """ return self.vocab.get(token, self.vocab.get(self.unk_token))
[ "def", "_convert_token_to_id", "(", "self", ",", "token", ")", ":", "return", "self", ".", "vocab", ".", "get", "(", "token", ",", "self", ".", "vocab", ".", "get", "(", "self", ".", "unk_token", ")", ")" ]
[ 211, 4 ]
[ 213, 68 ]
python
en
['en', 'en', 'en']
True
MPNetTokenizer._convert_id_to_token
(self, index)
Converts an index (integer) in a token (str) using the vocab.
Converts an index (integer) in a token (str) using the vocab.
def _convert_id_to_token(self, index): """Converts an index (integer) in a token (str) using the vocab.""" return self.ids_to_tokens.get(index, self.unk_token)
[ "def", "_convert_id_to_token", "(", "self", ",", "index", ")", ":", "return", "self", ".", "ids_to_tokens", ".", "get", "(", "index", ",", "self", ".", "unk_token", ")" ]
[ 215, 4 ]
[ 217, 60 ]
python
en
['en', 'en', 'en']
True
MPNetTokenizer.convert_tokens_to_string
(self, tokens)
Converts a sequence of tokens (string) in a single string.
Converts a sequence of tokens (string) in a single string.
def convert_tokens_to_string(self, tokens): """ Converts a sequence of tokens (string) in a single string. """ out_string = " ".join(tokens).replace(" ##", "").strip() return out_string
[ "def", "convert_tokens_to_string", "(", "self", ",", "tokens", ")", ":", "out_string", "=", "\" \"", ".", "join", "(", "tokens", ")", ".", "replace", "(", "\" ##\"", ",", "\"\"", ")", ".", "strip", "(", ")", "return", "out_string" ]
[ 219, 4 ]
[ 222, 25 ]
python
en
['en', 'en', 'en']
True
MPNetTokenizer.build_inputs_with_special_tokens
( self, token_ids_0: List[int], token_ids_1: Optional[List[int]] = None )
Build model inputs from a sequence or a pair of sequence for sequence classification tasks by concatenating and adding special tokens. A MPNet sequence has the following format: - single sequence: ``<s> X </s>`` - pair of sequences: ``<s> A </s></s> B </s>`` Args: ...
Build model inputs from a sequence or a pair of sequence for sequence classification tasks by concatenating and adding special tokens. A MPNet sequence has the following format:
def build_inputs_with_special_tokens( self, token_ids_0: List[int], token_ids_1: Optional[List[int]] = None ) -> List[int]: """ Build model inputs from a sequence or a pair of sequence for sequence classification tasks by concatenating and adding special tokens. A MPNet sequence has ...
[ "def", "build_inputs_with_special_tokens", "(", "self", ",", "token_ids_0", ":", "List", "[", "int", "]", ",", "token_ids_1", ":", "Optional", "[", "List", "[", "int", "]", "]", "=", "None", ")", "->", "List", "[", "int", "]", ":", "if", "token_ids_1", ...
[ 224, 4 ]
[ 247, 64 ]
python
en
['en', 'error', 'th']
False
MPNetTokenizer.get_special_tokens_mask
( self, token_ids_0: List[int], token_ids_1: Optional[List[int]] = None, already_has_special_tokens: bool = False )
Retrieves sequence ids from a token list that has no special tokens added. This method is called when adding special tokens using the tokenizer ``prepare_for_model`` methods. Args: token_ids_0 (:obj:`List[int]`): List of ids. token_ids_1 (:obj:`List[int]...
Retrieves sequence ids from a token list that has no special tokens added. This method is called when adding special tokens using the tokenizer ``prepare_for_model`` methods.
def get_special_tokens_mask( self, token_ids_0: List[int], token_ids_1: Optional[List[int]] = None, already_has_special_tokens: bool = False ) -> List[int]: """ Retrieves sequence ids from a token list that has no special tokens added. This method is called when adding special tokens...
[ "def", "get_special_tokens_mask", "(", "self", ",", "token_ids_0", ":", "List", "[", "int", "]", ",", "token_ids_1", ":", "Optional", "[", "List", "[", "int", "]", "]", "=", "None", ",", "already_has_special_tokens", ":", "bool", "=", "False", ")", "->", ...
[ 249, 4 ]
[ 277, 87 ]
python
en
['en', 'error', 'th']
False
MPNetTokenizer.create_token_type_ids_from_sequences
( self, token_ids_0: List[int], token_ids_1: Optional[List[int]] = None )
Creates a mask from the two sequences passed to be used in a sequence-pair classification task. MPNet does not make use of token type ids, therefore a list of zeros is returned. Args: token_ids_0 (:obj:`List[int]`): List of ids. token_ids_1 (:obj:`List[i...
Creates a mask from the two sequences passed to be used in a sequence-pair classification task. MPNet does not make use of token type ids, therefore a list of zeros is returned.
def create_token_type_ids_from_sequences( self, token_ids_0: List[int], token_ids_1: Optional[List[int]] = None ) -> List[int]: """ Creates a mask from the two sequences passed to be used in a sequence-pair classification task. MPNet does not make use of token type ids, therefore a l...
[ "def", "create_token_type_ids_from_sequences", "(", "self", ",", "token_ids_0", ":", "List", "[", "int", "]", ",", "token_ids_1", ":", "Optional", "[", "List", "[", "int", "]", "]", "=", "None", ")", "->", "List", "[", "int", "]", ":", "sep", "=", "[",...
[ 279, 4 ]
[ 300, 75 ]
python
en
['en', 'error', 'th']
False
BasicTokenizer.tokenize
(self, text, never_split=None)
Basic Tokenization of a piece of text. Split on "white spaces" only, for sub-word tokenization, see WordPieceTokenizer. Args: **never_split**: (`optional`) list of str Kept for backward compatibility purposes. Now implemented directly at the base class level (see ...
Basic Tokenization of a piece of text. Split on "white spaces" only, for sub-word tokenization, see WordPieceTokenizer.
def tokenize(self, text, never_split=None): """ Basic Tokenization of a piece of text. Split on "white spaces" only, for sub-word tokenization, see WordPieceTokenizer. Args: **never_split**: (`optional`) list of str Kept for backward compatibility purposes. N...
[ "def", "tokenize", "(", "self", ",", "text", ",", "never_split", "=", "None", ")", ":", "# union() returns a new set by concatenating the two sets.", "never_split", "=", "self", ".", "never_split", ".", "union", "(", "set", "(", "never_split", ")", ")", "if", "n...
[ 352, 4 ]
[ 387, 28 ]
python
en
['en', 'error', 'th']
False
BasicTokenizer._run_strip_accents
(self, text)
Strips accents from a piece of text.
Strips accents from a piece of text.
def _run_strip_accents(self, text): """Strips accents from a piece of text.""" text = unicodedata.normalize("NFD", text) output = [] for char in text: cat = unicodedata.category(char) if cat == "Mn": continue output.append(char) ...
[ "def", "_run_strip_accents", "(", "self", ",", "text", ")", ":", "text", "=", "unicodedata", ".", "normalize", "(", "\"NFD\"", ",", "text", ")", "output", "=", "[", "]", "for", "char", "in", "text", ":", "cat", "=", "unicodedata", ".", "category", "(",...
[ 389, 4 ]
[ 398, 30 ]
python
en
['en', 'en', 'en']
True
BasicTokenizer._run_split_on_punc
(self, text, never_split=None)
Splits punctuation on a piece of text.
Splits punctuation on a piece of text.
def _run_split_on_punc(self, text, never_split=None): """Splits punctuation on a piece of text.""" if never_split is not None and text in never_split: return [text] chars = list(text) i = 0 start_new_word = True output = [] while i < len(chars): ...
[ "def", "_run_split_on_punc", "(", "self", ",", "text", ",", "never_split", "=", "None", ")", ":", "if", "never_split", "is", "not", "None", "and", "text", "in", "never_split", ":", "return", "[", "text", "]", "chars", "=", "list", "(", "text", ")", "i"...
[ 400, 4 ]
[ 420, 43 ]
python
en
['en', 'en', 'en']
True
BasicTokenizer._tokenize_chinese_chars
(self, text)
Adds whitespace around any CJK character.
Adds whitespace around any CJK character.
def _tokenize_chinese_chars(self, text): """Adds whitespace around any CJK character.""" output = [] for char in text: cp = ord(char) if self._is_chinese_char(cp): output.append(" ") output.append(char) output.append(" ") ...
[ "def", "_tokenize_chinese_chars", "(", "self", ",", "text", ")", ":", "output", "=", "[", "]", "for", "char", "in", "text", ":", "cp", "=", "ord", "(", "char", ")", "if", "self", ".", "_is_chinese_char", "(", "cp", ")", ":", "output", ".", "append", ...
[ 422, 4 ]
[ 433, 30 ]
python
en
['en', 'en', 'en']
True
BasicTokenizer._is_chinese_char
(self, cp)
Checks whether CP is the codepoint of a CJK character.
Checks whether CP is the codepoint of a CJK character.
def _is_chinese_char(self, cp): """Checks whether CP is the codepoint of a CJK character.""" # This defines a "chinese character" as anything in the CJK Unicode block: # https://en.wikipedia.org/wiki/CJK_Unified_Ideographs_(Unicode_block) # # Note that the CJK Unicode block is ...
[ "def", "_is_chinese_char", "(", "self", ",", "cp", ")", ":", "# This defines a \"chinese character\" as anything in the CJK Unicode block:", "# https://en.wikipedia.org/wiki/CJK_Unified_Ideographs_(Unicode_block)", "#", "# Note that the CJK Unicode block is NOT all Japanese and Korean charac...
[ 435, 4 ]
[ 457, 20 ]
python
en
['en', 'en', 'en']
True
BasicTokenizer._clean_text
(self, text)
Performs invalid character removal and whitespace cleanup on text.
Performs invalid character removal and whitespace cleanup on text.
def _clean_text(self, text): """Performs invalid character removal and whitespace cleanup on text.""" output = [] for char in text: cp = ord(char) if cp == 0 or cp == 0xFFFD or _is_control(char): continue if _is_whitespace(char): ...
[ "def", "_clean_text", "(", "self", ",", "text", ")", ":", "output", "=", "[", "]", "for", "char", "in", "text", ":", "cp", "=", "ord", "(", "char", ")", "if", "cp", "==", "0", "or", "cp", "==", "0xFFFD", "or", "_is_control", "(", "char", ")", "...
[ 459, 4 ]
[ 470, 30 ]
python
en
['en', 'en', 'en']
True
WordpieceTokenizer.tokenize
(self, text)
Tokenizes a piece of text into its word pieces. This uses a greedy longest-match-first algorithm to perform tokenization using the given vocabulary. For example, :obj:`input = "unaffable"` wil return as output :obj:`["un", "##aff", "##able"]`. Args: text: A single token or w...
Tokenizes a piece of text into its word pieces. This uses a greedy longest-match-first algorithm to perform tokenization using the given vocabulary.
def tokenize(self, text): """ Tokenizes a piece of text into its word pieces. This uses a greedy longest-match-first algorithm to perform tokenization using the given vocabulary. For example, :obj:`input = "unaffable"` wil return as output :obj:`["un", "##aff", "##able"]`. Args...
[ "def", "tokenize", "(", "self", ",", "text", ")", ":", "output_tokens", "=", "[", "]", "for", "token", "in", "whitespace_tokenize", "(", "text", ")", ":", "chars", "=", "list", "(", "token", ")", "if", "len", "(", "chars", ")", ">", "self", ".", "m...
[ 482, 4 ]
[ 528, 28 ]
python
en
['en', 'error', 'th']
False
validate_input
(hass: core.HomeAssistant, data)
Validate that the user input allows us to connect to DataPoint. Data has the keys from DATA_SCHEMA with values provided by the user.
Validate that the user input allows us to connect to DataPoint.
async def validate_input(hass: core.HomeAssistant, data): """Validate that the user input allows us to connect to DataPoint. Data has the keys from DATA_SCHEMA with values provided by the user. """ latitude = data[CONF_LATITUDE] longitude = data[CONF_LONGITUDE] api_key = data[CONF_API_KEY] ...
[ "async", "def", "validate_input", "(", "hass", ":", "core", ".", "HomeAssistant", ",", "data", ")", ":", "latitude", "=", "data", "[", "CONF_LATITUDE", "]", "longitude", "=", "data", "[", "CONF_LONGITUDE", "]", "api_key", "=", "data", "[", "CONF_API_KEY", ...
[ 15, 0 ]
[ 29, 50 ]
python
en
['en', 'en', 'en']
True
MetOfficeConfigFlow.async_step_user
(self, user_input=None)
Handle the initial step.
Handle the initial step.
async def async_step_user(self, user_input=None): """Handle the initial step.""" errors = {} if user_input is not None: await self.async_set_unique_id( f"{user_input[CONF_LATITUDE]}_{user_input[CONF_LONGITUDE]}" ) self._abort_if_unique_id_confi...
[ "async", "def", "async_step_user", "(", "self", ",", "user_input", "=", "None", ")", ":", "errors", "=", "{", "}", "if", "user_input", "is", "not", "None", ":", "await", "self", ".", "async_set_unique_id", "(", "f\"{user_input[CONF_LATITUDE]}_{user_input[CONF_LONG...
[ 38, 4 ]
[ 74, 9 ]
python
en
['en', 'en', 'en']
True
AugustGateway.__init__
(self, hass)
Init the connection.
Init the connection.
def __init__(self, hass): """Init the connection.""" self._aiohttp_session = aiohttp_client.async_get_clientsession(hass) self._token_refresh_lock = asyncio.Lock() self._access_token_cache_file = None self._hass = hass self._config = None self.api = None s...
[ "def", "__init__", "(", "self", ",", "hass", ")", ":", "self", ".", "_aiohttp_session", "=", "aiohttp_client", ".", "async_get_clientsession", "(", "hass", ")", "self", ".", "_token_refresh_lock", "=", "asyncio", ".", "Lock", "(", ")", "self", ".", "_access_...
[ 33, 4 ]
[ 42, 34 ]
python
en
['en', 'en', 'en']
True
AugustGateway.access_token
(self)
Access token for the api.
Access token for the api.
def access_token(self): """Access token for the api.""" return self.authentication.access_token
[ "def", "access_token", "(", "self", ")", ":", "return", "self", ".", "authentication", ".", "access_token" ]
[ 45, 4 ]
[ 47, 47 ]
python
en
['en', 'gl', 'en']
True
AugustGateway.config_entry
(self)
Config entry.
Config entry.
def config_entry(self): """Config entry.""" return { CONF_LOGIN_METHOD: self._config[CONF_LOGIN_METHOD], CONF_USERNAME: self._config[CONF_USERNAME], CONF_PASSWORD: self._config[CONF_PASSWORD], CONF_INSTALL_ID: self._config.get(CONF_INSTALL_ID), ...
[ "def", "config_entry", "(", "self", ")", ":", "return", "{", "CONF_LOGIN_METHOD", ":", "self", ".", "_config", "[", "CONF_LOGIN_METHOD", "]", ",", "CONF_USERNAME", ":", "self", ".", "_config", "[", "CONF_USERNAME", "]", ",", "CONF_PASSWORD", ":", "self", "."...
[ 49, 4 ]
[ 58, 9 ]
python
da
['da', 'es', 'en']
False
AugustGateway.async_setup
(self, conf)
Create the api and authenticator objects.
Create the api and authenticator objects.
async def async_setup(self, conf): """Create the api and authenticator objects.""" if conf.get(VERIFICATION_CODE_KEY): return self._access_token_cache_file = conf.get( CONF_ACCESS_TOKEN_CACHE_FILE, f".{conf[CONF_USERNAME]}{DEFAULT_AUGUST_CONFIG_FILE}", ...
[ "async", "def", "async_setup", "(", "self", ",", "conf", ")", ":", "if", "conf", ".", "get", "(", "VERIFICATION_CODE_KEY", ")", ":", "return", "self", ".", "_access_token_cache_file", "=", "conf", ".", "get", "(", "CONF_ACCESS_TOKEN_CACHE_FILE", ",", "f\".{con...
[ 60, 4 ]
[ 86, 61 ]
python
en
['en', 'en', 'en']
True
AugustGateway.async_authenticate
(self)
Authenticate with the details provided to setup.
Authenticate with the details provided to setup.
async def async_authenticate(self): """Authenticate with the details provided to setup.""" self.authentication = None try: self.authentication = await self.authenticator.async_authenticate() if self.authentication.state == AuthenticationState.AUTHENTICATED: ...
[ "async", "def", "async_authenticate", "(", "self", ")", ":", "self", ".", "authentication", "=", "None", "try", ":", "self", ".", "authentication", "=", "await", "self", ".", "authenticator", ".", "async_authenticate", "(", ")", "if", "self", ".", "authentic...
[ 88, 4 ]
[ 117, 34 ]
python
en
['en', 'en', 'en']
True
AugustGateway.async_reset_authentication
(self)
Remove the cache file.
Remove the cache file.
async def async_reset_authentication(self): """Remove the cache file.""" await self._hass.async_add_executor_job(self._reset_authentication)
[ "async", "def", "async_reset_authentication", "(", "self", ")", ":", "await", "self", ".", "_hass", ".", "async_add_executor_job", "(", "self", ".", "_reset_authentication", ")" ]
[ 119, 4 ]
[ 121, 75 ]
python
en
['en', 'it', 'en']
True
AugustGateway._reset_authentication
(self)
Remove the cache file.
Remove the cache file.
def _reset_authentication(self): """Remove the cache file.""" if os.path.exists(self._access_token_cache_file): os.unlink(self._access_token_cache_file)
[ "def", "_reset_authentication", "(", "self", ")", ":", "if", "os", ".", "path", ".", "exists", "(", "self", ".", "_access_token_cache_file", ")", ":", "os", ".", "unlink", "(", "self", ".", "_access_token_cache_file", ")" ]
[ 123, 4 ]
[ 126, 52 ]
python
en
['en', 'it', 'en']
True
AugustGateway.async_refresh_access_token_if_needed
(self)
Refresh the august access token if needed.
Refresh the august access token if needed.
async def async_refresh_access_token_if_needed(self): """Refresh the august access token if needed.""" if self.authenticator.should_refresh(): async with self._token_refresh_lock: refreshed_authentication = ( await self.authenticator.async_refresh_access_t...
[ "async", "def", "async_refresh_access_token_if_needed", "(", "self", ")", ":", "if", "self", ".", "authenticator", ".", "should_refresh", "(", ")", ":", "async", "with", "self", ".", "_token_refresh_lock", ":", "refreshed_authentication", "=", "(", "await", "self"...
[ 128, 4 ]
[ 140, 62 ]
python
en
['en', 'en', 'en']
True
load_tf_weights_in_gpt2
(model, gpt2_checkpoint_path)
Load tf checkpoints in a pytorch model
Load tf checkpoints in a pytorch model
def load_tf_weights_in_gpt2(model, gpt2_checkpoint_path): """ Load tf checkpoints in a pytorch model """ try: import re import numpy as np import tensorflow as tf except ImportError: print("Loading a TensorFlow models in PyTorch, requires TensorFlow to be installed. Pleas...
[ "def", "load_tf_weights_in_gpt2", "(", "model", ",", "gpt2_checkpoint_path", ")", ":", "try", ":", "import", "re", "import", "numpy", "as", "np", "import", "tensorflow", "as", "tf", "except", "ImportError", ":", "print", "(", "\"Loading a TensorFlow models in PyTorc...
[ 45, 0 ]
[ 96, 16 ]
python
en
['en', 'en', 'en']
True
GPT2Config.__init__
( self, vocab_size_or_config_json_file=50257, n_positions=1024, n_ctx=1024, n_embd=768, n_layer=12, n_head=12, layer_norm_epsilon=1e-5, initializer_range=0.02, )
Constructs GPT2Config. Args: vocab_size_or_config_json_file: Vocabulary size of `inputs_ids` in `GPT2Model` or a configuration json file. n_positions: Number of positional embeddings. n_ctx: Size of the causal mask (usually same as n_positions). n_embd: Dimension...
Constructs GPT2Config.
def __init__( self, vocab_size_or_config_json_file=50257, n_positions=1024, n_ctx=1024, n_embd=768, n_layer=12, n_head=12, layer_norm_epsilon=1e-5, initializer_range=0.02, ): """Constructs GPT2Config. Args: vocab_si...
[ "def", "__init__", "(", "self", ",", "vocab_size_or_config_json_file", "=", "50257", ",", "n_positions", "=", "1024", ",", "n_ctx", "=", "1024", ",", "n_embd", "=", "768", ",", "n_layer", "=", "12", ",", "n_head", "=", "12", ",", "layer_norm_epsilon", "=",...
[ 107, 4 ]
[ 151, 13 ]
python
en
['en', 'en', 'en']
False
GPT2Config.from_dict
(cls, json_object)
Constructs a `GPT2Config` from a Python dictionary of parameters.
Constructs a `GPT2Config` from a Python dictionary of parameters.
def from_dict(cls, json_object): """Constructs a `GPT2Config` from a Python dictionary of parameters.""" config = GPT2Config(vocab_size_or_config_json_file=-1) for key, value in json_object.items(): config.__dict__[key] = value return config
[ "def", "from_dict", "(", "cls", ",", "json_object", ")", ":", "config", "=", "GPT2Config", "(", "vocab_size_or_config_json_file", "=", "-", "1", ")", "for", "key", ",", "value", "in", "json_object", ".", "items", "(", ")", ":", "config", ".", "__dict__", ...
[ 154, 4 ]
[ 159, 21 ]
python
en
['en', 'en', 'en']
True
GPT2Config.from_json_file
(cls, json_file)
Constructs a `GPT2Config` from a json file of parameters.
Constructs a `GPT2Config` from a json file of parameters.
def from_json_file(cls, json_file): """Constructs a `GPT2Config` from a json file of parameters.""" with open(json_file, "r", encoding="utf-8") as reader: text = reader.read() return cls.from_dict(json.loads(text))
[ "def", "from_json_file", "(", "cls", ",", "json_file", ")", ":", "with", "open", "(", "json_file", ",", "\"r\"", ",", "encoding", "=", "\"utf-8\"", ")", "as", "reader", ":", "text", "=", "reader", ".", "read", "(", ")", "return", "cls", ".", "from_dict...
[ 162, 4 ]
[ 166, 46 ]
python
en
['en', 'en', 'en']
True
GPT2Config.to_dict
(self)
Serializes this instance to a Python dictionary.
Serializes this instance to a Python dictionary.
def to_dict(self): """Serializes this instance to a Python dictionary.""" output = copy.deepcopy(self.__dict__) return output
[ "def", "to_dict", "(", "self", ")", ":", "output", "=", "copy", ".", "deepcopy", "(", "self", ".", "__dict__", ")", "return", "output" ]
[ 171, 4 ]
[ 174, 21 ]
python
en
['en', 'en', 'en']
True
GPT2Config.to_json_string
(self)
Serializes this instance to a JSON string.
Serializes this instance to a JSON string.
def to_json_string(self): """Serializes this instance to a JSON string.""" return json.dumps(self.to_dict(), indent=2, sort_keys=True) + "\n"
[ "def", "to_json_string", "(", "self", ")", ":", "return", "json", ".", "dumps", "(", "self", ".", "to_dict", "(", ")", ",", "indent", "=", "2", ",", "sort_keys", "=", "True", ")", "+", "\"\\n\"" ]
[ 176, 4 ]
[ 178, 74 ]
python
en
['en', 'en', 'en']
True
GPT2PreTrainedModel.init_weights
(self, module)
Initialize the weights.
Initialize the weights.
def init_weights(self, module): """ Initialize the weights. """ if isinstance(module, (nn.Linear, nn.Embedding)): # Slightly different from the TF version which uses truncated_normal for initialization # cf https://github.com/pytorch/pytorch/pull/5617 module.w...
[ "def", "init_weights", "(", "self", ",", "module", ")", ":", "if", "isinstance", "(", "module", ",", "(", "nn", ".", "Linear", ",", "nn", ".", "Embedding", ")", ")", ":", "# Slightly different from the TF version which uses truncated_normal for initialization", "# c...
[ 346, 4 ]
[ 357, 36 ]
python
en
['en', 'en', 'en']
True
GPT2PreTrainedModel.from_pretrained
( cls, pretrained_model_name_or_path, state_dict=None, cache_dir=None, from_tf=False, *inputs, **kwargs )
Instantiate a GPT2PreTrainedModel from a pre-trained model file or a pytorch state dict. Download and cache the pre-trained model file if needed. Params: pretrained_model_name_or_path: either: - a str with the name of a pre-trained model to load selected in the list...
Instantiate a GPT2PreTrainedModel from a pre-trained model file or a pytorch state dict. Download and cache the pre-trained model file if needed.
def from_pretrained( cls, pretrained_model_name_or_path, state_dict=None, cache_dir=None, from_tf=False, *inputs, **kwargs ): """ Instantiate a GPT2PreTrainedModel from a pre-trained model file or a pytorch state dict. Download and cache the pre-trained model file if needed. ...
[ "def", "from_pretrained", "(", "cls", ",", "pretrained_model_name_or_path", ",", "state_dict", "=", "None", ",", "cache_dir", "=", "None", ",", "from_tf", "=", "False", ",", "*", "inputs", ",", "*", "*", "kwargs", ")", ":", "if", "pretrained_model_name_or_path...
[ 360, 4 ]
[ 476, 20 ]
python
en
['en', 'error', 'th']
False
GPT2LMHeadModel.set_tied
(self)
Make sure we are sharing the embeddings
Make sure we are sharing the embeddings
def set_tied(self): """ Make sure we are sharing the embeddings """ self.lm_head.set_embeddings_weights(self.transformer.wte.weight)
[ "def", "set_tied", "(", "self", ")", ":", "self", ".", "lm_head", ".", "set_embeddings_weights", "(", "self", ".", "transformer", ".", "wte", ".", "weight", ")" ]
[ 599, 4 ]
[ 602, 72 ]
python
en
['en', 'en', 'en']
True
GPT2DoubleHeadsModel.set_tied
(self)
Make sure we are sharing the embeddings
Make sure we are sharing the embeddings
def set_tied(self): """ Make sure we are sharing the embeddings """ self.lm_head.set_embeddings_weights(self.transformer.wte.weight)
[ "def", "set_tied", "(", "self", ")", ":", "self", ".", "lm_head", ".", "set_embeddings_weights", "(", "self", ".", "transformer", ".", "wte", ".", "weight", ")" ]
[ 665, 4 ]
[ 668, 72 ]
python
en
['en', 'en', 'en']
True
_CrossNeuronBlock.forward
(self, x)
:param x: (bt, c, h, w) :return:
:param x: (bt, c, h, w) :return:
def forward(self, x): ''' :param x: (bt, c, h, w) :return: ''' bt, c, h, w = x.shape residual = x x_stretch = x.view(bt, c, h * w) self.corr_bf = self._compute_correlation(x) # self.corr_af = self._compute_correlation(x) # return x ...
[ "def", "forward", "(", "self", ",", "x", ")", ":", "bt", ",", "c", ",", "h", ",", "w", "=", "x", ".", "shape", "residual", "=", "x", "x_stretch", "=", "x", ".", "view", "(", "bt", ",", "c", ",", "h", "*", "w", ")", "self", ".", "corr_bf", ...
[ 111, 4 ]
[ 168, 22 ]
python
en
['en', 'error', 'th']
False
cli
(jobset)
Given a Hydra project, inspect latest evaluation and print a summary of failed builds
Given a Hydra project, inspect latest evaluation and print a summary of failed builds
def cli(jobset): """ Given a Hydra project, inspect latest evaluation and print a summary of failed builds """ url = "https://hydra.nixos.org/jobset/{}".format(jobset) # get the last evaluation click.echo(click.style( 'Getting latest evaluation for {}'.format(url), fg='green')) ...
[ "def", "cli", "(", "jobset", ")", ":", "url", "=", "\"https://hydra.nixos.org/jobset/{}\"", ".", "format", "(", "jobset", ")", "# get the last evaluation", "click", ".", "echo", "(", "click", ".", "style", "(", "'Getting latest evaluation for {}'", ".", "format", ...
[ 75, 0 ]
[ 103, 23 ]
python
en
['en', 'error', 'th']
False
async_setup_entry
(hass, config_entry, async_add_entities)
Set up Abode light devices.
Set up Abode light devices.
async def async_setup_entry(hass, config_entry, async_add_entities): """Set up Abode light devices.""" data = hass.data[DOMAIN] entities = [] for device in data.abode.get_devices(generic_type=CONST.TYPE_LIGHT): entities.append(AbodeLight(data, device)) async_add_entities(entities)
[ "async", "def", "async_setup_entry", "(", "hass", ",", "config_entry", ",", "async_add_entities", ")", ":", "data", "=", "hass", ".", "data", "[", "DOMAIN", "]", "entities", "=", "[", "]", "for", "device", "in", "data", ".", "abode", ".", "get_devices", ...
[ 23, 0 ]
[ 32, 32 ]
python
en
['fr', 'en', 'en']
True
AbodeLight.turn_on
(self, **kwargs)
Turn on the light.
Turn on the light.
def turn_on(self, **kwargs): """Turn on the light.""" if ATTR_COLOR_TEMP in kwargs and self._device.is_color_capable: self._device.set_color_temp( int(color_temperature_mired_to_kelvin(kwargs[ATTR_COLOR_TEMP])) ) return if ATTR_HS_COLOR in kwa...
[ "def", "turn_on", "(", "self", ",", "*", "*", "kwargs", ")", ":", "if", "ATTR_COLOR_TEMP", "in", "kwargs", "and", "self", ".", "_device", ".", "is_color_capable", ":", "self", ".", "_device", ".", "set_color_temp", "(", "int", "(", "color_temperature_mired_t...
[ 38, 4 ]
[ 56, 32 ]
python
en
['en', 'et', 'en']
True
AbodeLight.turn_off
(self, **kwargs)
Turn off the light.
Turn off the light.
def turn_off(self, **kwargs): """Turn off the light.""" self._device.switch_off()
[ "def", "turn_off", "(", "self", ",", "*", "*", "kwargs", ")", ":", "self", ".", "_device", ".", "switch_off", "(", ")" ]
[ 58, 4 ]
[ 60, 33 ]
python
en
['en', 'zh', 'en']
True
AbodeLight.is_on
(self)
Return true if device is on.
Return true if device is on.
def is_on(self): """Return true if device is on.""" return self._device.is_on
[ "def", "is_on", "(", "self", ")", ":", "return", "self", ".", "_device", ".", "is_on" ]
[ 63, 4 ]
[ 65, 33 ]
python
en
['en', 'fy', 'en']
True
AbodeLight.brightness
(self)
Return the brightness of the light.
Return the brightness of the light.
def brightness(self): """Return the brightness of the light.""" if self._device.is_dimmable and self._device.has_brightness: brightness = int(self._device.brightness) # Abode returns 100 during device initialization and device refresh if brightness == 100: ...
[ "def", "brightness", "(", "self", ")", ":", "if", "self", ".", "_device", ".", "is_dimmable", "and", "self", ".", "_device", ".", "has_brightness", ":", "brightness", "=", "int", "(", "self", ".", "_device", ".", "brightness", ")", "# Abode returns 100 durin...
[ 68, 4 ]
[ 76, 48 ]
python
en
['en', 'no', 'en']
True
AbodeLight.color_temp
(self)
Return the color temp of the light.
Return the color temp of the light.
def color_temp(self): """Return the color temp of the light.""" if self._device.has_color: return color_temperature_kelvin_to_mired(self._device.color_temp)
[ "def", "color_temp", "(", "self", ")", ":", "if", "self", ".", "_device", ".", "has_color", ":", "return", "color_temperature_kelvin_to_mired", "(", "self", ".", "_device", ".", "color_temp", ")" ]
[ 79, 4 ]
[ 82, 77 ]
python
en
['en', 'en', 'en']
True
AbodeLight.hs_color
(self)
Return the color of the light.
Return the color of the light.
def hs_color(self): """Return the color of the light.""" if self._device.has_color: return self._device.color
[ "def", "hs_color", "(", "self", ")", ":", "if", "self", ".", "_device", ".", "has_color", ":", "return", "self", ".", "_device", ".", "color" ]
[ 85, 4 ]
[ 88, 37 ]
python
en
['en', 'en', 'en']
True
AbodeLight.supported_features
(self)
Flag supported features.
Flag supported features.
def supported_features(self): """Flag supported features.""" if self._device.is_dimmable and self._device.is_color_capable: return SUPPORT_BRIGHTNESS | SUPPORT_COLOR | SUPPORT_COLOR_TEMP if self._device.is_dimmable: return SUPPORT_BRIGHTNESS return 0
[ "def", "supported_features", "(", "self", ")", ":", "if", "self", ".", "_device", ".", "is_dimmable", "and", "self", ".", "_device", ".", "is_color_capable", ":", "return", "SUPPORT_BRIGHTNESS", "|", "SUPPORT_COLOR", "|", "SUPPORT_COLOR_TEMP", "if", "self", ".",...
[ 91, 4 ]
[ 97, 16 ]
python
en
['da', 'en', 'en']
True
vapix_request
(self, session, url, **kwargs)
Return data based on url.
Return data based on url.
async def vapix_request(self, session, url, **kwargs): """Return data based on url.""" if API_DISCOVERY_URL in url: return API_DISCOVERY_RESPONSE if APPLICATIONS_URL in url: return APPLICATIONS_LIST_RESPONSE if BASIC_DEVICE_INFO_URL in url: return BASIC_DEVICE_INFO_RESPONSE i...
[ "async", "def", "vapix_request", "(", "self", ",", "session", ",", "url", ",", "*", "*", "kwargs", ")", ":", "if", "API_DISCOVERY_URL", "in", "url", ":", "return", "API_DISCOVERY_RESPONSE", "if", "APPLICATIONS_URL", "in", "url", ":", "return", "APPLICATIONS_LI...
[ 200, 0 ]
[ 223, 39 ]
python
en
['en', 'no', 'en']
True
setup_axis_integration
(hass, config=ENTRY_CONFIG, options=ENTRY_OPTIONS)
Create the Axis device.
Create the Axis device.
async def setup_axis_integration(hass, config=ENTRY_CONFIG, options=ENTRY_OPTIONS): """Create the Axis device.""" config_entry = MockConfigEntry( domain=AXIS_DOMAIN, data=deepcopy(config), connection_class=config_entries.CONN_CLASS_LOCAL_PUSH, options=deepcopy(options), v...
[ "async", "def", "setup_axis_integration", "(", "hass", ",", "config", "=", "ENTRY_CONFIG", ",", "options", "=", "ENTRY_OPTIONS", ")", ":", "config_entry", "=", "MockConfigEntry", "(", "domain", "=", "AXIS_DOMAIN", ",", "data", "=", "deepcopy", "(", "config", "...
[ 226, 0 ]
[ 244, 23 ]
python
en
['en', 'en', 'en']
True
test_device_setup
(hass)
Successful setup.
Successful setup.
async def test_device_setup(hass): """Successful setup.""" with patch( "homeassistant.config_entries.ConfigEntries.async_forward_entry_setup", return_value=True, ) as forward_entry_setup: config_entry = await setup_axis_integration(hass) device = hass.data[AXIS_DOMAIN][config...
[ "async", "def", "test_device_setup", "(", "hass", ")", ":", "with", "patch", "(", "\"homeassistant.config_entries.ConfigEntries.async_forward_entry_setup\"", ",", "return_value", "=", "True", ",", ")", "as", "forward_entry_setup", ":", "config_entry", "=", "await", "set...
[ 247, 0 ]
[ 272, 50 ]
python
en
['en', 'ro', 'en']
False
test_device_info
(hass)
Verify other path of device information works.
Verify other path of device information works.
async def test_device_info(hass): """Verify other path of device information works.""" api_discovery = deepcopy(API_DISCOVERY_RESPONSE) api_discovery["data"]["apiList"].append(API_DISCOVERY_BASIC_DEVICE_INFO) with patch.dict(API_DISCOVERY_RESPONSE, api_discovery): config_entry = await setup_axi...
[ "async", "def", "test_device_info", "(", "hass", ")", ":", "api_discovery", "=", "deepcopy", "(", "API_DISCOVERY_RESPONSE", ")", "api_discovery", "[", "\"data\"", "]", "[", "\"apiList\"", "]", ".", "append", "(", "API_DISCOVERY_BASIC_DEVICE_INFO", ")", "with", "pa...
[ 275, 0 ]
[ 287, 58 ]
python
en
['en', 'en', 'en']
True
test_device_support_mqtt
(hass, mqtt_mock)
Successful setup.
Successful setup.
async def test_device_support_mqtt(hass, mqtt_mock): """Successful setup.""" api_discovery = deepcopy(API_DISCOVERY_RESPONSE) api_discovery["data"]["apiList"].append(API_DISCOVERY_MQTT) with patch.dict(API_DISCOVERY_RESPONSE, api_discovery): await setup_axis_integration(hass) mqtt_mock.asy...
[ "async", "def", "test_device_support_mqtt", "(", "hass", ",", "mqtt_mock", ")", ":", "api_discovery", "=", "deepcopy", "(", "API_DISCOVERY_RESPONSE", ")", "api_discovery", "[", "\"data\"", "]", "[", "\"apiList\"", "]", ".", "append", "(", "API_DISCOVERY_MQTT", ")"...
[ 290, 0 ]
[ 310, 38 ]
python
en
['en', 'ro', 'en']
False
test_update_address
(hass)
Test update address works.
Test update address works.
async def test_update_address(hass): """Test update address works.""" config_entry = await setup_axis_integration(hass) device = hass.data[AXIS_DOMAIN][config_entry.unique_id] assert device.api.config.host == "1.2.3.4" with patch("axis.vapix.Vapix.request", new=vapix_request), patch( "homea...
[ "async", "def", "test_update_address", "(", "hass", ")", ":", "config_entry", "=", "await", "setup_axis_integration", "(", "hass", ")", "device", "=", "hass", ".", "data", "[", "AXIS_DOMAIN", "]", "[", "config_entry", ".", "unique_id", "]", "assert", "device",...
[ 313, 0 ]
[ 336, 48 ]
python
en
['en', 'de', 'en']
True
test_device_unavailable
(hass)
Successful setup.
Successful setup.
async def test_device_unavailable(hass): """Successful setup.""" config_entry = await setup_axis_integration(hass) device = hass.data[AXIS_DOMAIN][config_entry.unique_id] device.async_connection_status_callback(status=False) assert not device.available
[ "async", "def", "test_device_unavailable", "(", "hass", ")", ":", "config_entry", "=", "await", "setup_axis_integration", "(", "hass", ")", "device", "=", "hass", ".", "data", "[", "AXIS_DOMAIN", "]", "[", "config_entry", ".", "unique_id", "]", "device", ".", ...
[ 339, 0 ]
[ 344, 31 ]
python
en
['en', 'ro', 'en']
False
test_device_reset
(hass)
Successfully reset device.
Successfully reset device.
async def test_device_reset(hass): """Successfully reset device.""" config_entry = await setup_axis_integration(hass) device = hass.data[AXIS_DOMAIN][config_entry.unique_id] result = await device.async_reset() assert result is True
[ "async", "def", "test_device_reset", "(", "hass", ")", ":", "config_entry", "=", "await", "setup_axis_integration", "(", "hass", ")", "device", "=", "hass", ".", "data", "[", "AXIS_DOMAIN", "]", "[", "config_entry", ".", "unique_id", "]", "result", "=", "awa...
[ 347, 0 ]
[ 352, 25 ]
python
en
['en', 'en', 'en']
True
test_device_not_accessible
(hass)
Failed setup schedules a retry of setup.
Failed setup schedules a retry of setup.
async def test_device_not_accessible(hass): """Failed setup schedules a retry of setup.""" with patch.object(axis.device, "get_device", side_effect=axis.errors.CannotConnect): await setup_axis_integration(hass) assert hass.data[AXIS_DOMAIN] == {}
[ "async", "def", "test_device_not_accessible", "(", "hass", ")", ":", "with", "patch", ".", "object", "(", "axis", ".", "device", ",", "\"get_device\"", ",", "side_effect", "=", "axis", ".", "errors", ".", "CannotConnect", ")", ":", "await", "setup_axis_integra...
[ 355, 0 ]
[ 359, 39 ]
python
en
['en', 'pt', 'en']
True
test_device_unknown_error
(hass)
Unknown errors are handled.
Unknown errors are handled.
async def test_device_unknown_error(hass): """Unknown errors are handled.""" with patch.object(axis.device, "get_device", side_effect=Exception): await setup_axis_integration(hass) assert hass.data[AXIS_DOMAIN] == {}
[ "async", "def", "test_device_unknown_error", "(", "hass", ")", ":", "with", "patch", ".", "object", "(", "axis", ".", "device", ",", "\"get_device\"", ",", "side_effect", "=", "Exception", ")", ":", "await", "setup_axis_integration", "(", "hass", ")", "assert"...
[ 362, 0 ]
[ 366, 39 ]
python
en
['en', 'en', 'en']
True
test_new_event_sends_signal
(hass)
Make sure that new event send signal.
Make sure that new event send signal.
async def test_new_event_sends_signal(hass): """Make sure that new event send signal.""" entry = Mock() entry.data = ENTRY_CONFIG axis_device = axis.device.AxisNetworkDevice(hass, entry) with patch.object(axis.device, "async_dispatcher_send") as mock_dispatch_send: axis_device.async_event_...
[ "async", "def", "test_new_event_sends_signal", "(", "hass", ")", ":", "entry", "=", "Mock", "(", ")", "entry", ".", "data", "=", "ENTRY_CONFIG", "axis_device", "=", "axis", ".", "device", ".", "AxisNetworkDevice", "(", "hass", ",", "entry", ")", "with", "p...
[ 369, 0 ]
[ 381, 53 ]
python
en
['en', 'en', 'en']
True
test_shutdown
()
Successful shutdown.
Successful shutdown.
async def test_shutdown(): """Successful shutdown.""" hass = Mock() entry = Mock() entry.data = ENTRY_CONFIG axis_device = axis.device.AxisNetworkDevice(hass, entry) axis_device.api = Mock() axis_device.api.vapix.close = AsyncMock() await axis_device.shutdown(None) assert len(axis...
[ "async", "def", "test_shutdown", "(", ")", ":", "hass", "=", "Mock", "(", ")", "entry", "=", "Mock", "(", ")", "entry", ".", "data", "=", "ENTRY_CONFIG", "axis_device", "=", "axis", ".", "device", ".", "AxisNetworkDevice", "(", "hass", ",", "entry", ")...
[ 384, 0 ]
[ 397, 59 ]
python
en
['en', 'it', 'en']
False
test_get_device_fails
(hass)
Device unauthorized yields authentication required error.
Device unauthorized yields authentication required error.
async def test_get_device_fails(hass): """Device unauthorized yields authentication required error.""" with patch( "axis.vapix.Vapix.request", side_effect=axislib.Unauthorized ), pytest.raises(axis.errors.AuthenticationRequired): await axis.device.get_device(hass, host="", port="", username=...
[ "async", "def", "test_get_device_fails", "(", "hass", ")", ":", "with", "patch", "(", "\"axis.vapix.Vapix.request\"", ",", "side_effect", "=", "axislib", ".", "Unauthorized", ")", ",", "pytest", ".", "raises", "(", "axis", ".", "errors", ".", "AuthenticationRequ...
[ 400, 0 ]
[ 405, 86 ]
python
en
['de', 'en', 'en']
True
test_get_device_device_unavailable
(hass)
Device unavailable yields cannot connect error.
Device unavailable yields cannot connect error.
async def test_get_device_device_unavailable(hass): """Device unavailable yields cannot connect error.""" with patch( "axis.vapix.Vapix.request", side_effect=axislib.RequestError ), pytest.raises(axis.errors.CannotConnect): await axis.device.get_device(hass, host="", port="", username="", pa...
[ "async", "def", "test_get_device_device_unavailable", "(", "hass", ")", ":", "with", "patch", "(", "\"axis.vapix.Vapix.request\"", ",", "side_effect", "=", "axislib", ".", "RequestError", ")", ",", "pytest", ".", "raises", "(", "axis", ".", "errors", ".", "Canno...
[ 408, 0 ]
[ 413, 86 ]
python
br
['br', 'en', 'it']
False
test_get_device_unknown_error
(hass)
Device yield unknown error.
Device yield unknown error.
async def test_get_device_unknown_error(hass): """Device yield unknown error.""" with patch( "axis.vapix.Vapix.request", side_effect=axislib.AxisException ), pytest.raises(axis.errors.AuthenticationRequired): await axis.device.get_device(hass, host="", port="", username="", password="")
[ "async", "def", "test_get_device_unknown_error", "(", "hass", ")", ":", "with", "patch", "(", "\"axis.vapix.Vapix.request\"", ",", "side_effect", "=", "axislib", ".", "AxisException", ")", ",", "pytest", ".", "raises", "(", "axis", ".", "errors", ".", "Authentic...
[ 416, 0 ]
[ 421, 86 ]
python
en
['en', 'en', 'it']
True
async_setup
(hass, config)
Set up the sharkiq environment.
Set up the sharkiq environment.
async def async_setup(hass, config): """Set up the sharkiq environment.""" hass.data.setdefault(DOMAIN, {}) return True
[ "async", "def", "async_setup", "(", "hass", ",", "config", ")", ":", "hass", ".", "data", ".", "setdefault", "(", "DOMAIN", ",", "{", "}", ")", "return", "True" ]
[ 24, 0 ]
[ 27, 15 ]
python
en
['en', 'lb', 'en']
True
async_connect_or_timeout
(ayla_api: AylaApi)
Connect to vacuum.
Connect to vacuum.
async def async_connect_or_timeout(ayla_api: AylaApi) -> bool: """Connect to vacuum.""" try: with async_timeout.timeout(API_TIMEOUT): _LOGGER.debug("Initialize connection to Ayla networks API") await ayla_api.async_sign_in() except SharkIqAuthError: _LOGGER.error("Aut...
[ "async", "def", "async_connect_or_timeout", "(", "ayla_api", ":", "AylaApi", ")", "->", "bool", ":", "try", ":", "with", "async_timeout", ".", "timeout", "(", "API_TIMEOUT", ")", ":", "_LOGGER", ".", "debug", "(", "\"Initialize connection to Ayla networks API\"", ...
[ 30, 0 ]
[ 43, 15 ]
python
en
['en', 'en', 'en']
True
async_setup_entry
(hass, config_entry)
Initialize the sharkiq platform via config entry.
Initialize the sharkiq platform via config entry.
async def async_setup_entry(hass, config_entry): """Initialize the sharkiq platform via config entry.""" ayla_api = get_ayla_api( username=config_entry.data[CONF_USERNAME], password=config_entry.data[CONF_PASSWORD], websession=hass.helpers.aiohttp_client.async_get_clientsession(), ) ...
[ "async", "def", "async_setup_entry", "(", "hass", ",", "config_entry", ")", ":", "ayla_api", "=", "get_ayla_api", "(", "username", "=", "config_entry", ".", "data", "[", "CONF_USERNAME", "]", ",", "password", "=", "config_entry", ".", "data", "[", "CONF_PASSWO...
[ 46, 0 ]
[ 77, 15 ]
python
en
['en', 'pt', 'en']
True
async_disconnect_or_timeout
(coordinator: SharkIqUpdateCoordinator)
Disconnect to vacuum.
Disconnect to vacuum.
async def async_disconnect_or_timeout(coordinator: SharkIqUpdateCoordinator): """Disconnect to vacuum.""" _LOGGER.debug("Disconnecting from Ayla Api") with async_timeout.timeout(5): try: await coordinator.ayla_api.async_sign_out() except (SharkIqAuthError, SharkIqAuthExpiringErro...
[ "async", "def", "async_disconnect_or_timeout", "(", "coordinator", ":", "SharkIqUpdateCoordinator", ")", ":", "_LOGGER", ".", "debug", "(", "\"Disconnecting from Ayla Api\"", ")", "with", "async_timeout", ".", "timeout", "(", "5", ")", ":", "try", ":", "await", "c...
[ 80, 0 ]
[ 87, 16 ]
python
en
['en', 'en', 'en']
True
async_update_options
(hass, config_entry)
Update options.
Update options.
async def async_update_options(hass, config_entry): """Update options.""" await hass.config_entries.async_reload(config_entry.entry_id)
[ "async", "def", "async_update_options", "(", "hass", ",", "config_entry", ")", ":", "await", "hass", ".", "config_entries", ".", "async_reload", "(", "config_entry", ".", "entry_id", ")" ]
[ 90, 0 ]
[ 92, 65 ]
python
en
['en', 'en', 'en']
False
async_unload_entry
(hass, config_entry)
Unload a config entry.
Unload a config entry.
async def async_unload_entry(hass, config_entry): """Unload a config entry.""" unload_ok = all( await asyncio.gather( *[ hass.config_entries.async_forward_entry_unload(config_entry, component) for component in COMPONENTS ] ) ) if un...
[ "async", "def", "async_unload_entry", "(", "hass", ",", "config_entry", ")", ":", "unload_ok", "=", "all", "(", "await", "asyncio", ".", "gather", "(", "*", "[", "hass", ".", "config_entries", ".", "async_forward_entry_unload", "(", "config_entry", ",", "compo...
[ 95, 0 ]
[ 113, 20 ]
python
en
['en', 'es', 'en']
True
async_setup_platform
(hass, config, async_add_entities, discovery_info=None)
Set up the Web scrape sensor.
Set up the Web scrape sensor.
async def async_setup_platform(hass, config, async_add_entities, discovery_info=None): """Set up the Web scrape sensor.""" name = config.get(CONF_NAME) resource = config.get(CONF_RESOURCE) method = "GET" payload = None headers = config.get(CONF_HEADERS) verify_ssl = config.get(CONF_VERIFY_SS...
[ "async", "def", "async_setup_platform", "(", "hass", ",", "config", ",", "async_add_entities", ",", "discovery_info", "=", "None", ")", ":", "name", "=", "config", ".", "get", "(", "CONF_NAME", ")", "resource", "=", "config", ".", "get", "(", "CONF_RESOURCE"...
[ 55, 0 ]
[ 88, 5 ]
python
en
['en', 'ca', 'en']
True
ScrapeSensor.__init__
(self, rest, name, select, attr, index, value_template, unit)
Initialize a web scrape sensor.
Initialize a web scrape sensor.
def __init__(self, rest, name, select, attr, index, value_template, unit): """Initialize a web scrape sensor.""" self.rest = rest self._name = name self._state = None self._select = select self._attr = attr self._index = index self._value_template = value_...
[ "def", "__init__", "(", "self", ",", "rest", ",", "name", ",", "select", ",", "attr", ",", "index", ",", "value_template", ",", "unit", ")", ":", "self", ".", "rest", "=", "rest", "self", ".", "_name", "=", "name", "self", ".", "_state", "=", "None...
[ 94, 4 ]
[ 103, 40 ]
python
co
['en', 'co', 'it']
False
ScrapeSensor.name
(self)
Return the name of the sensor.
Return the name of the sensor.
def name(self): """Return the name of the sensor.""" return self._name
[ "def", "name", "(", "self", ")", ":", "return", "self", ".", "_name" ]
[ 106, 4 ]
[ 108, 25 ]
python
en
['en', 'mi', 'en']
True
ScrapeSensor.unit_of_measurement
(self)
Return the unit the value is expressed in.
Return the unit the value is expressed in.
def unit_of_measurement(self): """Return the unit the value is expressed in.""" return self._unit_of_measurement
[ "def", "unit_of_measurement", "(", "self", ")", ":", "return", "self", ".", "_unit_of_measurement" ]
[ 111, 4 ]
[ 113, 40 ]
python
en
['en', 'en', 'en']
True
ScrapeSensor.state
(self)
Return the state of the device.
Return the state of the device.
def state(self): """Return the state of the device.""" return self._state
[ "def", "state", "(", "self", ")", ":", "return", "self", ".", "_state" ]
[ 116, 4 ]
[ 118, 26 ]
python
en
['en', 'en', 'en']
True
ScrapeSensor._extract_value
(self)
Parse the html extraction in the executor.
Parse the html extraction in the executor.
def _extract_value(self): """Parse the html extraction in the executor.""" raw_data = BeautifulSoup(self.rest.data, "html.parser") _LOGGER.debug(raw_data) if self._attr is not None: value = raw_data.select(self._select)[self._index][self._attr] else: tag ...
[ "def", "_extract_value", "(", "self", ")", ":", "raw_data", "=", "BeautifulSoup", "(", "self", ".", "rest", ".", "data", ",", "\"html.parser\"", ")", "_LOGGER", ".", "debug", "(", "raw_data", ")", "if", "self", ".", "_attr", "is", "not", "None", ":", "...
[ 120, 4 ]
[ 134, 20 ]
python
en
['en', 'en', 'en']
True
ScrapeSensor.async_update
(self)
Get the latest data from the source and updates the state.
Get the latest data from the source and updates the state.
async def async_update(self): """Get the latest data from the source and updates the state.""" await self.rest.async_update() if self.rest.data is None: _LOGGER.error("Unable to retrieve data for %s", self.name) return try: value = await self.hass.asy...
[ "async", "def", "async_update", "(", "self", ")", ":", "await", "self", ".", "rest", ".", "async_update", "(", ")", "if", "self", ".", "rest", ".", "data", "is", "None", ":", "_LOGGER", ".", "error", "(", "\"Unable to retrieve data for %s\"", ",", "self", ...
[ 136, 4 ]
[ 154, 31 ]
python
en
['en', 'en', 'en']
True
ScrapeSensor.async_will_remove_from_hass
(self)
Shutdown the session.
Shutdown the session.
async def async_will_remove_from_hass(self): """Shutdown the session.""" await self.rest.async_remove()
[ "async", "def", "async_will_remove_from_hass", "(", "self", ")", ":", "await", "self", ".", "rest", ".", "async_remove", "(", ")" ]
[ 156, 4 ]
[ 158, 38 ]
python
en
['en', 'bg-Latn', 'en']
True
test_import_shows_user_step
(hass)
Test import source shows the user form.
Test import source shows the user form.
async def test_import_shows_user_step(hass): """Test import source shows the user form.""" # Webhook confirmation shown result = await hass.config_entries.flow.async_init( DOMAIN, context={"source": "import"} ) assert result["type"] == data_entry_flow.RESULT_TYPE_FORM assert result["step...
[ "async", "def", "test_import_shows_user_step", "(", "hass", ")", ":", "# Webhook confirmation shown", "result", "=", "await", "hass", ".", "config_entries", ".", "flow", ".", "async_init", "(", "DOMAIN", ",", "context", "=", "{", "\"source\"", ":", "\"import\"", ...
[ 29, 0 ]
[ 39, 39 ]
python
en
['en', 'en', 'en']
True
test_entry_created
(hass, app, app_oauth_client, location, smartthings_mock)
Test local webhook, new app, install event creates entry.
Test local webhook, new app, install event creates entry.
async def test_entry_created(hass, app, app_oauth_client, location, smartthings_mock): """Test local webhook, new app, install event creates entry.""" token = str(uuid4()) installed_app_id = str(uuid4()) refresh_token = str(uuid4()) smartthings_mock.apps.return_value = [] smartthings_mock.create...
[ "async", "def", "test_entry_created", "(", "hass", ",", "app", ",", "app_oauth_client", ",", "location", ",", "smartthings_mock", ")", ":", "token", "=", "str", "(", "uuid4", "(", ")", ")", "installed_app_id", "=", "str", "(", "uuid4", "(", ")", ")", "re...
[ 42, 0 ]
[ 108, 5 ]
python
en
['en', 'en', 'en']
True
test_entry_created_from_update_event
( hass, app, app_oauth_client, location, smartthings_mock )
Test local webhook, new app, update event creates entry.
Test local webhook, new app, update event creates entry.
async def test_entry_created_from_update_event( hass, app, app_oauth_client, location, smartthings_mock ): """Test local webhook, new app, update event creates entry.""" token = str(uuid4()) installed_app_id = str(uuid4()) refresh_token = str(uuid4()) smartthings_mock.apps.return_value = [] ...
[ "async", "def", "test_entry_created_from_update_event", "(", "hass", ",", "app", ",", "app_oauth_client", ",", "location", ",", "smartthings_mock", ")", ":", "token", "=", "str", "(", "uuid4", "(", ")", ")", "installed_app_id", "=", "str", "(", "uuid4", "(", ...
[ 111, 0 ]
[ 179, 5 ]
python
en
['es', 'en', 'en']
True