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
MQTTRoomSensor.update
(self)
Update the state for absent devices.
Update the state for absent devices.
def update(self): """Update the state for absent devices.""" if ( self._updated and self._consider_home and dt.utcnow() - self._updated > self._consider_home ): self._state = STATE_NOT_HOME
[ "def", "update", "(", "self", ")", ":", "if", "(", "self", ".", "_updated", "and", "self", ".", "_consider_home", "and", "dt", ".", "utcnow", "(", ")", "-", "self", ".", "_updated", ">", "self", ".", "_consider_home", ")", ":", "self", ".", "_state",...
[ 141, 4 ]
[ 148, 40 ]
python
en
['en', 'en', 'en']
True
setup_platform
(hass, config, add_entities, discovery_info=None)
Set up the Alpha Vantage sensor.
Set up the Alpha Vantage sensor.
def setup_platform(hass, config, add_entities, discovery_info=None): """Set up the Alpha Vantage sensor.""" api_key = config[CONF_API_KEY] symbols = config.get(CONF_SYMBOLS, []) conversions = config.get(CONF_FOREIGN_EXCHANGE, []) if not symbols and not conversions: msg = "No symbols or curr...
[ "def", "setup_platform", "(", "hass", ",", "config", ",", "add_entities", ",", "discovery_info", "=", "None", ")", ":", "api_key", "=", "config", "[", "CONF_API_KEY", "]", "symbols", "=", "config", ".", "get", "(", "CONF_SYMBOLS", ",", "[", "]", ")", "co...
[ 64, 0 ]
[ 104, 36 ]
python
en
['en', 'ca', 'en']
True
AlphaVantageSensor.__init__
(self, timeseries, symbol)
Initialize the sensor.
Initialize the sensor.
def __init__(self, timeseries, symbol): """Initialize the sensor.""" self._symbol = symbol[CONF_SYMBOL] self._name = symbol.get(CONF_NAME, self._symbol) self._timeseries = timeseries self.values = None self._unit_of_measurement = symbol.get(CONF_CURRENCY, self._symbol) ...
[ "def", "__init__", "(", "self", ",", "timeseries", ",", "symbol", ")", ":", "self", ".", "_symbol", "=", "symbol", "[", "CONF_SYMBOL", "]", "self", ".", "_name", "=", "symbol", ".", "get", "(", "CONF_NAME", ",", "self", ".", "_symbol", ")", "self", "...
[ 110, 4 ]
[ 117, 64 ]
python
en
['en', 'en', 'en']
True
AlphaVantageSensor.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" ]
[ 120, 4 ]
[ 122, 25 ]
python
en
['en', 'mi', 'en']
True
AlphaVantageSensor.unit_of_measurement
(self)
Return the unit of measurement of this entity, if any.
Return the unit of measurement of this entity, if any.
def unit_of_measurement(self): """Return the unit of measurement of this entity, if any.""" return self._unit_of_measurement
[ "def", "unit_of_measurement", "(", "self", ")", ":", "return", "self", ".", "_unit_of_measurement" ]
[ 125, 4 ]
[ 127, 40 ]
python
en
['en', 'en', 'en']
True
AlphaVantageSensor.state
(self)
Return the state of the sensor.
Return the state of the sensor.
def state(self): """Return the state of the sensor.""" return self.values["1. open"]
[ "def", "state", "(", "self", ")", ":", "return", "self", ".", "values", "[", "\"1. open\"", "]" ]
[ 130, 4 ]
[ 132, 37 ]
python
en
['en', 'en', 'en']
True
AlphaVantageSensor.device_state_attributes
(self)
Return the state attributes.
Return the state attributes.
def device_state_attributes(self): """Return the state attributes.""" if self.values is not None: return { ATTR_ATTRIBUTION: ATTRIBUTION, ATTR_CLOSE: self.values["4. close"], ATTR_HIGH: self.values["2. high"], ATTR_LOW: self.val...
[ "def", "device_state_attributes", "(", "self", ")", ":", "if", "self", ".", "values", "is", "not", "None", ":", "return", "{", "ATTR_ATTRIBUTION", ":", "ATTRIBUTION", ",", "ATTR_CLOSE", ":", "self", ".", "values", "[", "\"4. close\"", "]", ",", "ATTR_HIGH", ...
[ 135, 4 ]
[ 143, 13 ]
python
en
['en', 'en', 'en']
True
AlphaVantageSensor.icon
(self)
Return the icon to use in the frontend, if any.
Return the icon to use in the frontend, if any.
def icon(self): """Return the icon to use in the frontend, if any.""" return self._icon
[ "def", "icon", "(", "self", ")", ":", "return", "self", ".", "_icon" ]
[ 146, 4 ]
[ 148, 25 ]
python
en
['en', 'en', 'en']
True
AlphaVantageSensor.update
(self)
Get the latest data and updates the states.
Get the latest data and updates the states.
def update(self): """Get the latest data and updates the states.""" _LOGGER.debug("Requesting new data for symbol %s", self._symbol) all_values, _ = self._timeseries.get_intraday(self._symbol) self.values = next(iter(all_values.values())) _LOGGER.debug("Received new values for sy...
[ "def", "update", "(", "self", ")", ":", "_LOGGER", ".", "debug", "(", "\"Requesting new data for symbol %s\"", ",", "self", ".", "_symbol", ")", "all_values", ",", "_", "=", "self", ".", "_timeseries", ".", "get_intraday", "(", "self", ".", "_symbol", ")", ...
[ 150, 4 ]
[ 155, 72 ]
python
en
['en', 'en', 'en']
True
AlphaVantageForeignExchange.__init__
(self, foreign_exchange, config)
Initialize the sensor.
Initialize the sensor.
def __init__(self, foreign_exchange, config): """Initialize the sensor.""" self._foreign_exchange = foreign_exchange self._from_currency = config[CONF_FROM] self._to_currency = config[CONF_TO] if CONF_NAME in config: self._name = config.get(CONF_NAME) else: ...
[ "def", "__init__", "(", "self", ",", "foreign_exchange", ",", "config", ")", ":", "self", ".", "_foreign_exchange", "=", "foreign_exchange", "self", ".", "_from_currency", "=", "config", "[", "CONF_FROM", "]", "self", ".", "_to_currency", "=", "config", "[", ...
[ 161, 4 ]
[ 172, 26 ]
python
en
['en', 'en', 'en']
True
AlphaVantageForeignExchange.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" ]
[ 175, 4 ]
[ 177, 25 ]
python
en
['en', 'mi', 'en']
True
AlphaVantageForeignExchange.unit_of_measurement
(self)
Return the unit of measurement of this entity, if any.
Return the unit of measurement of this entity, if any.
def unit_of_measurement(self): """Return the unit of measurement of this entity, if any.""" return self._unit_of_measurement
[ "def", "unit_of_measurement", "(", "self", ")", ":", "return", "self", ".", "_unit_of_measurement" ]
[ 180, 4 ]
[ 182, 40 ]
python
en
['en', 'en', 'en']
True
AlphaVantageForeignExchange.state
(self)
Return the state of the sensor.
Return the state of the sensor.
def state(self): """Return the state of the sensor.""" return round(float(self.values["5. Exchange Rate"]), 4)
[ "def", "state", "(", "self", ")", ":", "return", "round", "(", "float", "(", "self", ".", "values", "[", "\"5. Exchange Rate\"", "]", ")", ",", "4", ")" ]
[ 185, 4 ]
[ 187, 63 ]
python
en
['en', 'en', 'en']
True
AlphaVantageForeignExchange.icon
(self)
Return the icon to use in the frontend, if any.
Return the icon to use in the frontend, if any.
def icon(self): """Return the icon to use in the frontend, if any.""" return self._icon
[ "def", "icon", "(", "self", ")", ":", "return", "self", ".", "_icon" ]
[ 190, 4 ]
[ 192, 25 ]
python
en
['en', 'en', 'en']
True
AlphaVantageForeignExchange.device_state_attributes
(self)
Return the state attributes.
Return the state attributes.
def device_state_attributes(self): """Return the state attributes.""" if self.values is not None: return { ATTR_ATTRIBUTION: ATTRIBUTION, CONF_FROM: self._from_currency, CONF_TO: self._to_currency, }
[ "def", "device_state_attributes", "(", "self", ")", ":", "if", "self", ".", "values", "is", "not", "None", ":", "return", "{", "ATTR_ATTRIBUTION", ":", "ATTRIBUTION", ",", "CONF_FROM", ":", "self", ".", "_from_currency", ",", "CONF_TO", ":", "self", ".", "...
[ 195, 4 ]
[ 202, 13 ]
python
en
['en', 'en', 'en']
True
AlphaVantageForeignExchange.update
(self)
Get the latest data and updates the states.
Get the latest data and updates the states.
def update(self): """Get the latest data and updates the states.""" _LOGGER.debug( "Requesting new data for forex %s - %s", self._from_currency, self._to_currency, ) self.values, _ = self._foreign_exchange.get_currency_exchange_rate( from_c...
[ "def", "update", "(", "self", ")", ":", "_LOGGER", ".", "debug", "(", "\"Requesting new data for forex %s - %s\"", ",", "self", ".", "_from_currency", ",", "self", ".", "_to_currency", ",", ")", "self", ".", "values", ",", "_", "=", "self", ".", "_foreign_ex...
[ 204, 4 ]
[ 218, 9 ]
python
en
['en', 'en', 'en']
True
create_lat_lons_for_NZTMgrid
(extent_w=1.2e6, extent_e=1.4e6, extent_n=5.13e6, extent_s=4.82e6, resolution=250)
create grids of latitude and longitude corresponding to grid centres of data in nztm grid
create grids of latitude and longitude corresponding to grid centres of data in nztm grid
def create_lat_lons_for_NZTMgrid(extent_w=1.2e6, extent_e=1.4e6, extent_n=5.13e6, extent_s=4.82e6, resolution=250): """create grids of latitude and longitude corresponding to grid centres of data in nztm grid """ # create coordinates x_centres = np.arange(extent_w + resolution / 2, extent_e, resolution)...
[ "def", "create_lat_lons_for_NZTMgrid", "(", "extent_w", "=", "1.2e6", ",", "extent_e", "=", "1.4e6", ",", "extent_n", "=", "5.13e6", ",", "extent_s", "=", "4.82e6", ",", "resolution", "=", "250", ")", ":", "# create coordinates", "x_centres", "=", "np", ".", ...
[ 111, 0 ]
[ 119, 31 ]
python
en
['en', 'en', 'en']
True
write_nztm_grids_to_netcdf
(fname, list_of_data_arrays, var_names, datetime_list, northings, eastings, lat_array, lon_array, elevation, no_time=False)
Write a netCDF file containing fractional snow covered area data :param fname: string, full pathname of file to be created :param list_of_data_arrays: list, list containing data arrays to be saved [[time, northings, eastings],[time, northings, eastings]] :param var_names: list of strings corresponding ...
Write a netCDF file containing fractional snow covered area data :param fname: string, full pathname of file to be created :param list_of_data_arrays: list, list containing data arrays to be saved [[time, northings, eastings],[time, northings, eastings]] :param var_names: list of strings corresponding ...
def write_nztm_grids_to_netcdf(fname, list_of_data_arrays, var_names, datetime_list, northings, eastings, lat_array, lon_array, elevation, no_time=False): """ Write a netCDF file containing fractional snow covered area data :param fname: string, full pathname of file to be cre...
[ "def", "write_nztm_grids_to_netcdf", "(", "fname", ",", "list_of_data_arrays", ",", "var_names", ",", "datetime_list", ",", "northings", ",", "eastings", ",", "lat_array", ",", "lon_array", ",", "elevation", ",", "no_time", "=", "False", ")", ":", "ds", "=", "...
[ 122, 0 ]
[ 219, 14 ]
python
en
['en', 'error', 'th']
False
setup_nztm_grid_netcdf
(fname, list_of_data_arrays, var_names, datetime_list, northings, eastings, lat_array, lon_array, elevation, no_time=False)
Write a netCDF file containing fractional snow covered area data :param fname: string, full pathname of file to be created :param list_of_data_arrays: list, list containing data arrays to be saved [[time, northings, eastings],[time, northings, eastings]] :param var_names: list of strings corresponding ...
Write a netCDF file containing fractional snow covered area data :param fname: string, full pathname of file to be created :param list_of_data_arrays: list, list containing data arrays to be saved [[time, northings, eastings],[time, northings, eastings]] :param var_names: list of strings corresponding ...
def setup_nztm_grid_netcdf(fname, list_of_data_arrays, var_names, datetime_list, northings, eastings, lat_array, lon_array, elevation, no_time=False): """ Write a netCDF file containing fractional snow covered area data :param fname: string, full pathname of file to be created...
[ "def", "setup_nztm_grid_netcdf", "(", "fname", ",", "list_of_data_arrays", ",", "var_names", ",", "datetime_list", ",", "northings", ",", "eastings", ",", "lat_array", ",", "lon_array", ",", "elevation", ",", "no_time", "=", "False", ")", ":", "ds", "=", "nc",...
[ 222, 0 ]
[ 320, 13 ]
python
en
['en', 'error', 'th']
False
setup_platform
(hass, config, add_entities, discovery_info=None)
Set up the Blinkt Light platform.
Set up the Blinkt Light platform.
def setup_platform(hass, config, add_entities, discovery_info=None): """Set up the Blinkt Light platform.""" # pylint: disable=no-member blinkt = importlib.import_module("blinkt") # ensure that the lights are off when exiting blinkt.set_clear_on_exit() name = config[CONF_NAME] add_entitie...
[ "def", "setup_platform", "(", "hass", ",", "config", ",", "add_entities", ",", "discovery_info", "=", "None", ")", ":", "# pylint: disable=no-member", "blinkt", "=", "importlib", ".", "import_module", "(", "\"blinkt\"", ")", "# ensure that the lights are off when exitin...
[ 26, 0 ]
[ 38, 5 ]
python
en
['en', 'da', 'en']
True
BlinktLight.__init__
(self, blinkt, name, index)
Initialize a Blinkt Light. Default brightness and white color.
Initialize a Blinkt Light.
def __init__(self, blinkt, name, index): """Initialize a Blinkt Light. Default brightness and white color. """ self._blinkt = blinkt self._name = f"{name}_{index}" self._index = index self._is_on = False self._brightness = 255 self._hs_color = [0,...
[ "def", "__init__", "(", "self", ",", "blinkt", ",", "name", ",", "index", ")", ":", "self", ".", "_blinkt", "=", "blinkt", "self", ".", "_name", "=", "f\"{name}_{index}\"", "self", ".", "_index", "=", "index", "self", ".", "_is_on", "=", "False", "self...
[ 44, 4 ]
[ 54, 31 ]
python
en
['en', 'lb', 'it']
False
BlinktLight.name
(self)
Return the display name of this light.
Return the display name of this light.
def name(self): """Return the display name of this light.""" return self._name
[ "def", "name", "(", "self", ")", ":", "return", "self", ".", "_name" ]
[ 57, 4 ]
[ 59, 25 ]
python
en
['en', 'en', 'en']
True
BlinktLight.brightness
(self)
Read back the brightness of the light. Returns integer in the range of 1-255.
Read back the brightness of the light.
def brightness(self): """Read back the brightness of the light. Returns integer in the range of 1-255. """ return self._brightness
[ "def", "brightness", "(", "self", ")", ":", "return", "self", ".", "_brightness" ]
[ 62, 4 ]
[ 67, 31 ]
python
en
['en', 'en', 'en']
True
BlinktLight.hs_color
(self)
Read back the color of the light.
Read back the color of the light.
def hs_color(self): """Read back the color of the light.""" return self._hs_color
[ "def", "hs_color", "(", "self", ")", ":", "return", "self", ".", "_hs_color" ]
[ 70, 4 ]
[ 72, 29 ]
python
en
['en', 'en', 'en']
True
BlinktLight.supported_features
(self)
Flag supported features.
Flag supported features.
def supported_features(self): """Flag supported features.""" return SUPPORT_BLINKT
[ "def", "supported_features", "(", "self", ")", ":", "return", "SUPPORT_BLINKT" ]
[ 75, 4 ]
[ 77, 29 ]
python
en
['da', 'en', 'en']
True
BlinktLight.is_on
(self)
Return true if light is on.
Return true if light is on.
def is_on(self): """Return true if light is on.""" return self._is_on
[ "def", "is_on", "(", "self", ")", ":", "return", "self", ".", "_is_on" ]
[ 80, 4 ]
[ 82, 26 ]
python
en
['en', 'et', 'en']
True
BlinktLight.should_poll
(self)
Return if we should poll this device.
Return if we should poll this device.
def should_poll(self): """Return if we should poll this device.""" return False
[ "def", "should_poll", "(", "self", ")", ":", "return", "False" ]
[ 85, 4 ]
[ 87, 20 ]
python
en
['en', 'en', 'en']
True
BlinktLight.assumed_state
(self)
Return True if unable to access real state of the entity.
Return True if unable to access real state of the entity.
def assumed_state(self) -> bool: """Return True if unable to access real state of the entity.""" return True
[ "def", "assumed_state", "(", "self", ")", "->", "bool", ":", "return", "True" ]
[ 90, 4 ]
[ 92, 19 ]
python
en
['en', 'en', 'en']
True
BlinktLight.turn_on
(self, **kwargs)
Instruct the light to turn on and set correct brightness & color.
Instruct the light to turn on and set correct brightness & color.
def turn_on(self, **kwargs): """Instruct the light to turn on and set correct brightness & color.""" if ATTR_HS_COLOR in kwargs: self._hs_color = kwargs[ATTR_HS_COLOR] if ATTR_BRIGHTNESS in kwargs: self._brightness = kwargs[ATTR_BRIGHTNESS] percent_bright = self....
[ "def", "turn_on", "(", "self", ",", "*", "*", "kwargs", ")", ":", "if", "ATTR_HS_COLOR", "in", "kwargs", ":", "self", ".", "_hs_color", "=", "kwargs", "[", "ATTR_HS_COLOR", "]", "if", "ATTR_BRIGHTNESS", "in", "kwargs", ":", "self", ".", "_brightness", "=...
[ 94, 4 ]
[ 110, 39 ]
python
en
['en', 'en', 'en']
True
BlinktLight.turn_off
(self, **kwargs)
Instruct the light to turn off.
Instruct the light to turn off.
def turn_off(self, **kwargs): """Instruct the light to turn off.""" self._blinkt.set_pixel(self._index, 0, 0, 0, 0) self._blinkt.show() self._is_on = False self.schedule_update_ha_state()
[ "def", "turn_off", "(", "self", ",", "*", "*", "kwargs", ")", ":", "self", ".", "_blinkt", ".", "set_pixel", "(", "self", ".", "_index", ",", "0", ",", "0", ",", "0", ",", "0", ")", "self", ".", "_blinkt", ".", "show", "(", ")", "self", ".", ...
[ 112, 4 ]
[ 117, 39 ]
python
en
['en', 'en', 'en']
True
test_min_sensor
(hass)
Test the min sensor.
Test the min sensor.
async def test_min_sensor(hass): """Test the min sensor.""" config = { "sensor": { "platform": "min_max", "name": "test_min", "type": "min", "entity_ids": ["sensor.test_1", "sensor.test_2", "sensor.test_3"], } } assert await async_setup_co...
[ "async", "def", "test_min_sensor", "(", "hass", ")", ":", "config", "=", "{", "\"sensor\"", ":", "{", "\"platform\"", ":", "\"min_max\"", ",", "\"name\"", ":", "\"test_min\"", ",", "\"type\"", ":", "\"min\"", ",", "\"entity_ids\"", ":", "[", "\"sensor.test_1\"...
[ 29, 0 ]
[ 56, 51 ]
python
en
['en', 'sq', 'en']
True
test_max_sensor
(hass)
Test the max sensor.
Test the max sensor.
async def test_max_sensor(hass): """Test the max sensor.""" config = { "sensor": { "platform": "min_max", "name": "test_max", "type": "max", "entity_ids": ["sensor.test_1", "sensor.test_2", "sensor.test_3"], } } assert await async_setup_co...
[ "async", "def", "test_max_sensor", "(", "hass", ")", ":", "config", "=", "{", "\"sensor\"", ":", "{", "\"platform\"", ":", "\"min_max\"", ",", "\"name\"", ":", "\"test_max\"", ",", "\"type\"", ":", "\"max\"", ",", "\"entity_ids\"", ":", "[", "\"sensor.test_1\"...
[ 59, 0 ]
[ 86, 51 ]
python
en
['en', 'ca', 'en']
True
test_mean_sensor
(hass)
Test the mean sensor.
Test the mean sensor.
async def test_mean_sensor(hass): """Test the mean sensor.""" config = { "sensor": { "platform": "min_max", "name": "test_mean", "type": "mean", "entity_ids": ["sensor.test_1", "sensor.test_2", "sensor.test_3"], } } assert await async_setu...
[ "async", "def", "test_mean_sensor", "(", "hass", ")", ":", "config", "=", "{", "\"sensor\"", ":", "{", "\"platform\"", ":", "\"min_max\"", ",", "\"name\"", ":", "\"test_mean\"", ",", "\"type\"", ":", "\"mean\"", ",", "\"entity_ids\"", ":", "[", "\"sensor.test_...
[ 89, 0 ]
[ 116, 51 ]
python
en
['en', 'da', 'en']
True
test_mean_1_digit_sensor
(hass)
Test the mean with 1-digit precision sensor.
Test the mean with 1-digit precision sensor.
async def test_mean_1_digit_sensor(hass): """Test the mean with 1-digit precision sensor.""" config = { "sensor": { "platform": "min_max", "name": "test_mean", "type": "mean", "round_digits": 1, "entity_ids": ["sensor.test_1", "sensor.test_2", ...
[ "async", "def", "test_mean_1_digit_sensor", "(", "hass", ")", ":", "config", "=", "{", "\"sensor\"", ":", "{", "\"platform\"", ":", "\"min_max\"", ",", "\"name\"", ":", "\"test_mean\"", ",", "\"type\"", ":", "\"mean\"", ",", "\"round_digits\"", ":", "1", ",", ...
[ 119, 0 ]
[ 147, 51 ]
python
en
['en', 'en', 'en']
True
test_mean_4_digit_sensor
(hass)
Test the mean with 1-digit precision sensor.
Test the mean with 1-digit precision sensor.
async def test_mean_4_digit_sensor(hass): """Test the mean with 1-digit precision sensor.""" config = { "sensor": { "platform": "min_max", "name": "test_mean", "type": "mean", "round_digits": 4, "entity_ids": ["sensor.test_1", "sensor.test_2", ...
[ "async", "def", "test_mean_4_digit_sensor", "(", "hass", ")", ":", "config", "=", "{", "\"sensor\"", ":", "{", "\"platform\"", ":", "\"min_max\"", ",", "\"name\"", ":", "\"test_mean\"", ",", "\"type\"", ":", "\"mean\"", ",", "\"round_digits\"", ":", "4", ",", ...
[ 150, 0 ]
[ 178, 51 ]
python
en
['en', 'en', 'en']
True
test_median_sensor
(hass)
Test the median sensor.
Test the median sensor.
async def test_median_sensor(hass): """Test the median sensor.""" config = { "sensor": { "platform": "min_max", "name": "test_median", "type": "median", "entity_ids": ["sensor.test_1", "sensor.test_2", "sensor.test_3"], } } assert await as...
[ "async", "def", "test_median_sensor", "(", "hass", ")", ":", "config", "=", "{", "\"sensor\"", ":", "{", "\"platform\"", ":", "\"min_max\"", ",", "\"name\"", ":", "\"test_median\"", ",", "\"type\"", ":", "\"median\"", ",", "\"entity_ids\"", ":", "[", "\"sensor...
[ 181, 0 ]
[ 208, 47 ]
python
en
['en', 'da', 'en']
True
test_not_enough_sensor_value
(hass)
Test that there is nothing done if not enough values available.
Test that there is nothing done if not enough values available.
async def test_not_enough_sensor_value(hass): """Test that there is nothing done if not enough values available.""" config = { "sensor": { "platform": "min_max", "name": "test_max", "type": "max", "entity_ids": ["sensor.test_1", "sensor.test_2", "sensor.te...
[ "async", "def", "test_not_enough_sensor_value", "(", "hass", ")", ":", "config", "=", "{", "\"sensor\"", ":", "{", "\"platform\"", ":", "\"min_max\"", ",", "\"name\"", ":", "\"test_max\"", ",", "\"type\"", ":", "\"max\"", ",", "\"entity_ids\"", ":", "[", "\"se...
[ 211, 0 ]
[ 266, 52 ]
python
en
['en', 'en', 'en']
True
test_different_unit_of_measurement
(hass)
Test for different unit of measurement.
Test for different unit of measurement.
async def test_different_unit_of_measurement(hass): """Test for different unit of measurement.""" config = { "sensor": { "platform": "min_max", "name": "test", "type": "mean", "entity_ids": ["sensor.test_1", "sensor.test_2", "sensor.test_3"], } ...
[ "async", "def", "test_different_unit_of_measurement", "(", "hass", ")", ":", "config", "=", "{", "\"sensor\"", ":", "{", "\"platform\"", ":", "\"min_max\"", ",", "\"name\"", ":", "\"test\"", ",", "\"type\"", ":", "\"mean\"", ",", "\"entity_ids\"", ":", "[", "\...
[ 269, 0 ]
[ 313, 63 ]
python
en
['en', 'en', 'en']
True
test_last_sensor
(hass)
Test the last sensor.
Test the last sensor.
async def test_last_sensor(hass): """Test the last sensor.""" config = { "sensor": { "platform": "min_max", "name": "test_last", "type": "last", "entity_ids": ["sensor.test_1", "sensor.test_2", "sensor.test_3"], } } assert await async_setu...
[ "async", "def", "test_last_sensor", "(", "hass", ")", ":", "config", "=", "{", "\"sensor\"", ":", "{", "\"platform\"", ":", "\"min_max\"", ",", "\"name\"", ":", "\"test_last\"", ",", "\"type\"", ":", "\"last\"", ",", "\"entity_ids\"", ":", "[", "\"sensor.test_...
[ 316, 0 ]
[ 342, 51 ]
python
en
['en', 'et', 'en']
True
test_reload
(hass)
Verify we can reload filter sensors.
Verify we can reload filter sensors.
async def test_reload(hass): """Verify we can reload filter sensors.""" hass.states.async_set("sensor.test_1", 12345) hass.states.async_set("sensor.test_2", 45678) await async_setup_component( hass, "sensor", { "sensor": { "platform": "min_max", ...
[ "async", "def", "test_reload", "(", "hass", ")", ":", "hass", ".", "states", ".", "async_set", "(", "\"sensor.test_1\"", ",", "12345", ")", "hass", ".", "states", ".", "async_set", "(", "\"sensor.test_2\"", ",", "45678", ")", "await", "async_setup_component", ...
[ 345, 0 ]
[ 385, 48 ]
python
en
['en', 'da', 'en']
True
test_water_heater
( hass: HomeAssistant, aioclient_mock: AiohttpClientMocker )
Test the creation of Atag water heater.
Test the creation of Atag water heater.
async def test_water_heater( hass: HomeAssistant, aioclient_mock: AiohttpClientMocker ) -> None: """Test the creation of Atag water heater.""" with patch("pyatag.entities.DHW.status"): entry = await init_integration(hass, aioclient_mock) registry = await hass.helpers.entity_registry.async_ge...
[ "async", "def", "test_water_heater", "(", "hass", ":", "HomeAssistant", ",", "aioclient_mock", ":", "AiohttpClientMocker", ")", "->", "None", ":", "with", "patch", "(", "\"pyatag.entities.DHW.status\"", ")", ":", "entry", "=", "await", "init_integration", "(", "ha...
[ 14, 0 ]
[ 24, 57 ]
python
en
['en', 'en', 'en']
True
test_setting_target_temperature
( hass: HomeAssistant, aioclient_mock: AiohttpClientMocker )
Test setting the water heater device.
Test setting the water heater device.
async def test_setting_target_temperature( hass: HomeAssistant, aioclient_mock: AiohttpClientMocker ) -> None: """Test setting the water heater device.""" await init_integration(hass, aioclient_mock) with patch("pyatag.entities.DHW.set_temp") as mock_set_temp: await hass.services.async_call( ...
[ "async", "def", "test_setting_target_temperature", "(", "hass", ":", "HomeAssistant", ",", "aioclient_mock", ":", "AiohttpClientMocker", ")", "->", "None", ":", "await", "init_integration", "(", "hass", ",", "aioclient_mock", ")", "with", "patch", "(", "\"pyatag.ent...
[ 27, 0 ]
[ 40, 49 ]
python
en
['en', 'en', 'en']
True
browse_media
(zone_id, roon_server, media_content_type=None, media_content_id=None)
Implement the websocket media browsing helper.
Implement the websocket media browsing helper.
def browse_media(zone_id, roon_server, media_content_type=None, media_content_id=None): """Implement the websocket media browsing helper.""" try: _LOGGER.debug("browse_media: %s: %s", media_content_type, media_content_id) if media_content_type in [None, "library"]: return library_pay...
[ "def", "browse_media", "(", "zone_id", ",", "roon_server", ",", "media_content_type", "=", "None", ",", "media_content_id", "=", "None", ")", ":", "try", ":", "_LOGGER", ".", "debug", "(", "\"browse_media: %s: %s\"", ",", "media_content_type", ",", "media_content_...
[ 40, 0 ]
[ 50, 18 ]
python
en
['en', 'af', 'en']
True
item_payload
(roon_server, item, list_image_id)
Create response payload for a single media item.
Create response payload for a single media item.
def item_payload(roon_server, item, list_image_id): """Create response payload for a single media item.""" title = item["title"] subtitle = item.get("subtitle") if subtitle is None: display_title = title else: display_title = f"{title} ({subtitle})" image_id = item.get("image_k...
[ "def", "item_payload", "(", "roon_server", ",", "item", ",", "list_image_id", ")", ":", "title", "=", "item", "[", "\"title\"", "]", "subtitle", "=", "item", ".", "get", "(", "\"subtitle\"", ")", "if", "subtitle", "is", "None", ":", "display_title", "=", ...
[ 53, 0 ]
[ 99, 33 ]
python
en
['en', 'en', 'en']
True
library_payload
(roon_server, zone_id, media_content_id)
Create response payload for the library.
Create response payload for the library.
def library_payload(roon_server, zone_id, media_content_id): """Create response payload for the library.""" opts = { "hierarchy": "browse", "zone_or_output_id": zone_id, "count": ITEM_LIMIT, } # Roon starts browsing for a zone where it left off - so start from the top unless ot...
[ "def", "library_payload", "(", "roon_server", ",", "zone_id", ",", "media_content_id", ")", ":", "opts", "=", "{", "\"hierarchy\"", ":", "\"browse\"", ",", "\"zone_or_output_id\"", ":", "zone_id", ",", "\"count\"", ":", "ITEM_LIMIT", ",", "}", "# Roon starts brows...
[ 102, 0 ]
[ 162, 23 ]
python
en
['en', 'en', 'en']
True
BaseModel.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...
[ 13, 4 ]
[ 24, 36 ]
python
en
['en', 'en', 'en']
True
async_setup_platform
(hass, config, async_add_entities, discovery_info=None)
Set up the mysensors platform for switches.
Set up the mysensors platform for switches.
async def async_setup_platform(hass, config, async_add_entities, discovery_info=None): """Set up the mysensors platform for switches.""" device_class_map = { "S_DOOR": MySensorsSwitch, "S_MOTION": MySensorsSwitch, "S_SMOKE": MySensorsSwitch, "S_LIGHT": MySensorsSwitch, "S...
[ "async", "def", "async_setup_platform", "(", "hass", ",", "config", ",", "async_add_entities", ",", "discovery_info", "=", "None", ")", ":", "device_class_map", "=", "{", "\"S_DOOR\"", ":", "MySensorsSwitch", ",", "\"S_MOTION\"", ":", "MySensorsSwitch", ",", "\"S_...
[ 17, 0 ]
[ 71, 5 ]
python
en
['en', 'en', 'en']
True
MySensorsSwitch.assumed_state
(self)
Return True if unable to access real state of entity.
Return True if unable to access real state of entity.
def assumed_state(self): """Return True if unable to access real state of entity.""" return self.gateway.optimistic
[ "def", "assumed_state", "(", "self", ")", ":", "return", "self", ".", "gateway", ".", "optimistic" ]
[ 78, 4 ]
[ 80, 38 ]
python
en
['en', 'en', 'en']
True
MySensorsSwitch.current_power_w
(self)
Return the current power usage in W.
Return the current power usage in W.
def current_power_w(self): """Return the current power usage in W.""" set_req = self.gateway.const.SetReq return self._values.get(set_req.V_WATT)
[ "def", "current_power_w", "(", "self", ")", ":", "set_req", "=", "self", ".", "gateway", ".", "const", ".", "SetReq", "return", "self", ".", "_values", ".", "get", "(", "set_req", ".", "V_WATT", ")" ]
[ 83, 4 ]
[ 86, 47 ]
python
en
['en', 'en', 'en']
True
MySensorsSwitch.is_on
(self)
Return True if switch is on.
Return True if switch is on.
def is_on(self): """Return True if switch is on.""" return self._values.get(self.value_type) == STATE_ON
[ "def", "is_on", "(", "self", ")", ":", "return", "self", ".", "_values", ".", "get", "(", "self", ".", "value_type", ")", "==", "STATE_ON" ]
[ 89, 4 ]
[ 91, 60 ]
python
en
['en', 'fy', 'en']
True
MySensorsSwitch.async_turn_on
(self, **kwargs)
Turn the switch on.
Turn the switch on.
async def async_turn_on(self, **kwargs): """Turn the switch on.""" self.gateway.set_child_value( self.node_id, self.child_id, self.value_type, 1, ack=1 ) if self.gateway.optimistic: # Optimistically assume that switch has changed state self._values[sel...
[ "async", "def", "async_turn_on", "(", "self", ",", "*", "*", "kwargs", ")", ":", "self", ".", "gateway", ".", "set_child_value", "(", "self", ".", "node_id", ",", "self", ".", "child_id", ",", "self", ".", "value_type", ",", "1", ",", "ack", "=", "1"...
[ 93, 4 ]
[ 101, 39 ]
python
en
['en', 'en', 'en']
True
MySensorsSwitch.async_turn_off
(self, **kwargs)
Turn the switch off.
Turn the switch off.
async def async_turn_off(self, **kwargs): """Turn the switch off.""" self.gateway.set_child_value( self.node_id, self.child_id, self.value_type, 0, ack=1 ) if self.gateway.optimistic: # Optimistically assume that switch has changed state self._values[s...
[ "async", "def", "async_turn_off", "(", "self", ",", "*", "*", "kwargs", ")", ":", "self", ".", "gateway", ".", "set_child_value", "(", "self", ".", "node_id", ",", "self", ".", "child_id", ",", "self", ".", "value_type", ",", "0", ",", "ack", "=", "1...
[ 103, 4 ]
[ 111, 39 ]
python
en
['en', 'en', 'en']
True
MySensorsIRSwitch.__init__
(self, *args)
Set up instance attributes.
Set up instance attributes.
def __init__(self, *args): """Set up instance attributes.""" super().__init__(*args) self._ir_code = None
[ "def", "__init__", "(", "self", ",", "*", "args", ")", ":", "super", "(", ")", ".", "__init__", "(", "*", "args", ")", "self", ".", "_ir_code", "=", "None" ]
[ 117, 4 ]
[ 120, 28 ]
python
en
['en', 'en', 'en']
True
MySensorsIRSwitch.is_on
(self)
Return True if switch is on.
Return True if switch is on.
def is_on(self): """Return True if switch is on.""" set_req = self.gateway.const.SetReq return self._values.get(set_req.V_LIGHT) == STATE_ON
[ "def", "is_on", "(", "self", ")", ":", "set_req", "=", "self", ".", "gateway", ".", "const", ".", "SetReq", "return", "self", ".", "_values", ".", "get", "(", "set_req", ".", "V_LIGHT", ")", "==", "STATE_ON" ]
[ 123, 4 ]
[ 126, 60 ]
python
en
['en', 'fy', 'en']
True
MySensorsIRSwitch.async_turn_on
(self, **kwargs)
Turn the IR switch on.
Turn the IR switch on.
async def async_turn_on(self, **kwargs): """Turn the IR switch on.""" set_req = self.gateway.const.SetReq if ATTR_IR_CODE in kwargs: self._ir_code = kwargs[ATTR_IR_CODE] self.gateway.set_child_value( self.node_id, self.child_id, self.value_type, self._ir_code ...
[ "async", "def", "async_turn_on", "(", "self", ",", "*", "*", "kwargs", ")", ":", "set_req", "=", "self", ".", "gateway", ".", "const", ".", "SetReq", "if", "ATTR_IR_CODE", "in", "kwargs", ":", "self", ".", "_ir_code", "=", "kwargs", "[", "ATTR_IR_CODE", ...
[ 128, 4 ]
[ 145, 39 ]
python
en
['en', 'zh', 'en']
True
MySensorsIRSwitch.async_turn_off
(self, **kwargs)
Turn the IR switch off.
Turn the IR switch off.
async def async_turn_off(self, **kwargs): """Turn the IR switch off.""" set_req = self.gateway.const.SetReq self.gateway.set_child_value( self.node_id, self.child_id, set_req.V_LIGHT, 0, ack=1 ) if self.gateway.optimistic: # Optimistically assume that swit...
[ "async", "def", "async_turn_off", "(", "self", ",", "*", "*", "kwargs", ")", ":", "set_req", "=", "self", ".", "gateway", ".", "const", ".", "SetReq", "self", ".", "gateway", ".", "set_child_value", "(", "self", ".", "node_id", ",", "self", ".", "child...
[ 147, 4 ]
[ 156, 39 ]
python
en
['en', 'zh', 'en']
True
MySensorsIRSwitch.async_update
(self)
Update the controller with the latest value from a sensor.
Update the controller with the latest value from a sensor.
async def async_update(self): """Update the controller with the latest value from a sensor.""" await super().async_update() self._ir_code = self._values.get(self.value_type)
[ "async", "def", "async_update", "(", "self", ")", ":", "await", "super", "(", ")", ".", "async_update", "(", ")", "self", ".", "_ir_code", "=", "self", ".", "_values", ".", "get", "(", "self", ".", "value_type", ")" ]
[ 158, 4 ]
[ 161, 57 ]
python
en
['en', 'en', 'en']
True
async_get_actions
(hass: HomeAssistant, device_id: str)
List device actions for Alarm control panel devices.
List device actions for Alarm control panel devices.
async def async_get_actions(hass: HomeAssistant, device_id: str) -> List[dict]: """List device actions for Alarm control panel devices.""" registry = await entity_registry.async_get_registry(hass) actions = [] # Get all the integrations entities for this device for entry in entity_registry.async_en...
[ "async", "def", "async_get_actions", "(", "hass", ":", "HomeAssistant", ",", "device_id", ":", "str", ")", "->", "List", "[", "dict", "]", ":", "registry", "=", "await", "entity_registry", ".", "async_get_registry", "(", "hass", ")", "actions", "=", "[", "...
[ 43, 0 ]
[ 107, 18 ]
python
en
['fr', 'en', 'en']
True
async_call_action_from_config
( hass: HomeAssistant, config: dict, variables: dict, context: Optional[Context] )
Execute a device action.
Execute a device action.
async def async_call_action_from_config( hass: HomeAssistant, config: dict, variables: dict, context: Optional[Context] ) -> None: """Execute a device action.""" config = ACTION_SCHEMA(config) service_data = {ATTR_ENTITY_ID: config[CONF_ENTITY_ID]} if CONF_CODE in config: service_data[ATTR_...
[ "async", "def", "async_call_action_from_config", "(", "hass", ":", "HomeAssistant", ",", "config", ":", "dict", ",", "variables", ":", "dict", ",", "context", ":", "Optional", "[", "Context", "]", ")", "->", "None", ":", "config", "=", "ACTION_SCHEMA", "(", ...
[ 110, 0 ]
[ 133, 5 ]
python
en
['ro', 'en', 'en']
True
async_get_action_capabilities
(hass, config)
List action capabilities.
List action capabilities.
async def async_get_action_capabilities(hass, config): """List action capabilities.""" state = hass.states.get(config[CONF_ENTITY_ID]) code_required = state.attributes.get(ATTR_CODE_ARM_REQUIRED) if state else False if config[CONF_TYPE] == "trigger" or ( config[CONF_TYPE] != "disarm" and not co...
[ "async", "def", "async_get_action_capabilities", "(", "hass", ",", "config", ")", ":", "state", "=", "hass", ".", "states", ".", "get", "(", "config", "[", "CONF_ENTITY_ID", "]", ")", "code_required", "=", "state", ".", "attributes", ".", "get", "(", "ATTR...
[ 136, 0 ]
[ 146, 71 ]
python
en
['ro', 'ga', 'en']
False
convert
(value: float, unit_1: str, unit_2: str)
Convert one unit of measurement to another.
Convert one unit of measurement to another.
def convert(value: float, unit_1: str, unit_2: str) -> float: """Convert one unit of measurement to another.""" if unit_1 not in VALID_UNITS: raise ValueError(UNIT_NOT_RECOGNIZED_TEMPLATE.format(unit_1, LENGTH)) if unit_2 not in VALID_UNITS: raise ValueError(UNIT_NOT_RECOGNIZED_TEMPLATE.form...
[ "def", "convert", "(", "value", ":", "float", ",", "unit_1", ":", "str", ",", "unit_2", ":", "str", ")", "->", "float", ":", "if", "unit_1", "not", "in", "VALID_UNITS", ":", "raise", "ValueError", "(", "UNIT_NOT_RECOGNIZED_TEMPLATE", ".", "format", "(", ...
[ 51, 0 ]
[ 66, 36 ]
python
en
['en', 'en', 'en']
True
glue_convert_examples_to_features
( examples: Union[List[InputExample], "tf.data.Dataset"], tokenizer: PreTrainedTokenizer, max_length: Optional[int] = None, task=None, label_list=None, output_mode=None, )
Loads a data file into a list of ``InputFeatures`` Args: examples: List of ``InputExamples`` or ``tf.data.Dataset`` containing the examples. tokenizer: Instance of a tokenizer that will tokenize the examples max_length: Maximum example length. Defaults to the tokenizer's max_len ...
Loads a data file into a list of ``InputFeatures``
def glue_convert_examples_to_features( examples: Union[List[InputExample], "tf.data.Dataset"], tokenizer: PreTrainedTokenizer, max_length: Optional[int] = None, task=None, label_list=None, output_mode=None, ): """ Loads a data file into a list of ``InputFeatures`` Args: exam...
[ "def", "glue_convert_examples_to_features", "(", "examples", ":", "Union", "[", "List", "[", "InputExample", "]", ",", "\"tf.data.Dataset\"", "]", ",", "tokenizer", ":", "PreTrainedTokenizer", ",", "max_length", ":", "Optional", "[", "int", "]", "=", "None", ","...
[ 41, 0 ]
[ 73, 5 ]
python
en
['en', 'error', 'th']
False
MrpcProcessor.get_example_from_tensor_dict
(self, tensor_dict)
See base class.
See base class.
def get_example_from_tensor_dict(self, tensor_dict): """See base class.""" return InputExample( tensor_dict["idx"].numpy(), tensor_dict["sentence1"].numpy().decode("utf-8"), tensor_dict["sentence2"].numpy().decode("utf-8"), str(tensor_dict["label"].numpy()...
[ "def", "get_example_from_tensor_dict", "(", "self", ",", "tensor_dict", ")", ":", "return", "InputExample", "(", "tensor_dict", "[", "\"idx\"", "]", ".", "numpy", "(", ")", ",", "tensor_dict", "[", "\"sentence1\"", "]", ".", "numpy", "(", ")", ".", "decode",...
[ 176, 4 ]
[ 183, 9 ]
python
en
['en', 'en', 'en']
True
MrpcProcessor.get_train_examples
(self, data_dir)
See base class.
See base class.
def get_train_examples(self, data_dir): """See base class.""" logger.info("LOOKING AT {}".format(os.path.join(data_dir, "train.tsv"))) return self._create_examples(self._read_tsv(os.path.join(data_dir, "train.tsv")), "train")
[ "def", "get_train_examples", "(", "self", ",", "data_dir", ")", ":", "logger", ".", "info", "(", "\"LOOKING AT {}\"", ".", "format", "(", "os", ".", "path", ".", "join", "(", "data_dir", ",", "\"train.tsv\"", ")", ")", ")", "return", "self", ".", "_creat...
[ 185, 4 ]
[ 188, 98 ]
python
en
['en', 'en', 'en']
True
MrpcProcessor.get_dev_examples
(self, data_dir)
See base class.
See base class.
def get_dev_examples(self, data_dir): """See base class.""" return self._create_examples(self._read_tsv(os.path.join(data_dir, "dev.tsv")), "dev")
[ "def", "get_dev_examples", "(", "self", ",", "data_dir", ")", ":", "return", "self", ".", "_create_examples", "(", "self", ".", "_read_tsv", "(", "os", ".", "path", ".", "join", "(", "data_dir", ",", "\"dev.tsv\"", ")", ")", ",", "\"dev\"", ")" ]
[ 190, 4 ]
[ 192, 94 ]
python
en
['en', 'en', 'en']
True
MrpcProcessor.get_test_examples
(self, data_dir)
See base class.
See base class.
def get_test_examples(self, data_dir): """See base class.""" return self._create_examples(self._read_tsv(os.path.join(data_dir, "test.tsv")), "test")
[ "def", "get_test_examples", "(", "self", ",", "data_dir", ")", ":", "return", "self", ".", "_create_examples", "(", "self", ".", "_read_tsv", "(", "os", ".", "path", ".", "join", "(", "data_dir", ",", "\"test.tsv\"", ")", ")", ",", "\"test\"", ")" ]
[ 194, 4 ]
[ 196, 96 ]
python
en
['en', 'en', 'en']
True
MrpcProcessor.get_labels
(self)
See base class.
See base class.
def get_labels(self): """See base class.""" return ["0", "1"]
[ "def", "get_labels", "(", "self", ")", ":", "return", "[", "\"0\"", ",", "\"1\"", "]" ]
[ 198, 4 ]
[ 200, 25 ]
python
en
['en', 'en', 'en']
True
MrpcProcessor._create_examples
(self, lines, set_type)
Creates examples for the training, dev and test sets.
Creates examples for the training, dev and test sets.
def _create_examples(self, lines, set_type): """Creates examples for the training, dev and test sets.""" examples = [] for (i, line) in enumerate(lines): if i == 0: continue guid = "%s-%s" % (set_type, i) text_a = line[3] text_b = l...
[ "def", "_create_examples", "(", "self", ",", "lines", ",", "set_type", ")", ":", "examples", "=", "[", "]", "for", "(", "i", ",", "line", ")", "in", "enumerate", "(", "lines", ")", ":", "if", "i", "==", "0", ":", "continue", "guid", "=", "\"%s-%s\"...
[ 202, 4 ]
[ 213, 23 ]
python
en
['en', 'en', 'en']
True
MnliProcessor.get_example_from_tensor_dict
(self, tensor_dict)
See base class.
See base class.
def get_example_from_tensor_dict(self, tensor_dict): """See base class.""" return InputExample( tensor_dict["idx"].numpy(), tensor_dict["premise"].numpy().decode("utf-8"), tensor_dict["hypothesis"].numpy().decode("utf-8"), str(tensor_dict["label"].numpy())...
[ "def", "get_example_from_tensor_dict", "(", "self", ",", "tensor_dict", ")", ":", "return", "InputExample", "(", "tensor_dict", "[", "\"idx\"", "]", ".", "numpy", "(", ")", ",", "tensor_dict", "[", "\"premise\"", "]", ".", "numpy", "(", ")", ".", "decode", ...
[ 223, 4 ]
[ 230, 9 ]
python
en
['en', 'en', 'en']
True
MnliProcessor.get_train_examples
(self, data_dir)
See base class.
See base class.
def get_train_examples(self, data_dir): """See base class.""" return self._create_examples(self._read_tsv(os.path.join(data_dir, "train.tsv")), "train")
[ "def", "get_train_examples", "(", "self", ",", "data_dir", ")", ":", "return", "self", ".", "_create_examples", "(", "self", ".", "_read_tsv", "(", "os", ".", "path", ".", "join", "(", "data_dir", ",", "\"train.tsv\"", ")", ")", ",", "\"train\"", ")" ]
[ 232, 4 ]
[ 234, 98 ]
python
en
['en', 'en', 'en']
True
MnliProcessor.get_dev_examples
(self, data_dir)
See base class.
See base class.
def get_dev_examples(self, data_dir): """See base class.""" return self._create_examples(self._read_tsv(os.path.join(data_dir, "dev_matched.tsv")), "dev_matched")
[ "def", "get_dev_examples", "(", "self", ",", "data_dir", ")", ":", "return", "self", ".", "_create_examples", "(", "self", ".", "_read_tsv", "(", "os", ".", "path", ".", "join", "(", "data_dir", ",", "\"dev_matched.tsv\"", ")", ")", ",", "\"dev_matched\"", ...
[ 236, 4 ]
[ 238, 110 ]
python
en
['en', 'en', 'en']
True
MnliProcessor.get_test_examples
(self, data_dir)
See base class.
See base class.
def get_test_examples(self, data_dir): """See base class.""" return self._create_examples(self._read_tsv(os.path.join(data_dir, "test_matched.tsv")), "test_matched")
[ "def", "get_test_examples", "(", "self", ",", "data_dir", ")", ":", "return", "self", ".", "_create_examples", "(", "self", ".", "_read_tsv", "(", "os", ".", "path", ".", "join", "(", "data_dir", ",", "\"test_matched.tsv\"", ")", ")", ",", "\"test_matched\""...
[ 240, 4 ]
[ 242, 112 ]
python
en
['en', 'en', 'en']
True
MnliProcessor.get_labels
(self)
See base class.
See base class.
def get_labels(self): """See base class.""" return ["contradiction", "entailment", "neutral"]
[ "def", "get_labels", "(", "self", ")", ":", "return", "[", "\"contradiction\"", ",", "\"entailment\"", ",", "\"neutral\"", "]" ]
[ 244, 4 ]
[ 246, 57 ]
python
en
['en', 'en', 'en']
True
MnliProcessor._create_examples
(self, lines, set_type)
Creates examples for the training, dev and test sets.
Creates examples for the training, dev and test sets.
def _create_examples(self, lines, set_type): """Creates examples for the training, dev and test sets.""" examples = [] for (i, line) in enumerate(lines): if i == 0: continue guid = "%s-%s" % (set_type, line[0]) text_a = line[8] text...
[ "def", "_create_examples", "(", "self", ",", "lines", ",", "set_type", ")", ":", "examples", "=", "[", "]", "for", "(", "i", ",", "line", ")", "in", "enumerate", "(", "lines", ")", ":", "if", "i", "==", "0", ":", "continue", "guid", "=", "\"%s-%s\"...
[ 248, 4 ]
[ 259, 23 ]
python
en
['en', 'en', 'en']
True
MnliMismatchedProcessor.get_dev_examples
(self, data_dir)
See base class.
See base class.
def get_dev_examples(self, data_dir): """See base class.""" return self._create_examples(self._read_tsv(os.path.join(data_dir, "dev_mismatched.tsv")), "dev_mismatched")
[ "def", "get_dev_examples", "(", "self", ",", "data_dir", ")", ":", "return", "self", ".", "_create_examples", "(", "self", ".", "_read_tsv", "(", "os", ".", "path", ".", "join", "(", "data_dir", ",", "\"dev_mismatched.tsv\"", ")", ")", ",", "\"dev_mismatched...
[ 269, 4 ]
[ 271, 116 ]
python
en
['en', 'en', 'en']
True
MnliMismatchedProcessor.get_test_examples
(self, data_dir)
See base class.
See base class.
def get_test_examples(self, data_dir): """See base class.""" return self._create_examples(self._read_tsv(os.path.join(data_dir, "test_mismatched.tsv")), "test_mismatched")
[ "def", "get_test_examples", "(", "self", ",", "data_dir", ")", ":", "return", "self", ".", "_create_examples", "(", "self", ".", "_read_tsv", "(", "os", ".", "path", ".", "join", "(", "data_dir", ",", "\"test_mismatched.tsv\"", ")", ")", ",", "\"test_mismatc...
[ 273, 4 ]
[ 275, 118 ]
python
en
['en', 'en', 'en']
True
ColaProcessor.get_example_from_tensor_dict
(self, tensor_dict)
See base class.
See base class.
def get_example_from_tensor_dict(self, tensor_dict): """See base class.""" return InputExample( tensor_dict["idx"].numpy(), tensor_dict["sentence"].numpy().decode("utf-8"), None, str(tensor_dict["label"].numpy()), )
[ "def", "get_example_from_tensor_dict", "(", "self", ",", "tensor_dict", ")", ":", "return", "InputExample", "(", "tensor_dict", "[", "\"idx\"", "]", ".", "numpy", "(", ")", ",", "tensor_dict", "[", "\"sentence\"", "]", ".", "numpy", "(", ")", ".", "decode", ...
[ 285, 4 ]
[ 292, 9 ]
python
en
['en', 'en', 'en']
True
ColaProcessor.get_train_examples
(self, data_dir)
See base class.
See base class.
def get_train_examples(self, data_dir): """See base class.""" return self._create_examples(self._read_tsv(os.path.join(data_dir, "train.tsv")), "train")
[ "def", "get_train_examples", "(", "self", ",", "data_dir", ")", ":", "return", "self", ".", "_create_examples", "(", "self", ".", "_read_tsv", "(", "os", ".", "path", ".", "join", "(", "data_dir", ",", "\"train.tsv\"", ")", ")", ",", "\"train\"", ")" ]
[ 294, 4 ]
[ 296, 98 ]
python
en
['en', 'en', 'en']
True
ColaProcessor.get_dev_examples
(self, data_dir)
See base class.
See base class.
def get_dev_examples(self, data_dir): """See base class.""" return self._create_examples(self._read_tsv(os.path.join(data_dir, "dev.tsv")), "dev")
[ "def", "get_dev_examples", "(", "self", ",", "data_dir", ")", ":", "return", "self", ".", "_create_examples", "(", "self", ".", "_read_tsv", "(", "os", ".", "path", ".", "join", "(", "data_dir", ",", "\"dev.tsv\"", ")", ")", ",", "\"dev\"", ")" ]
[ 298, 4 ]
[ 300, 94 ]
python
en
['en', 'en', 'en']
True
ColaProcessor.get_test_examples
(self, data_dir)
See base class.
See base class.
def get_test_examples(self, data_dir): """See base class.""" return self._create_examples(self._read_tsv(os.path.join(data_dir, "test.tsv")), "test")
[ "def", "get_test_examples", "(", "self", ",", "data_dir", ")", ":", "return", "self", ".", "_create_examples", "(", "self", ".", "_read_tsv", "(", "os", ".", "path", ".", "join", "(", "data_dir", ",", "\"test.tsv\"", ")", ")", ",", "\"test\"", ")" ]
[ 302, 4 ]
[ 304, 96 ]
python
en
['en', 'en', 'en']
True
ColaProcessor.get_labels
(self)
See base class.
See base class.
def get_labels(self): """See base class.""" return ["0", "1"]
[ "def", "get_labels", "(", "self", ")", ":", "return", "[", "\"0\"", ",", "\"1\"", "]" ]
[ 306, 4 ]
[ 308, 25 ]
python
en
['en', 'en', 'en']
True
ColaProcessor._create_examples
(self, lines, set_type)
Creates examples for the training, dev and test sets.
Creates examples for the training, dev and test sets.
def _create_examples(self, lines, set_type): """Creates examples for the training, dev and test sets.""" test_mode = set_type == "test" if test_mode: lines = lines[1:] text_index = 1 if test_mode else 3 examples = [] for (i, line) in enumerate(lines): ...
[ "def", "_create_examples", "(", "self", ",", "lines", ",", "set_type", ")", ":", "test_mode", "=", "set_type", "==", "\"test\"", "if", "test_mode", ":", "lines", "=", "lines", "[", "1", ":", "]", "text_index", "=", "1", "if", "test_mode", "else", "3", ...
[ 310, 4 ]
[ 322, 23 ]
python
en
['en', 'en', 'en']
True
Sst2Processor.get_example_from_tensor_dict
(self, tensor_dict)
See base class.
See base class.
def get_example_from_tensor_dict(self, tensor_dict): """See base class.""" return InputExample( tensor_dict["idx"].numpy(), tensor_dict["sentence"].numpy().decode("utf-8"), None, str(tensor_dict["label"].numpy()), )
[ "def", "get_example_from_tensor_dict", "(", "self", ",", "tensor_dict", ")", ":", "return", "InputExample", "(", "tensor_dict", "[", "\"idx\"", "]", ".", "numpy", "(", ")", ",", "tensor_dict", "[", "\"sentence\"", "]", ".", "numpy", "(", ")", ".", "decode", ...
[ 332, 4 ]
[ 339, 9 ]
python
en
['en', 'en', 'en']
True
Sst2Processor.get_train_examples
(self, data_dir)
See base class.
See base class.
def get_train_examples(self, data_dir): """See base class.""" return self._create_examples(self._read_tsv(os.path.join(data_dir, "train.tsv")), "train")
[ "def", "get_train_examples", "(", "self", ",", "data_dir", ")", ":", "return", "self", ".", "_create_examples", "(", "self", ".", "_read_tsv", "(", "os", ".", "path", ".", "join", "(", "data_dir", ",", "\"train.tsv\"", ")", ")", ",", "\"train\"", ")" ]
[ 341, 4 ]
[ 343, 98 ]
python
en
['en', 'en', 'en']
True
Sst2Processor.get_dev_examples
(self, data_dir)
See base class.
See base class.
def get_dev_examples(self, data_dir): """See base class.""" return self._create_examples(self._read_tsv(os.path.join(data_dir, "dev.tsv")), "dev")
[ "def", "get_dev_examples", "(", "self", ",", "data_dir", ")", ":", "return", "self", ".", "_create_examples", "(", "self", ".", "_read_tsv", "(", "os", ".", "path", ".", "join", "(", "data_dir", ",", "\"dev.tsv\"", ")", ")", ",", "\"dev\"", ")" ]
[ 345, 4 ]
[ 347, 94 ]
python
en
['en', 'en', 'en']
True
Sst2Processor.get_test_examples
(self, data_dir)
See base class.
See base class.
def get_test_examples(self, data_dir): """See base class.""" return self._create_examples(self._read_tsv(os.path.join(data_dir, "test.tsv")), "test")
[ "def", "get_test_examples", "(", "self", ",", "data_dir", ")", ":", "return", "self", ".", "_create_examples", "(", "self", ".", "_read_tsv", "(", "os", ".", "path", ".", "join", "(", "data_dir", ",", "\"test.tsv\"", ")", ")", ",", "\"test\"", ")" ]
[ 349, 4 ]
[ 351, 96 ]
python
en
['en', 'en', 'en']
True
Sst2Processor.get_labels
(self)
See base class.
See base class.
def get_labels(self): """See base class.""" return ["0", "1"]
[ "def", "get_labels", "(", "self", ")", ":", "return", "[", "\"0\"", ",", "\"1\"", "]" ]
[ 353, 4 ]
[ 355, 25 ]
python
en
['en', 'en', 'en']
True
Sst2Processor._create_examples
(self, lines, set_type)
Creates examples for the training, dev and test sets.
Creates examples for the training, dev and test sets.
def _create_examples(self, lines, set_type): """Creates examples for the training, dev and test sets.""" examples = [] text_index = 1 if set_type == "test" else 0 for (i, line) in enumerate(lines): if i == 0: continue guid = "%s-%s" % (set_type, i)...
[ "def", "_create_examples", "(", "self", ",", "lines", ",", "set_type", ")", ":", "examples", "=", "[", "]", "text_index", "=", "1", "if", "set_type", "==", "\"test\"", "else", "0", "for", "(", "i", ",", "line", ")", "in", "enumerate", "(", "lines", "...
[ 357, 4 ]
[ 368, 23 ]
python
en
['en', 'en', 'en']
True
StsbProcessor.get_example_from_tensor_dict
(self, tensor_dict)
See base class.
See base class.
def get_example_from_tensor_dict(self, tensor_dict): """See base class.""" return InputExample( tensor_dict["idx"].numpy(), tensor_dict["sentence1"].numpy().decode("utf-8"), tensor_dict["sentence2"].numpy().decode("utf-8"), str(tensor_dict["label"].numpy()...
[ "def", "get_example_from_tensor_dict", "(", "self", ",", "tensor_dict", ")", ":", "return", "InputExample", "(", "tensor_dict", "[", "\"idx\"", "]", ".", "numpy", "(", ")", ",", "tensor_dict", "[", "\"sentence1\"", "]", ".", "numpy", "(", ")", ".", "decode",...
[ 378, 4 ]
[ 385, 9 ]
python
en
['en', 'en', 'en']
True
StsbProcessor.get_train_examples
(self, data_dir)
See base class.
See base class.
def get_train_examples(self, data_dir): """See base class.""" return self._create_examples(self._read_tsv(os.path.join(data_dir, "train.tsv")), "train")
[ "def", "get_train_examples", "(", "self", ",", "data_dir", ")", ":", "return", "self", ".", "_create_examples", "(", "self", ".", "_read_tsv", "(", "os", ".", "path", ".", "join", "(", "data_dir", ",", "\"train.tsv\"", ")", ")", ",", "\"train\"", ")" ]
[ 387, 4 ]
[ 389, 98 ]
python
en
['en', 'en', 'en']
True
StsbProcessor.get_dev_examples
(self, data_dir)
See base class.
See base class.
def get_dev_examples(self, data_dir): """See base class.""" return self._create_examples(self._read_tsv(os.path.join(data_dir, "dev.tsv")), "dev")
[ "def", "get_dev_examples", "(", "self", ",", "data_dir", ")", ":", "return", "self", ".", "_create_examples", "(", "self", ".", "_read_tsv", "(", "os", ".", "path", ".", "join", "(", "data_dir", ",", "\"dev.tsv\"", ")", ")", ",", "\"dev\"", ")" ]
[ 391, 4 ]
[ 393, 94 ]
python
en
['en', 'en', 'en']
True
StsbProcessor.get_test_examples
(self, data_dir)
See base class.
See base class.
def get_test_examples(self, data_dir): """See base class.""" return self._create_examples(self._read_tsv(os.path.join(data_dir, "test.tsv")), "test")
[ "def", "get_test_examples", "(", "self", ",", "data_dir", ")", ":", "return", "self", ".", "_create_examples", "(", "self", ".", "_read_tsv", "(", "os", ".", "path", ".", "join", "(", "data_dir", ",", "\"test.tsv\"", ")", ")", ",", "\"test\"", ")" ]
[ 395, 4 ]
[ 397, 96 ]
python
en
['en', 'en', 'en']
True
StsbProcessor.get_labels
(self)
See base class.
See base class.
def get_labels(self): """See base class.""" return [None]
[ "def", "get_labels", "(", "self", ")", ":", "return", "[", "None", "]" ]
[ 399, 4 ]
[ 401, 21 ]
python
en
['en', 'en', 'en']
True
StsbProcessor._create_examples
(self, lines, set_type)
Creates examples for the training, dev and test sets.
Creates examples for the training, dev and test sets.
def _create_examples(self, lines, set_type): """Creates examples for the training, dev and test sets.""" examples = [] for (i, line) in enumerate(lines): if i == 0: continue guid = "%s-%s" % (set_type, line[0]) text_a = line[7] text...
[ "def", "_create_examples", "(", "self", ",", "lines", ",", "set_type", ")", ":", "examples", "=", "[", "]", "for", "(", "i", ",", "line", ")", "in", "enumerate", "(", "lines", ")", ":", "if", "i", "==", "0", ":", "continue", "guid", "=", "\"%s-%s\"...
[ 403, 4 ]
[ 414, 23 ]
python
en
['en', 'en', 'en']
True
QqpProcessor.get_example_from_tensor_dict
(self, tensor_dict)
See base class.
See base class.
def get_example_from_tensor_dict(self, tensor_dict): """See base class.""" return InputExample( tensor_dict["idx"].numpy(), tensor_dict["question1"].numpy().decode("utf-8"), tensor_dict["question2"].numpy().decode("utf-8"), str(tensor_dict["label"].numpy()...
[ "def", "get_example_from_tensor_dict", "(", "self", ",", "tensor_dict", ")", ":", "return", "InputExample", "(", "tensor_dict", "[", "\"idx\"", "]", ".", "numpy", "(", ")", ",", "tensor_dict", "[", "\"question1\"", "]", ".", "numpy", "(", ")", ".", "decode",...
[ 424, 4 ]
[ 431, 9 ]
python
en
['en', 'en', 'en']
True
QqpProcessor.get_train_examples
(self, data_dir)
See base class.
See base class.
def get_train_examples(self, data_dir): """See base class.""" return self._create_examples(self._read_tsv(os.path.join(data_dir, "train.tsv")), "train")
[ "def", "get_train_examples", "(", "self", ",", "data_dir", ")", ":", "return", "self", ".", "_create_examples", "(", "self", ".", "_read_tsv", "(", "os", ".", "path", ".", "join", "(", "data_dir", ",", "\"train.tsv\"", ")", ")", ",", "\"train\"", ")" ]
[ 433, 4 ]
[ 435, 98 ]
python
en
['en', 'en', 'en']
True
QqpProcessor.get_dev_examples
(self, data_dir)
See base class.
See base class.
def get_dev_examples(self, data_dir): """See base class.""" return self._create_examples(self._read_tsv(os.path.join(data_dir, "dev.tsv")), "dev")
[ "def", "get_dev_examples", "(", "self", ",", "data_dir", ")", ":", "return", "self", ".", "_create_examples", "(", "self", ".", "_read_tsv", "(", "os", ".", "path", ".", "join", "(", "data_dir", ",", "\"dev.tsv\"", ")", ")", ",", "\"dev\"", ")" ]
[ 437, 4 ]
[ 439, 94 ]
python
en
['en', 'en', 'en']
True
QqpProcessor.get_test_examples
(self, data_dir)
See base class.
See base class.
def get_test_examples(self, data_dir): """See base class.""" return self._create_examples(self._read_tsv(os.path.join(data_dir, "test.tsv")), "test")
[ "def", "get_test_examples", "(", "self", ",", "data_dir", ")", ":", "return", "self", ".", "_create_examples", "(", "self", ".", "_read_tsv", "(", "os", ".", "path", ".", "join", "(", "data_dir", ",", "\"test.tsv\"", ")", ")", ",", "\"test\"", ")" ]
[ 441, 4 ]
[ 443, 96 ]
python
en
['en', 'en', 'en']
True
QqpProcessor.get_labels
(self)
See base class.
See base class.
def get_labels(self): """See base class.""" return ["0", "1"]
[ "def", "get_labels", "(", "self", ")", ":", "return", "[", "\"0\"", ",", "\"1\"", "]" ]
[ 445, 4 ]
[ 447, 25 ]
python
en
['en', 'en', 'en']
True
QqpProcessor._create_examples
(self, lines, set_type)
Creates examples for the training, dev and test sets.
Creates examples for the training, dev and test sets.
def _create_examples(self, lines, set_type): """Creates examples for the training, dev and test sets.""" test_mode = set_type == "test" q1_index = 1 if test_mode else 3 q2_index = 2 if test_mode else 4 examples = [] for (i, line) in enumerate(lines): if i == 0...
[ "def", "_create_examples", "(", "self", ",", "lines", ",", "set_type", ")", ":", "test_mode", "=", "set_type", "==", "\"test\"", "q1_index", "=", "1", "if", "test_mode", "else", "3", "q2_index", "=", "2", "if", "test_mode", "else", "4", "examples", "=", ...
[ 449, 4 ]
[ 466, 23 ]
python
en
['en', 'en', 'en']
True