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
MockDysonState.__init__
(self)
Create new Mock Dyson State.
Create new Mock Dyson State.
def __init__(self): """Create new Mock Dyson State."""
[ "def", "__init__", "(", "self", ")", ":" ]
[ 71, 4 ]
[ 72, 42 ]
python
en
['en', 'en', 'en']
True
MockDysonState.__repr__
(self)
Mock repr because original one fails since constructor not called.
Mock repr because original one fails since constructor not called.
def __repr__(self): """Mock repr because original one fails since constructor not called.""" return "<MockDysonState>"
[ "def", "__repr__", "(", "self", ")", ":", "return", "\"<MockDysonState>\"" ]
[ 74, 4 ]
[ 76, 33 ]
python
en
['en', 'en', 'en']
True
config_entry
()
Create a mock GeoNet NZ Quakes config entry.
Create a mock GeoNet NZ Quakes config entry.
def config_entry(): """Create a mock GeoNet NZ Quakes config entry.""" return MockConfigEntry( domain=DOMAIN, data={ CONF_LATITUDE: -41.2, CONF_LONGITUDE: 174.7, CONF_RADIUS: 25, CONF_UNIT_SYSTEM: "metric", CONF_SCAN_INTERVAL: 300.0, ...
[ "def", "config_entry", "(", ")", ":", "return", "MockConfigEntry", "(", "domain", "=", "DOMAIN", ",", "data", "=", "{", "CONF_LATITUDE", ":", "-", "41.2", ",", "CONF_LONGITUDE", ":", "174.7", ",", "CONF_RADIUS", ":", "25", ",", "CONF_UNIT_SYSTEM", ":", "\"...
[ 20, 0 ]
[ 35, 5 ]
python
en
['en', 'gd', 'en']
True
async_init_integration
( hass: HomeAssistant, ups_fixture: str, resources: list )
Set up the nexia integration in Home Assistant.
Set up the nexia integration in Home Assistant.
async def async_init_integration( hass: HomeAssistant, ups_fixture: str, resources: list ) -> MockConfigEntry: """Set up the nexia integration in Home Assistant.""" ups_fixture = f"nut/{ups_fixture}.json" list_vars = json.loads(load_fixture(ups_fixture)) mock_pynut = _get_mock_pynutclient(list_ups...
[ "async", "def", "async_init_integration", "(", "hass", ":", "HomeAssistant", ",", "ups_fixture", ":", "str", ",", "resources", ":", "list", ")", "->", "MockConfigEntry", ":", "ups_fixture", "=", "f\"nut/{ups_fixture}.json\"", "list_vars", "=", "json", ".", "loads"...
[ 19, 0 ]
[ 42, 16 ]
python
en
['en', 'en', 'en']
True
async_setup_entry
(hass, config, async_add_entities)
Initialize a Spider thermostat.
Initialize a Spider thermostat.
async def async_setup_entry(hass, config, async_add_entities): """Initialize a Spider thermostat.""" api = hass.data[DOMAIN][config.entry_id] async_add_entities( [ SpiderThermostat(api, entity) for entity in await hass.async_add_executor_job(api.get_thermostats) ] ...
[ "async", "def", "async_setup_entry", "(", "hass", ",", "config", ",", "async_add_entities", ")", ":", "api", "=", "hass", ".", "data", "[", "DOMAIN", "]", "[", "config", ".", "entry_id", "]", "async_add_entities", "(", "[", "SpiderThermostat", "(", "api", ...
[ 26, 0 ]
[ 35, 5 ]
python
en
['en', 'en', 'en']
True
SpiderThermostat.__init__
(self, api, thermostat)
Initialize the thermostat.
Initialize the thermostat.
def __init__(self, api, thermostat): """Initialize the thermostat.""" self.api = api self.thermostat = thermostat
[ "def", "__init__", "(", "self", ",", "api", ",", "thermostat", ")", ":", "self", ".", "api", "=", "api", "self", ".", "thermostat", "=", "thermostat" ]
[ 41, 4 ]
[ 44, 36 ]
python
en
['en', 'en', 'en']
True
SpiderThermostat.supported_features
(self)
Return the list of supported features.
Return the list of supported features.
def supported_features(self): """Return the list of supported features.""" if self.thermostat.has_fan_mode: return SUPPORT_TARGET_TEMPERATURE | SUPPORT_FAN_MODE return SUPPORT_TARGET_TEMPERATURE
[ "def", "supported_features", "(", "self", ")", ":", "if", "self", ".", "thermostat", ".", "has_fan_mode", ":", "return", "SUPPORT_TARGET_TEMPERATURE", "|", "SUPPORT_FAN_MODE", "return", "SUPPORT_TARGET_TEMPERATURE" ]
[ 47, 4 ]
[ 51, 41 ]
python
en
['en', 'en', 'en']
True
SpiderThermostat.unique_id
(self)
Return the id of the thermostat, if any.
Return the id of the thermostat, if any.
def unique_id(self): """Return the id of the thermostat, if any.""" return self.thermostat.id
[ "def", "unique_id", "(", "self", ")", ":", "return", "self", ".", "thermostat", ".", "id" ]
[ 54, 4 ]
[ 56, 33 ]
python
en
['en', 'en', 'en']
True
SpiderThermostat.name
(self)
Return the name of the thermostat, if any.
Return the name of the thermostat, if any.
def name(self): """Return the name of the thermostat, if any.""" return self.thermostat.name
[ "def", "name", "(", "self", ")", ":", "return", "self", ".", "thermostat", ".", "name" ]
[ 59, 4 ]
[ 61, 35 ]
python
en
['en', 'en', 'en']
True
SpiderThermostat.temperature_unit
(self)
Return the unit of measurement.
Return the unit of measurement.
def temperature_unit(self): """Return the unit of measurement.""" return TEMP_CELSIUS
[ "def", "temperature_unit", "(", "self", ")", ":", "return", "TEMP_CELSIUS" ]
[ 64, 4 ]
[ 66, 27 ]
python
en
['en', 'la', 'en']
True
SpiderThermostat.current_temperature
(self)
Return the current temperature.
Return the current temperature.
def current_temperature(self): """Return the current temperature.""" return self.thermostat.current_temperature
[ "def", "current_temperature", "(", "self", ")", ":", "return", "self", ".", "thermostat", ".", "current_temperature" ]
[ 69, 4 ]
[ 71, 50 ]
python
en
['en', 'la', 'en']
True
SpiderThermostat.target_temperature
(self)
Return the temperature we try to reach.
Return the temperature we try to reach.
def target_temperature(self): """Return the temperature we try to reach.""" return self.thermostat.target_temperature
[ "def", "target_temperature", "(", "self", ")", ":", "return", "self", ".", "thermostat", ".", "target_temperature" ]
[ 74, 4 ]
[ 76, 49 ]
python
en
['en', 'en', 'en']
True
SpiderThermostat.target_temperature_step
(self)
Return the supported step of target temperature.
Return the supported step of target temperature.
def target_temperature_step(self): """Return the supported step of target temperature.""" return self.thermostat.temperature_steps
[ "def", "target_temperature_step", "(", "self", ")", ":", "return", "self", ".", "thermostat", ".", "temperature_steps" ]
[ 79, 4 ]
[ 81, 48 ]
python
en
['en', 'en', 'en']
True
SpiderThermostat.min_temp
(self)
Return the minimum temperature.
Return the minimum temperature.
def min_temp(self): """Return the minimum temperature.""" return self.thermostat.minimum_temperature
[ "def", "min_temp", "(", "self", ")", ":", "return", "self", ".", "thermostat", ".", "minimum_temperature" ]
[ 84, 4 ]
[ 86, 50 ]
python
en
['en', 'la', 'en']
True
SpiderThermostat.max_temp
(self)
Return the maximum temperature.
Return the maximum temperature.
def max_temp(self): """Return the maximum temperature.""" return self.thermostat.maximum_temperature
[ "def", "max_temp", "(", "self", ")", ":", "return", "self", ".", "thermostat", ".", "maximum_temperature" ]
[ 89, 4 ]
[ 91, 50 ]
python
en
['en', 'la', 'en']
True
SpiderThermostat.hvac_mode
(self)
Return current operation ie. heat, cool, idle.
Return current operation ie. heat, cool, idle.
def hvac_mode(self): """Return current operation ie. heat, cool, idle.""" return SPIDER_STATE_TO_HA[self.thermostat.operation_mode]
[ "def", "hvac_mode", "(", "self", ")", ":", "return", "SPIDER_STATE_TO_HA", "[", "self", ".", "thermostat", ".", "operation_mode", "]" ]
[ 94, 4 ]
[ 96, 65 ]
python
en
['nl', 'en', 'en']
True
SpiderThermostat.hvac_modes
(self)
Return the list of available operation modes.
Return the list of available operation modes.
def hvac_modes(self): """Return the list of available operation modes.""" return SUPPORT_HVAC
[ "def", "hvac_modes", "(", "self", ")", ":", "return", "SUPPORT_HVAC" ]
[ 99, 4 ]
[ 101, 27 ]
python
en
['en', 'en', 'en']
True
SpiderThermostat.set_temperature
(self, **kwargs)
Set new target temperature.
Set new target temperature.
def set_temperature(self, **kwargs): """Set new target temperature.""" temperature = kwargs.get(ATTR_TEMPERATURE) if temperature is None: return self.thermostat.set_temperature(temperature)
[ "def", "set_temperature", "(", "self", ",", "*", "*", "kwargs", ")", ":", "temperature", "=", "kwargs", ".", "get", "(", "ATTR_TEMPERATURE", ")", "if", "temperature", "is", "None", ":", "return", "self", ".", "thermostat", ".", "set_temperature", "(", "tem...
[ 103, 4 ]
[ 109, 52 ]
python
en
['en', 'ca', 'en']
True
SpiderThermostat.set_hvac_mode
(self, hvac_mode)
Set new target operation mode.
Set new target operation mode.
def set_hvac_mode(self, hvac_mode): """Set new target operation mode.""" self.thermostat.set_operation_mode(HA_STATE_TO_SPIDER.get(hvac_mode))
[ "def", "set_hvac_mode", "(", "self", ",", "hvac_mode", ")", ":", "self", ".", "thermostat", ".", "set_operation_mode", "(", "HA_STATE_TO_SPIDER", ".", "get", "(", "hvac_mode", ")", ")" ]
[ 111, 4 ]
[ 113, 77 ]
python
en
['nl', 'en', 'en']
True
SpiderThermostat.fan_mode
(self)
Return the fan setting.
Return the fan setting.
def fan_mode(self): """Return the fan setting.""" return self.thermostat.current_fan_speed
[ "def", "fan_mode", "(", "self", ")", ":", "return", "self", ".", "thermostat", ".", "current_fan_speed" ]
[ 116, 4 ]
[ 118, 48 ]
python
en
['en', 'fy', 'en']
True
SpiderThermostat.set_fan_mode
(self, fan_mode)
Set fan mode.
Set fan mode.
def set_fan_mode(self, fan_mode): """Set fan mode.""" self.thermostat.set_fan_speed(fan_mode)
[ "def", "set_fan_mode", "(", "self", ",", "fan_mode", ")", ":", "self", ".", "thermostat", ".", "set_fan_speed", "(", "fan_mode", ")" ]
[ 120, 4 ]
[ 122, 47 ]
python
fy
['sv', 'fy', 'nl']
False
SpiderThermostat.fan_modes
(self)
List of available fan modes.
List of available fan modes.
def fan_modes(self): """List of available fan modes.""" return SUPPORT_FAN
[ "def", "fan_modes", "(", "self", ")", ":", "return", "SUPPORT_FAN" ]
[ 125, 4 ]
[ 127, 26 ]
python
en
['en', 'en', 'en']
True
SpiderThermostat.update
(self)
Get the latest data.
Get the latest data.
def update(self): """Get the latest data.""" self.thermostat = self.api.get_thermostat(self.unique_id)
[ "def", "update", "(", "self", ")", ":", "self", ".", "thermostat", "=", "self", ".", "api", ".", "get_thermostat", "(", "self", ".", "unique_id", ")" ]
[ 129, 4 ]
[ 131, 65 ]
python
en
['en', 'en', 'en']
True
async_setup_entry
(hass, config_entry, async_add_entities)
Set up the Tesla binary_sensors by config_entry.
Set up the Tesla binary_sensors by config_entry.
async def async_setup_entry(hass, config_entry, async_add_entities): """Set up the Tesla binary_sensors by config_entry.""" async_add_entities( [ TeslaBinarySensor( device, hass.data[TESLA_DOMAIN][config_entry.entry_id]["coordinator"], ) ...
[ "async", "def", "async_setup_entry", "(", "hass", ",", "config_entry", ",", "async_add_entities", ")", ":", "async_add_entities", "(", "[", "TeslaBinarySensor", "(", "device", ",", "hass", ".", "data", "[", "TESLA_DOMAIN", "]", "[", "config_entry", ".", "entry_i...
[ 7, 0 ]
[ 20, 5 ]
python
en
['en', 'en', 'en']
True
TeslaBinarySensor.device_class
(self)
Return the class of this binary sensor.
Return the class of this binary sensor.
def device_class(self): """Return the class of this binary sensor.""" return ( self.tesla_device.sensor_type if self.tesla_device.sensor_type in DEVICE_CLASSES else None )
[ "def", "device_class", "(", "self", ")", ":", "return", "(", "self", ".", "tesla_device", ".", "sensor_type", "if", "self", ".", "tesla_device", ".", "sensor_type", "in", "DEVICE_CLASSES", "else", "None", ")" ]
[ 27, 4 ]
[ 33, 9 ]
python
en
['en', 'vi', 'en']
True
TeslaBinarySensor.is_on
(self)
Return the state of the binary sensor.
Return the state of the binary sensor.
def is_on(self): """Return the state of the binary sensor.""" return self.tesla_device.get_value()
[ "def", "is_on", "(", "self", ")", ":", "return", "self", ".", "tesla_device", ".", "get_value", "(", ")" ]
[ 36, 4 ]
[ 38, 44 ]
python
en
['en', 'ig', 'en']
True
setup
(hass, base_config)
Set up the gc100 component.
Set up the gc100 component.
def setup(hass, base_config): """Set up the gc100 component.""" config = base_config[DOMAIN] host = config[CONF_HOST] port = config[CONF_PORT] gc_device = gc100.GC100SocketClient(host, port) def cleanup_gc100(event): """Stuff to do before stopping.""" gc_device.quit() hass...
[ "def", "setup", "(", "hass", ",", "base_config", ")", ":", "config", "=", "base_config", "[", "DOMAIN", "]", "host", "=", "config", "[", "CONF_HOST", "]", "port", "=", "config", "[", "CONF_PORT", "]", "gc_device", "=", "gc100", ".", "GC100SocketClient", ...
[ 28, 0 ]
[ 44, 15 ]
python
en
['en', 'en', 'en']
True
GC100Device.__init__
(self, hass, gc_device)
Init a gc100 device.
Init a gc100 device.
def __init__(self, hass, gc_device): """Init a gc100 device.""" self.hass = hass self.gc_device = gc_device
[ "def", "__init__", "(", "self", ",", "hass", ",", "gc_device", ")", ":", "self", ".", "hass", "=", "hass", "self", ".", "gc_device", "=", "gc_device" ]
[ 50, 4 ]
[ 53, 34 ]
python
en
['es', 'en', 'ur']
False
GC100Device.read_sensor
(self, port_addr, callback)
Read a value from a digital input.
Read a value from a digital input.
def read_sensor(self, port_addr, callback): """Read a value from a digital input.""" self.gc_device.read_sensor(port_addr, callback)
[ "def", "read_sensor", "(", "self", ",", "port_addr", ",", "callback", ")", ":", "self", ".", "gc_device", ".", "read_sensor", "(", "port_addr", ",", "callback", ")" ]
[ 55, 4 ]
[ 57, 55 ]
python
en
['en', 'en', 'en']
True
GC100Device.write_switch
(self, port_addr, state, callback)
Write a value to a relay.
Write a value to a relay.
def write_switch(self, port_addr, state, callback): """Write a value to a relay.""" self.gc_device.write_switch(port_addr, state, callback)
[ "def", "write_switch", "(", "self", ",", "port_addr", ",", "state", ",", "callback", ")", ":", "self", ".", "gc_device", ".", "write_switch", "(", "port_addr", ",", "state", ",", "callback", ")" ]
[ 59, 4 ]
[ 61, 63 ]
python
en
['en', 'en', 'en']
True
GC100Device.subscribe
(self, port_addr, callback)
Add detection for RISING and FALLING events.
Add detection for RISING and FALLING events.
def subscribe(self, port_addr, callback): """Add detection for RISING and FALLING events.""" self.gc_device.subscribe_notify(port_addr, callback)
[ "def", "subscribe", "(", "self", ",", "port_addr", ",", "callback", ")", ":", "self", ".", "gc_device", ".", "subscribe_notify", "(", "port_addr", ",", "callback", ")" ]
[ 63, 4 ]
[ 65, 60 ]
python
en
['en', 'en', 'en']
True
async_discover_and_construct
( hass: HomeAssistantType, udn: str = None, st: str = None )
Discovery devices and construct a Device for one.
Discovery devices and construct a Device for one.
async def async_discover_and_construct( hass: HomeAssistantType, udn: str = None, st: str = None ) -> Device: """Discovery devices and construct a Device for one.""" # pylint: disable=invalid-name discovery_infos = await Device.async_discover(hass) _LOGGER.debug("Discovered devices: %s", discovery_i...
[ "async", "def", "async_discover_and_construct", "(", "hass", ":", "HomeAssistantType", ",", "udn", ":", "str", "=", "None", ",", "st", ":", "str", "=", "None", ")", "->", "Device", ":", "# pylint: disable=invalid-name", "discovery_infos", "=", "await", "Device",...
[ 40, 0 ]
[ 77, 59 ]
python
en
['en', 'en', 'en']
True
async_setup
(hass: HomeAssistantType, config: ConfigType)
Set up UPnP component.
Set up UPnP component.
async def async_setup(hass: HomeAssistantType, config: ConfigType): """Set up UPnP component.""" _LOGGER.debug("async_setup, config: %s", config) conf_default = CONFIG_SCHEMA({DOMAIN: {}})[DOMAIN] conf = config.get(DOMAIN, conf_default) local_ip = await hass.async_add_executor_job(get_local_ip) ...
[ "async", "def", "async_setup", "(", "hass", ":", "HomeAssistantType", ",", "config", ":", "ConfigType", ")", ":", "_LOGGER", ".", "debug", "(", "\"async_setup, config: %s\"", ",", "config", ")", "conf_default", "=", "CONFIG_SCHEMA", "(", "{", "DOMAIN", ":", "{...
[ 80, 0 ]
[ 101, 15 ]
python
en
['en', 'da', 'en']
True
async_setup_entry
(hass: HomeAssistantType, config_entry: ConfigEntry)
Set up UPnP/IGD device from a config entry.
Set up UPnP/IGD device from a config entry.
async def async_setup_entry(hass: HomeAssistantType, config_entry: ConfigEntry) -> bool: """Set up UPnP/IGD device from a config entry.""" _LOGGER.debug("async_setup_entry, config_entry: %s", config_entry.data) # Discover and construct. udn = config_entry.data.get(CONFIG_ENTRY_UDN) st = config_entr...
[ "async", "def", "async_setup_entry", "(", "hass", ":", "HomeAssistantType", ",", "config_entry", ":", "ConfigEntry", ")", "->", "bool", ":", "_LOGGER", ".", "debug", "(", "\"async_setup_entry, config_entry: %s\"", ",", "config_entry", ".", "data", ")", "# Discover a...
[ 104, 0 ]
[ 147, 15 ]
python
en
['en', 'en', 'en']
True
async_unload_entry
( hass: HomeAssistantType, config_entry: ConfigEntry )
Unload a UPnP/IGD device from a config entry.
Unload a UPnP/IGD device from a config entry.
async def async_unload_entry( hass: HomeAssistantType, config_entry: ConfigEntry ) -> bool: """Unload a UPnP/IGD device from a config entry.""" udn = config_entry.data.get(CONFIG_ENTRY_UDN) if udn in hass.data[DOMAIN][DOMAIN_DEVICES]: del hass.data[DOMAIN][DOMAIN_DEVICES][udn] if udn in hass...
[ "async", "def", "async_unload_entry", "(", "hass", ":", "HomeAssistantType", ",", "config_entry", ":", "ConfigEntry", ")", "->", "bool", ":", "udn", "=", "config_entry", ".", "data", ".", "get", "(", "CONFIG_ENTRY_UDN", ")", "if", "udn", "in", "hass", ".", ...
[ 150, 0 ]
[ 161, 87 ]
python
en
['en', 'en', 'en']
True
LocalCorrelatedJitter.initialize_model
(self, mc, **kwargs)
A special kind of initialization is required for this module, since it has to take a second dataset and check the correspondence with the points
A special kind of initialization is required for this module, since it has to take a second dataset and check the correspondence with the points
def initialize_model(self, mc, **kwargs): """ A special kind of initialization is required for this module, since it has to take a second dataset and check the correspondence with the points """ dataset_ref = mc.dataset_dict[kwargs['reference']] dataset_asc = mc.dataset_dict[kwa...
[ "def", "initialize_model", "(", "self", ",", "mc", ",", "*", "*", "kwargs", ")", ":", "dataset_ref", "=", "mc", ".", "dataset_dict", "[", "kwargs", "[", "'reference'", "]", "]", "dataset_asc", "=", "mc", ".", "dataset_dict", "[", "kwargs", "[", "'associa...
[ 26, 4 ]
[ 71, 62 ]
python
en
['en', 'en', 'en']
True
LocalCorrelatedJitter.compute
(self, variable_value, dataset, x0_input=None)
In our array, coefficient are sorted from the lowest degree to the higher This is the order accepted by NumPy.polynomial.polynomial.polyval , which is reversed with respect to from NumPy.polyval
In our array, coefficient are sorted from the lowest degree to the higher This is the order accepted by NumPy.polynomial.polynomial.polyval , which is reversed with respect to from NumPy.polyval
def compute(self, variable_value, dataset, x0_input=None): coeff = np.zeros(self.order+1) for i_order in range(1, self.order+1): var = 'c'+repr(i_order) coeff[i_order] = variable_value[var] x_zero = variable_value['x_zero'] """ In our array, coefficient are sort...
[ "def", "compute", "(", "self", ",", "variable_value", ",", "dataset", ",", "x0_input", "=", "None", ")", ":", "coeff", "=", "np", ".", "zeros", "(", "self", ".", "order", "+", "1", ")", "for", "i_order", "in", "range", "(", "1", ",", "self", ".", ...
[ 73, 4 ]
[ 88, 78 ]
python
en
['en', 'en', 'en']
True
async_setup_entry
(hass, config_entry, async_add_entities)
Set up the ecobee weather platform.
Set up the ecobee weather platform.
async def async_setup_entry(hass, config_entry, async_add_entities): """Set up the ecobee weather platform.""" data = hass.data[DOMAIN] dev = [] for index in range(len(data.ecobee.thermostats)): thermostat = data.ecobee.get_thermostat(index) if "weather" in thermostat: dev.ap...
[ "async", "def", "async_setup_entry", "(", "hass", ",", "config_entry", ",", "async_add_entities", ")", ":", "data", "=", "hass", ".", "data", "[", "DOMAIN", "]", "dev", "=", "[", "]", "for", "index", "in", "range", "(", "len", "(", "data", ".", "ecobee...
[ 26, 0 ]
[ 35, 33 ]
python
en
['en', 'nl', 'en']
True
_process_forecast
(json)
Process a single ecobee API forecast to return expected values.
Process a single ecobee API forecast to return expected values.
def _process_forecast(json): """Process a single ecobee API forecast to return expected values.""" forecast = {} try: forecast[ATTR_FORECAST_CONDITION] = ECOBEE_WEATHER_SYMBOL_TO_HASS[ json["weatherSymbol"] ] if json["tempHigh"] != ECOBEE_STATE_UNKNOWN: foreca...
[ "def", "_process_forecast", "(", "json", ")", ":", "forecast", "=", "{", "}", "try", ":", "forecast", "[", "ATTR_FORECAST_CONDITION", "]", "=", "ECOBEE_WEATHER_SYMBOL_TO_HASS", "[", "json", "[", "\"weatherSymbol\"", "]", "]", "if", "json", "[", "\"tempHigh\"", ...
[ 188, 0 ]
[ 209, 15 ]
python
en
['en', 'en', 'en']
True
EcobeeWeather.__init__
(self, data, name, index)
Initialize the Ecobee weather platform.
Initialize the Ecobee weather platform.
def __init__(self, data, name, index): """Initialize the Ecobee weather platform.""" self.data = data self._name = name self._index = index self.weather = None
[ "def", "__init__", "(", "self", ",", "data", ",", "name", ",", "index", ")", ":", "self", ".", "data", "=", "data", "self", ".", "_name", "=", "name", "self", ".", "_index", "=", "index", "self", ".", "weather", "=", "None" ]
[ 41, 4 ]
[ 46, 27 ]
python
en
['en', 'en', 'en']
True
EcobeeWeather.get_forecast
(self, index, param)
Retrieve forecast parameter.
Retrieve forecast parameter.
def get_forecast(self, index, param): """Retrieve forecast parameter.""" try: forecast = self.weather["forecasts"][index] return forecast[param] except (IndexError, KeyError) as err: raise ValueError from err
[ "def", "get_forecast", "(", "self", ",", "index", ",", "param", ")", ":", "try", ":", "forecast", "=", "self", ".", "weather", "[", "\"forecasts\"", "]", "[", "index", "]", "return", "forecast", "[", "param", "]", "except", "(", "IndexError", ",", "Key...
[ 48, 4 ]
[ 54, 37 ]
python
en
['fr', 'pt', 'en']
False
EcobeeWeather.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" ]
[ 57, 4 ]
[ 59, 25 ]
python
en
['en', 'mi', 'en']
True
EcobeeWeather.unique_id
(self)
Return a unique identifier for the weather platform.
Return a unique identifier for the weather platform.
def unique_id(self): """Return a unique identifier for the weather platform.""" return self.data.ecobee.get_thermostat(self._index)["identifier"]
[ "def", "unique_id", "(", "self", ")", ":", "return", "self", ".", "data", ".", "ecobee", ".", "get_thermostat", "(", "self", ".", "_index", ")", "[", "\"identifier\"", "]" ]
[ 62, 4 ]
[ 64, 73 ]
python
en
['en', 'fr', 'en']
True
EcobeeWeather.device_info
(self)
Return device information for the ecobee weather platform.
Return device information for the ecobee weather platform.
def device_info(self): """Return device information for the ecobee weather platform.""" thermostat = self.data.ecobee.get_thermostat(self._index) try: model = f"{ECOBEE_MODEL_TO_NAME[thermostat['modelNumber']]} Thermostat" except KeyError: _LOGGER.error( ...
[ "def", "device_info", "(", "self", ")", ":", "thermostat", "=", "self", ".", "data", ".", "ecobee", ".", "get_thermostat", "(", "self", ".", "_index", ")", "try", ":", "model", "=", "f\"{ECOBEE_MODEL_TO_NAME[thermostat['modelNumber']]} Thermostat\"", "except", "Ke...
[ 67, 4 ]
[ 88, 9 ]
python
en
['en', 'en', 'en']
True
EcobeeWeather.condition
(self)
Return the current condition.
Return the current condition.
def condition(self): """Return the current condition.""" try: return ECOBEE_WEATHER_SYMBOL_TO_HASS[self.get_forecast(0, "weatherSymbol")] except ValueError: return None
[ "def", "condition", "(", "self", ")", ":", "try", ":", "return", "ECOBEE_WEATHER_SYMBOL_TO_HASS", "[", "self", ".", "get_forecast", "(", "0", ",", "\"weatherSymbol\"", ")", "]", "except", "ValueError", ":", "return", "None" ]
[ 91, 4 ]
[ 96, 23 ]
python
en
['en', 'en', 'en']
True
EcobeeWeather.temperature
(self)
Return the temperature.
Return the temperature.
def temperature(self): """Return the temperature.""" try: return float(self.get_forecast(0, "temperature")) / 10 except ValueError: return None
[ "def", "temperature", "(", "self", ")", ":", "try", ":", "return", "float", "(", "self", ".", "get_forecast", "(", "0", ",", "\"temperature\"", ")", ")", "/", "10", "except", "ValueError", ":", "return", "None" ]
[ 99, 4 ]
[ 104, 23 ]
python
en
['en', 'la', 'en']
True
EcobeeWeather.temperature_unit
(self)
Return the unit of measurement.
Return the unit of measurement.
def temperature_unit(self): """Return the unit of measurement.""" return TEMP_FAHRENHEIT
[ "def", "temperature_unit", "(", "self", ")", ":", "return", "TEMP_FAHRENHEIT" ]
[ 107, 4 ]
[ 109, 30 ]
python
en
['en', 'la', 'en']
True
EcobeeWeather.pressure
(self)
Return the pressure.
Return the pressure.
def pressure(self): """Return the pressure.""" try: return int(self.get_forecast(0, "pressure")) except ValueError: return None
[ "def", "pressure", "(", "self", ")", ":", "try", ":", "return", "int", "(", "self", ".", "get_forecast", "(", "0", ",", "\"pressure\"", ")", ")", "except", "ValueError", ":", "return", "None" ]
[ 112, 4 ]
[ 117, 23 ]
python
en
['en', 'ig', 'en']
True
EcobeeWeather.humidity
(self)
Return the humidity.
Return the humidity.
def humidity(self): """Return the humidity.""" try: return int(self.get_forecast(0, "relativeHumidity")) except ValueError: return None
[ "def", "humidity", "(", "self", ")", ":", "try", ":", "return", "int", "(", "self", ".", "get_forecast", "(", "0", ",", "\"relativeHumidity\"", ")", ")", "except", "ValueError", ":", "return", "None" ]
[ 120, 4 ]
[ 125, 23 ]
python
en
['en', 'sw', 'en']
True
EcobeeWeather.visibility
(self)
Return the visibility.
Return the visibility.
def visibility(self): """Return the visibility.""" try: return int(self.get_forecast(0, "visibility")) / 1000 except ValueError: return None
[ "def", "visibility", "(", "self", ")", ":", "try", ":", "return", "int", "(", "self", ".", "get_forecast", "(", "0", ",", "\"visibility\"", ")", ")", "/", "1000", "except", "ValueError", ":", "return", "None" ]
[ 128, 4 ]
[ 133, 23 ]
python
en
['en', 'en', 'en']
True
EcobeeWeather.wind_speed
(self)
Return the wind speed.
Return the wind speed.
def wind_speed(self): """Return the wind speed.""" try: return int(self.get_forecast(0, "windSpeed")) except ValueError: return None
[ "def", "wind_speed", "(", "self", ")", ":", "try", ":", "return", "int", "(", "self", ".", "get_forecast", "(", "0", ",", "\"windSpeed\"", ")", ")", "except", "ValueError", ":", "return", "None" ]
[ 136, 4 ]
[ 141, 23 ]
python
en
['en', 'zh', 'en']
True
EcobeeWeather.wind_bearing
(self)
Return the wind direction.
Return the wind direction.
def wind_bearing(self): """Return the wind direction.""" try: return int(self.get_forecast(0, "windBearing")) except ValueError: return None
[ "def", "wind_bearing", "(", "self", ")", ":", "try", ":", "return", "int", "(", "self", ".", "get_forecast", "(", "0", ",", "\"windBearing\"", ")", ")", "except", "ValueError", ":", "return", "None" ]
[ 144, 4 ]
[ 149, 23 ]
python
en
['en', 'en', 'en']
True
EcobeeWeather.attribution
(self)
Return the attribution.
Return the attribution.
def attribution(self): """Return the attribution.""" if not self.weather: return None station = self.weather.get("weatherStation", "UNKNOWN") time = self.weather.get("timestamp", "UNKNOWN") return f"Ecobee weather provided by {station} at {time} UTC"
[ "def", "attribution", "(", "self", ")", ":", "if", "not", "self", ".", "weather", ":", "return", "None", "station", "=", "self", ".", "weather", ".", "get", "(", "\"weatherStation\"", ",", "\"UNKNOWN\"", ")", "time", "=", "self", ".", "weather", ".", "...
[ 152, 4 ]
[ 159, 68 ]
python
en
['en', 'ja', 'en']
True
EcobeeWeather.forecast
(self)
Return the forecast array.
Return the forecast array.
def forecast(self): """Return the forecast array.""" if "forecasts" not in self.weather: return None forecasts = [] date = dt_util.utcnow() for day in range(0, 5): forecast = _process_forecast(self.weather["forecasts"][day]) if forecast is Non...
[ "def", "forecast", "(", "self", ")", ":", "if", "\"forecasts\"", "not", "in", "self", ".", "weather", ":", "return", "None", "forecasts", "=", "[", "]", "date", "=", "dt_util", ".", "utcnow", "(", ")", "for", "day", "in", "range", "(", "0", ",", "5...
[ 162, 4 ]
[ 179, 19 ]
python
en
['en', 'ga', 'en']
True
EcobeeWeather.async_update
(self)
Get the latest weather data.
Get the latest weather data.
async def async_update(self): """Get the latest weather data.""" await self.data.update() thermostat = self.data.ecobee.get_thermostat(self._index) self.weather = thermostat.get("weather")
[ "async", "def", "async_update", "(", "self", ")", ":", "await", "self", ".", "data", ".", "update", "(", ")", "thermostat", "=", "self", ".", "data", ".", "ecobee", ".", "get_thermostat", "(", "self", ".", "_index", ")", "self", ".", "weather", "=", ...
[ 181, 4 ]
[ 185, 48 ]
python
en
['en', 'en', 'en']
True
async_setup_entry
( hass: HomeAssistant, entry: ConfigEntry, async_add_entities: Callable[[List[Entity], bool], None], )
Set up Bond light devices.
Set up Bond light devices.
async def async_setup_entry( hass: HomeAssistant, entry: ConfigEntry, async_add_entities: Callable[[List[Entity], bool], None], ) -> None: """Set up Bond light devices.""" hub: BondHub = hass.data[DOMAIN][entry.entry_id] fan_lights: List[Entity] = [ BondLight(hub, device) for de...
[ "async", "def", "async_setup_entry", "(", "hass", ":", "HomeAssistant", ",", "entry", ":", "ConfigEntry", ",", "async_add_entities", ":", "Callable", "[", "[", "List", "[", "Entity", "]", ",", "bool", "]", ",", "None", "]", ",", ")", "->", "None", ":", ...
[ 23, 0 ]
[ 49, 65 ]
python
en
['en', 'cs', 'en']
True
BondLight.__init__
( self, hub: BondHub, device: BondDevice, sub_device: Optional[str] = None )
Create HA entity representing Bond fan.
Create HA entity representing Bond fan.
def __init__( self, hub: BondHub, device: BondDevice, sub_device: Optional[str] = None ): """Create HA entity representing Bond fan.""" super().__init__(hub, device, sub_device) self._brightness: Optional[int] = None self._light: Optional[int] = None
[ "def", "__init__", "(", "self", ",", "hub", ":", "BondHub", ",", "device", ":", "BondDevice", ",", "sub_device", ":", "Optional", "[", "str", "]", "=", "None", ")", ":", "super", "(", ")", ".", "__init__", "(", "hub", ",", "device", ",", "sub_device"...
[ 55, 4 ]
[ 61, 41 ]
python
it
['en', 'it', 'it']
True
BondLight.supported_features
(self)
Flag supported features.
Flag supported features.
def supported_features(self) -> Optional[int]: """Flag supported features.""" if self._device.supports_set_brightness(): return SUPPORT_BRIGHTNESS return 0
[ "def", "supported_features", "(", "self", ")", "->", "Optional", "[", "int", "]", ":", "if", "self", ".", "_device", ".", "supports_set_brightness", "(", ")", ":", "return", "SUPPORT_BRIGHTNESS", "return", "0" ]
[ 68, 4 ]
[ 72, 16 ]
python
en
['da', 'en', 'en']
True
BondLight.is_on
(self)
Return if light is currently on.
Return if light is currently on.
def is_on(self) -> bool: """Return if light is currently on.""" return self._light == 1
[ "def", "is_on", "(", "self", ")", "->", "bool", ":", "return", "self", ".", "_light", "==", "1" ]
[ 75, 4 ]
[ 77, 31 ]
python
en
['en', 'en', 'en']
True
BondLight.brightness
(self)
Return the brightness of this light between 1..255.
Return the brightness of this light between 1..255.
def brightness(self) -> int: """Return the brightness of this light between 1..255.""" brightness_value = ( round(self._brightness * 255 / 100) if self._brightness else None ) return brightness_value
[ "def", "brightness", "(", "self", ")", "->", "int", ":", "brightness_value", "=", "(", "round", "(", "self", ".", "_brightness", "*", "255", "/", "100", ")", "if", "self", ".", "_brightness", "else", "None", ")", "return", "brightness_value" ]
[ 80, 4 ]
[ 85, 31 ]
python
en
['en', 'en', 'en']
True
BondLight.async_turn_on
(self, **kwargs: Any)
Turn on the light.
Turn on the light.
async def async_turn_on(self, **kwargs: Any) -> None: """Turn on the light.""" brightness = kwargs.get(ATTR_BRIGHTNESS) if brightness: await self._hub.bond.action( self._device.device_id, Action.set_brightness(round((brightness * 100) / 255)), ...
[ "async", "def", "async_turn_on", "(", "self", ",", "*", "*", "kwargs", ":", "Any", ")", "->", "None", ":", "brightness", "=", "kwargs", ".", "get", "(", "ATTR_BRIGHTNESS", ")", "if", "brightness", ":", "await", "self", ".", "_hub", ".", "bond", ".", ...
[ 87, 4 ]
[ 96, 87 ]
python
en
['en', 'et', 'en']
True
BondLight.async_turn_off
(self, **kwargs: Any)
Turn off the light.
Turn off the light.
async def async_turn_off(self, **kwargs: Any) -> None: """Turn off the light.""" await self._hub.bond.action(self._device.device_id, Action.turn_light_off())
[ "async", "def", "async_turn_off", "(", "self", ",", "*", "*", "kwargs", ":", "Any", ")", "->", "None", ":", "await", "self", ".", "_hub", ".", "bond", ".", "action", "(", "self", ".", "_device", ".", "device_id", ",", "Action", ".", "turn_light_off", ...
[ 98, 4 ]
[ 100, 84 ]
python
en
['en', 'zh', 'en']
True
BondFireplace.__init__
(self, hub: BondHub, device: BondDevice)
Create HA entity representing Bond fireplace.
Create HA entity representing Bond fireplace.
def __init__(self, hub: BondHub, device: BondDevice): """Create HA entity representing Bond fireplace.""" super().__init__(hub, device) self._power: Optional[bool] = None # Bond flame level, 0-100 self._flame: Optional[int] = None
[ "def", "__init__", "(", "self", ",", "hub", ":", "BondHub", ",", "device", ":", "BondDevice", ")", ":", "super", "(", ")", ".", "__init__", "(", "hub", ",", "device", ")", "self", ".", "_power", ":", "Optional", "[", "bool", "]", "=", "None", "# Bo...
[ 106, 4 ]
[ 112, 41 ]
python
en
['en', 'zh', 'en']
True
BondFireplace.supported_features
(self)
Flag brightness as supported feature to represent flame level.
Flag brightness as supported feature to represent flame level.
def supported_features(self) -> Optional[int]: """Flag brightness as supported feature to represent flame level.""" return SUPPORT_BRIGHTNESS
[ "def", "supported_features", "(", "self", ")", "->", "Optional", "[", "int", "]", ":", "return", "SUPPORT_BRIGHTNESS" ]
[ 119, 4 ]
[ 121, 33 ]
python
en
['en', 'en', 'en']
True
BondFireplace.is_on
(self)
Return True if power is on.
Return True if power is on.
def is_on(self) -> bool: """Return True if power is on.""" return self._power == 1
[ "def", "is_on", "(", "self", ")", "->", "bool", ":", "return", "self", ".", "_power", "==", "1" ]
[ 124, 4 ]
[ 126, 31 ]
python
en
['en', 'fy', 'en']
True
BondFireplace.async_turn_on
(self, **kwargs: Any)
Turn the fireplace on.
Turn the fireplace on.
async def async_turn_on(self, **kwargs: Any) -> None: """Turn the fireplace on.""" _LOGGER.debug("Fireplace async_turn_on called with: %s", kwargs) brightness = kwargs.get(ATTR_BRIGHTNESS) if brightness: flame = round((brightness * 100) / 255) await self._hub.bon...
[ "async", "def", "async_turn_on", "(", "self", ",", "*", "*", "kwargs", ":", "Any", ")", "->", "None", ":", "_LOGGER", ".", "debug", "(", "\"Fireplace async_turn_on called with: %s\"", ",", "kwargs", ")", "brightness", "=", "kwargs", ".", "get", "(", "ATTR_BR...
[ 128, 4 ]
[ 137, 81 ]
python
en
['en', 'en', 'en']
True
BondFireplace.async_turn_off
(self, **kwargs: Any)
Turn the fireplace off.
Turn the fireplace off.
async def async_turn_off(self, **kwargs: Any) -> None: """Turn the fireplace off.""" _LOGGER.debug("Fireplace async_turn_off called with: %s", kwargs) await self._hub.bond.action(self._device.device_id, Action.turn_off())
[ "async", "def", "async_turn_off", "(", "self", ",", "*", "*", "kwargs", ":", "Any", ")", "->", "None", ":", "_LOGGER", ".", "debug", "(", "\"Fireplace async_turn_off called with: %s\"", ",", "kwargs", ")", "await", "self", ".", "_hub", ".", "bond", ".", "a...
[ 139, 4 ]
[ 143, 78 ]
python
en
['en', 'en', 'en']
True
BondFireplace.brightness
(self)
Return the flame of this fireplace converted to HA brightness between 0..255.
Return the flame of this fireplace converted to HA brightness between 0..255.
def brightness(self): """Return the flame of this fireplace converted to HA brightness between 0..255.""" return round(self._flame * 255 / 100) if self._flame else None
[ "def", "brightness", "(", "self", ")", ":", "return", "round", "(", "self", ".", "_flame", "*", "255", "/", "100", ")", "if", "self", ".", "_flame", "else", "None" ]
[ 146, 4 ]
[ 148, 70 ]
python
en
['en', 'en', 'en']
True
BondFireplace.icon
(self)
Show fireplace icon for the entity.
Show fireplace icon for the entity.
def icon(self) -> Optional[str]: """Show fireplace icon for the entity.""" return "mdi:fireplace" if self._power == 1 else "mdi:fireplace-off"
[ "def", "icon", "(", "self", ")", "->", "Optional", "[", "str", "]", ":", "return", "\"mdi:fireplace\"", "if", "self", ".", "_power", "==", "1", "else", "\"mdi:fireplace-off\"" ]
[ 151, 4 ]
[ 153, 75 ]
python
en
['en', 'en', 'en']
True
prepare_inputs_for_generation
(self, input_ids: torch.LongTensor, **kwargs)
Implement in subclasses of :class:`~transformers.PreTrainedModel` for custom behavior to prepare inputs in the generate method.
Implement in subclasses of :class:`~transformers.PreTrainedModel` for custom behavior to prepare inputs in the generate method.
def prepare_inputs_for_generation(self, input_ids: torch.LongTensor, **kwargs) -> Dict[str, Any]: """ Implement in subclasses of :class:`~transformers.PreTrainedModel` for custom behavior to prepare inputs in the generate method. """ return {"input_ids": input_ids}
[ "def", "prepare_inputs_for_generation", "(", "self", ",", "input_ids", ":", "torch", ".", "LongTensor", ",", "*", "*", "kwargs", ")", "->", "Dict", "[", "str", ",", "Any", "]", ":", "return", "{", "\"input_ids\"", ":", "input_ids", "}" ]
[ 365, 4 ]
[ 370, 39 ]
python
en
['en', 'error', 'th']
False
adjust_logits_during_generation
(self, logits: torch.FloatTensor, **kwargs)
Implement in subclasses of :class:`~transformers.PreTrainedModel` for custom behavior to adjust the logits in the generate method.
Implement in subclasses of :class:`~transformers.PreTrainedModel` for custom behavior to adjust the logits in the generate method.
def adjust_logits_during_generation(self, logits: torch.FloatTensor, **kwargs) -> torch.FloatTensor: """ Implement in subclasses of :class:`~transformers.PreTrainedModel` for custom behavior to adjust the logits in the generate method. """ return logits
[ "def", "adjust_logits_during_generation", "(", "self", ",", "logits", ":", "torch", ".", "FloatTensor", ",", "*", "*", "kwargs", ")", "->", "torch", ".", "FloatTensor", ":", "return", "logits" ]
[ 372, 4 ]
[ 377, 21 ]
python
en
['en', 'error', 'th']
False
_get_logits_warper
( self, top_k: int = None, top_p: float = None, temperature: float = None, num_beams: int = None )
This class returns a :obj:`~transformers.LogitsProcessorList` list object that contains all relevant :obj:`~transformers.LogitsWarper` instances used for multinomial sampling.
This class returns a :obj:`~transformers.LogitsProcessorList` list object that contains all relevant :obj:`~transformers.LogitsWarper` instances used for multinomial sampling.
def _get_logits_warper( self, top_k: int = None, top_p: float = None, temperature: float = None, num_beams: int = None ) -> LogitsProcessorList: """ This class returns a :obj:`~transformers.LogitsProcessorList` list object that contains all relevant :obj:`~transformers.LogitsWarper` ...
[ "def", "_get_logits_warper", "(", "self", ",", "top_k", ":", "int", "=", "None", ",", "top_p", ":", "float", "=", "None", ",", "temperature", ":", "float", "=", "None", ",", "num_beams", ":", "int", "=", "None", ")", "->", "LogitsProcessorList", ":", "...
[ 543, 4 ]
[ 566, 22 ]
python
en
['en', 'error', 'th']
False
_get_logits_processor
( self, repetition_penalty: float, no_repeat_ngram_size: int, encoder_no_repeat_ngram_size: int, encoder_input_ids: torch.LongTensor, bad_words_ids: List[List[int]], min_length: int, max_length: int, eos_token_id: int, forced_bos_token_id: ...
This class returns a :obj:`~transformers.LogitsProcessorList` list object that contains all relevant :obj:`~transformers.LogitsProcessor` instances used to modify the scores of the language model head.
This class returns a :obj:`~transformers.LogitsProcessorList` list object that contains all relevant :obj:`~transformers.LogitsProcessor` instances used to modify the scores of the language model head.
def _get_logits_processor( self, repetition_penalty: float, no_repeat_ngram_size: int, encoder_no_repeat_ngram_size: int, encoder_input_ids: torch.LongTensor, bad_words_ids: List[List[int]], min_length: int, max_length: int, eos_token_id: int, ...
[ "def", "_get_logits_processor", "(", "self", ",", "repetition_penalty", ":", "float", ",", "no_repeat_ngram_size", ":", "int", ",", "encoder_no_repeat_ngram_size", ":", "int", ",", "encoder_input_ids", ":", "torch", ".", "LongTensor", ",", "bad_words_ids", ":", "Lis...
[ 568, 4 ]
[ 648, 25 ]
python
en
['en', 'error', 'th']
False
generate
( self, input_ids: Optional[torch.LongTensor] = None, max_length: Optional[int] = None, min_length: Optional[int] = None, do_sample: Optional[bool] = None, early_stopping: Optional[bool] = None, num_beams: Optional[int] = None, temperature: Optional[float]...
r""" Generates sequences for models with a language modeling head. The method currently supports greedy decoding, multinomial sampling, beam-search decoding, and beam-search multinomial sampling. Apart from :obj:`input_ids` and :obj:`attention_mask`, all the arguments below will default to the ...
r""" Generates sequences for models with a language modeling head. The method currently supports greedy decoding, multinomial sampling, beam-search decoding, and beam-search multinomial sampling.
def generate( self, input_ids: Optional[torch.LongTensor] = None, max_length: Optional[int] = None, min_length: Optional[int] = None, do_sample: Optional[bool] = None, early_stopping: Optional[bool] = None, num_beams: Optional[int] = None, temperature: Opt...
[ "def", "generate", "(", "self", ",", "input_ids", ":", "Optional", "[", "torch", ".", "LongTensor", "]", "=", "None", ",", "max_length", ":", "Optional", "[", "int", "]", "=", "None", ",", "min_length", ":", "Optional", "[", "int", "]", "=", "None", ...
[ 664, 4 ]
[ 1144, 13 ]
python
cy
['en', 'cy', 'hi']
False
greedy_search
( self, input_ids: torch.LongTensor, logits_processor: Optional[LogitsProcessorList] = None, stopping_criteria: Optional[StoppingCriteriaList] = None, max_length: Optional[int] = None, pad_token_id: Optional[int] = None, eos_token_id: Optional[int] = None, ...
r""" Generates sequences for models with a language modeling head using greedy decoding. Parameters: input_ids (:obj:`torch.LongTensor` of shape :obj:`(batch_size, sequence_length)`, `optional`): The sequence used as a prompt for the generation. If :obj:`None` the method ...
r""" Generates sequences for models with a language modeling head using greedy decoding.
def greedy_search( self, input_ids: torch.LongTensor, logits_processor: Optional[LogitsProcessorList] = None, stopping_criteria: Optional[StoppingCriteriaList] = None, max_length: Optional[int] = None, pad_token_id: Optional[int] = None, eos_token_id: Optional[int...
[ "def", "greedy_search", "(", "self", ",", "input_ids", ":", "torch", ".", "LongTensor", ",", "logits_processor", ":", "Optional", "[", "LogitsProcessorList", "]", "=", "None", ",", "stopping_criteria", ":", "Optional", "[", "StoppingCriteriaList", "]", "=", "Non...
[ 1146, 4 ]
[ 1352, 28 ]
python
cy
['en', 'cy', 'hi']
False
sample
( self, input_ids: torch.LongTensor, logits_processor: Optional[LogitsProcessorList] = None, stopping_criteria: Optional[StoppingCriteriaList] = None, logits_warper: Optional[LogitsProcessorList] = None, max_length: Optional[int] = None, pad_token_id: Optional[int...
r""" Generates sequences for models with a language modeling head using multinomial sampling. Parameters: input_ids (:obj:`torch.LongTensor` of shape :obj:`(batch_size, sequence_length)`, `optional`): The sequence used as a prompt for the generation. If :obj:`None` the meth...
r""" Generates sequences for models with a language modeling head using multinomial sampling.
def sample( self, input_ids: torch.LongTensor, logits_processor: Optional[LogitsProcessorList] = None, stopping_criteria: Optional[StoppingCriteriaList] = None, logits_warper: Optional[LogitsProcessorList] = None, max_length: Optional[int] = None, pad_token_id: Op...
[ "def", "sample", "(", "self", ",", "input_ids", ":", "torch", ".", "LongTensor", ",", "logits_processor", ":", "Optional", "[", "LogitsProcessorList", "]", "=", "None", ",", "stopping_criteria", ":", "Optional", "[", "StoppingCriteriaList", "]", "=", "None", "...
[ 1354, 4 ]
[ 1574, 28 ]
python
cy
['en', 'cy', 'hi']
False
async_attach_trigger
(hass, config, action, automation_info)
Listen for events based on configuration.
Listen for events based on configuration.
async def async_attach_trigger(hass, config, action, automation_info): """Listen for events based on configuration.""" event = config.get(CONF_EVENT) offset = config.get(CONF_OFFSET) description = event if offset: description = f"{description} with offset" job = HassJob(action) @cal...
[ "async", "def", "async_attach_trigger", "(", "hass", ",", "config", ",", "action", ",", "automation_info", ")", ":", "event", "=", "config", ".", "get", "(", "CONF_EVENT", ")", "offset", "=", "config", ".", "get", "(", "CONF_OFFSET", ")", "description", "=...
[ 26, 0 ]
[ 52, 56 ]
python
en
['en', 'en', 'en']
True
_async_reproduce_state
( hass: HomeAssistantType, state: State, *, context: Optional[Context] = None, reproduce_options: Optional[Dict[str, Any]] = None, )
Reproduce a single state.
Reproduce a single state.
async def _async_reproduce_state( hass: HomeAssistantType, state: State, *, context: Optional[Context] = None, reproduce_options: Optional[Dict[str, Any]] = None, ) -> None: """Reproduce a single state.""" cur_state = hass.states.get(state.entity_id) if cur_state is None: _LOGGE...
[ "async", "def", "_async_reproduce_state", "(", "hass", ":", "HomeAssistantType", ",", "state", ":", "State", ",", "*", ",", "context", ":", "Optional", "[", "Context", "]", "=", "None", ",", "reproduce_options", ":", "Optional", "[", "Dict", "[", "str", ",...
[ 45, 0 ]
[ 119, 9 ]
python
en
['en', 'en', 'en']
True
async_reproduce_states
( hass: HomeAssistantType, states: Iterable[State], *, context: Optional[Context] = None, reproduce_options: Optional[Dict[str, Any]] = None, )
Reproduce Water heater states.
Reproduce Water heater states.
async def async_reproduce_states( hass: HomeAssistantType, states: Iterable[State], *, context: Optional[Context] = None, reproduce_options: Optional[Dict[str, Any]] = None, ) -> None: """Reproduce Water heater states.""" await asyncio.gather( *( _async_reproduce_state( ...
[ "async", "def", "async_reproduce_states", "(", "hass", ":", "HomeAssistantType", ",", "states", ":", "Iterable", "[", "State", "]", ",", "*", ",", "context", ":", "Optional", "[", "Context", "]", "=", "None", ",", "reproduce_options", ":", "Optional", "[", ...
[ 122, 0 ]
[ 137, 5 ]
python
en
['da', 'en', 'en']
True
config_entry_fixture
()
Create a mock config entry.
Create a mock config entry.
def config_entry_fixture(): """Create a mock config entry.""" return MockConfigEntry(domain=DOMAIN, title="Sentry")
[ "def", "config_entry_fixture", "(", ")", ":", "return", "MockConfigEntry", "(", "domain", "=", "DOMAIN", ",", "title", "=", "\"Sentry\"", ")" ]
[ 9, 0 ]
[ 11, 57 ]
python
en
['en', 'gl', 'en']
True
config_fixture
()
Create hass config fixture.
Create hass config fixture.
def config_fixture(): """Create hass config fixture.""" return {DOMAIN: {"dsn": "http://public@sentry.local/1"}}
[ "def", "config_fixture", "(", ")", ":", "return", "{", "DOMAIN", ":", "{", "\"dsn\"", ":", "\"http://public@sentry.local/1\"", "}", "}" ]
[ 15, 0 ]
[ 17, 60 ]
python
en
['en', 'en', 'en']
True
get_service
(hass, config, discovery_info=None)
Get the Hangouts notification service.
Get the Hangouts notification service.
def get_service(hass, config, discovery_info=None): """Get the Hangouts notification service.""" return HangoutsNotificationService(config.get(CONF_DEFAULT_CONVERSATIONS))
[ "def", "get_service", "(", "hass", ",", "config", ",", "discovery_info", "=", "None", ")", ":", "return", "HangoutsNotificationService", "(", "config", ".", "get", "(", "CONF_DEFAULT_CONVERSATIONS", ")", ")" ]
[ 23, 0 ]
[ 25, 78 ]
python
en
['en', 'en', 'en']
True
HangoutsNotificationService.__init__
(self, default_conversations)
Set up the notification service.
Set up the notification service.
def __init__(self, default_conversations): """Set up the notification service.""" self._default_conversations = default_conversations
[ "def", "__init__", "(", "self", ",", "default_conversations", ")", ":", "self", ".", "_default_conversations", "=", "default_conversations" ]
[ 31, 4 ]
[ 33, 59 ]
python
en
['en', 'en', 'en']
True
HangoutsNotificationService.send_message
(self, message="", **kwargs)
Send the message to the Google Hangouts server.
Send the message to the Google Hangouts server.
def send_message(self, message="", **kwargs): """Send the message to the Google Hangouts server.""" target_conversations = None if ATTR_TARGET in kwargs: target_conversations = [] for target in kwargs.get(ATTR_TARGET): target_conversations.append({"id": ta...
[ "def", "send_message", "(", "self", ",", "message", "=", "\"\"", ",", "*", "*", "kwargs", ")", ":", "target_conversations", "=", "None", "if", "ATTR_TARGET", "in", "kwargs", ":", "target_conversations", "=", "[", "]", "for", "target", "in", "kwargs", ".", ...
[ 35, 4 ]
[ 56, 9 ]
python
en
['en', 'en', 'en']
True
devices_from_config
(domain_config)
Parse configuration and add Rflink switch devices.
Parse configuration and add Rflink switch devices.
def devices_from_config(domain_config): """Parse configuration and add Rflink switch devices.""" devices = [] for device_id, config in domain_config[CONF_DEVICES].items(): device_config = dict(domain_config[CONF_DEVICE_DEFAULTS], **config) device = RflinkSwitch(device_id, **device_config) ...
[ "def", "devices_from_config", "(", "domain_config", ")", ":", "devices", "=", "[", "]", "for", "device_id", ",", "config", "in", "domain_config", "[", "CONF_DEVICES", "]", ".", "items", "(", ")", ":", "device_config", "=", "dict", "(", "domain_config", "[", ...
[ 51, 0 ]
[ 59, 18 ]
python
en
['en', 'en', 'en']
True
async_setup_platform
(hass, config, async_add_entities, discovery_info=None)
Set up the Rflink platform.
Set up the Rflink platform.
async def async_setup_platform(hass, config, async_add_entities, discovery_info=None): """Set up the Rflink platform.""" async_add_entities(devices_from_config(config))
[ "async", "def", "async_setup_platform", "(", "hass", ",", "config", ",", "async_add_entities", ",", "discovery_info", "=", "None", ")", ":", "async_add_entities", "(", "devices_from_config", "(", "config", ")", ")" ]
[ 62, 0 ]
[ 64, 51 ]
python
en
['en', 'da', 'en']
True
asana_tasks
()
Show all unassigned and user-assigned tasks.
Show all unassigned and user-assigned tasks.
def asana_tasks(): """Show all unassigned and user-assigned tasks.""" color_dict = projects[['name', 'hex_color']]\ .set_index('name')['hex_color'].to_dict() _logger.info("color_dict: %s", color_dict) email = request.args.get('email', '') user = find_user_by_email(email) if email else None ...
[ "def", "asana_tasks", "(", ")", ":", "color_dict", "=", "projects", "[", "[", "'name'", ",", "'hex_color'", "]", "]", ".", "set_index", "(", "'name'", ")", "[", "'hex_color'", "]", ".", "to_dict", "(", ")", "_logger", ".", "info", "(", "\"color_dict: %s\...
[ 165, 0 ]
[ 176, 49 ]
python
en
['en', 'en', 'en']
True
setup
(hass, config)
Set up Modbus component.
Set up Modbus component.
def setup(hass, config): """Set up Modbus component.""" hass.data[DOMAIN] = hub_collect = {} for conf_hub in config[DOMAIN]: hub_collect[conf_hub[CONF_NAME]] = ModbusHub(conf_hub) # load platforms for component, conf_key in ( ("climate", CONF_CLIMATES), ("co...
[ "def", "setup", "(", "hass", ",", "config", ")", ":", "hass", ".", "data", "[", "DOMAIN", "]", "=", "hub_collect", "=", "{", "}", "for", "conf_hub", "in", "config", "[", "DOMAIN", "]", ":", "hub_collect", "[", "conf_hub", "[", "CONF_NAME", "]", "]", ...
[ 193, 0 ]
[ 251, 15 ]
python
en
['en', 'pt', 'en']
True
ModbusHub.__init__
(self, client_config)
Initialize the Modbus hub.
Initialize the Modbus hub.
def __init__(self, client_config): """Initialize the Modbus hub.""" # generic configuration self._client = None self._lock = threading.Lock() self._config_name = client_config[CONF_NAME] self._config_type = client_config[CONF_TYPE] self._config_port = client_conf...
[ "def", "__init__", "(", "self", ",", "client_config", ")", ":", "# generic configuration", "self", ".", "_client", "=", "None", "self", ".", "_lock", "=", "threading", ".", "Lock", "(", ")", "self", ".", "_config_name", "=", "client_config", "[", "CONF_NAME"...
[ 257, 4 ]
[ 283, 17 ]
python
en
['en', 'pl', 'en']
True
ModbusHub.name
(self)
Return the name of this hub.
Return the name of this hub.
def name(self): """Return the name of this hub.""" return self._config_name
[ "def", "name", "(", "self", ")", ":", "return", "self", ".", "_config_name" ]
[ 286, 4 ]
[ 288, 32 ]
python
en
['en', 'mi', 'en']
True
ModbusHub.setup
(self)
Set up pymodbus client.
Set up pymodbus client.
def setup(self): """Set up pymodbus client.""" if self._config_type == "serial": self._client = ModbusSerialClient( method=self._config_method, port=self._config_port, baudrate=self._config_baudrate, stopbits=self._config_stopbi...
[ "def", "setup", "(", "self", ")", ":", "if", "self", ".", "_config_type", "==", "\"serial\"", ":", "self", ".", "_client", "=", "ModbusSerialClient", "(", "method", "=", "self", ".", "_config_method", ",", "port", "=", "self", ".", "_config_port", ",", "...
[ 290, 4 ]
[ 326, 22 ]
python
en
['en', 'fr', 'en']
True
ModbusHub.close
(self)
Disconnect client.
Disconnect client.
def close(self): """Disconnect client.""" with self._lock: self._client.close()
[ "def", "close", "(", "self", ")", ":", "with", "self", ".", "_lock", ":", "self", ".", "_client", ".", "close", "(", ")" ]
[ 328, 4 ]
[ 331, 32 ]
python
en
['en', 'fr', 'en']
False
ModbusHub.connect
(self)
Connect client.
Connect client.
def connect(self): """Connect client.""" with self._lock: self._client.connect()
[ "def", "connect", "(", "self", ")", ":", "with", "self", ".", "_lock", ":", "self", ".", "_client", ".", "connect", "(", ")" ]
[ 333, 4 ]
[ 336, 34 ]
python
en
['en', 'fr', 'en']
False
ModbusHub.read_coils
(self, unit, address, count)
Read coils.
Read coils.
def read_coils(self, unit, address, count): """Read coils.""" with self._lock: kwargs = {"unit": unit} if unit else {} return self._client.read_coils(address, count, **kwargs)
[ "def", "read_coils", "(", "self", ",", "unit", ",", "address", ",", "count", ")", ":", "with", "self", ".", "_lock", ":", "kwargs", "=", "{", "\"unit\"", ":", "unit", "}", "if", "unit", "else", "{", "}", "return", "self", ".", "_client", ".", "read...
[ 338, 4 ]
[ 342, 68 ]
python
en
['en', 'ca', 'en']
False
ModbusHub.read_discrete_inputs
(self, unit, address, count)
Read discrete inputs.
Read discrete inputs.
def read_discrete_inputs(self, unit, address, count): """Read discrete inputs.""" with self._lock: kwargs = {"unit": unit} if unit else {} return self._client.read_discrete_inputs(address, count, **kwargs)
[ "def", "read_discrete_inputs", "(", "self", ",", "unit", ",", "address", ",", "count", ")", ":", "with", "self", ".", "_lock", ":", "kwargs", "=", "{", "\"unit\"", ":", "unit", "}", "if", "unit", "else", "{", "}", "return", "self", ".", "_client", "....
[ 344, 4 ]
[ 348, 78 ]
python
co
['de', 'co', 'en']
False
ModbusHub.read_input_registers
(self, unit, address, count)
Read input registers.
Read input registers.
def read_input_registers(self, unit, address, count): """Read input registers.""" with self._lock: kwargs = {"unit": unit} if unit else {} return self._client.read_input_registers(address, count, **kwargs)
[ "def", "read_input_registers", "(", "self", ",", "unit", ",", "address", ",", "count", ")", ":", "with", "self", ".", "_lock", ":", "kwargs", "=", "{", "\"unit\"", ":", "unit", "}", "if", "unit", "else", "{", "}", "return", "self", ".", "_client", "....
[ 350, 4 ]
[ 354, 78 ]
python
en
['en', 'mt', 'en']
True
ModbusHub.read_holding_registers
(self, unit, address, count)
Read holding registers.
Read holding registers.
def read_holding_registers(self, unit, address, count): """Read holding registers.""" with self._lock: kwargs = {"unit": unit} if unit else {} return self._client.read_holding_registers(address, count, **kwargs)
[ "def", "read_holding_registers", "(", "self", ",", "unit", ",", "address", ",", "count", ")", ":", "with", "self", ".", "_lock", ":", "kwargs", "=", "{", "\"unit\"", ":", "unit", "}", "if", "unit", "else", "{", "}", "return", "self", ".", "_client", ...
[ 356, 4 ]
[ 360, 80 ]
python
en
['en', 'en', 'en']
True
ModbusHub.write_coil
(self, unit, address, value)
Write coil.
Write coil.
def write_coil(self, unit, address, value): """Write coil.""" with self._lock: kwargs = {"unit": unit} if unit else {} self._client.write_coil(address, value, **kwargs)
[ "def", "write_coil", "(", "self", ",", "unit", ",", "address", ",", "value", ")", ":", "with", "self", ".", "_lock", ":", "kwargs", "=", "{", "\"unit\"", ":", "unit", "}", "if", "unit", "else", "{", "}", "self", ".", "_client", ".", "write_coil", "...
[ 362, 4 ]
[ 366, 61 ]
python
en
['en', 'gd', 'it']
False
ModbusHub.write_register
(self, unit, address, value)
Write register.
Write register.
def write_register(self, unit, address, value): """Write register.""" with self._lock: kwargs = {"unit": unit} if unit else {} self._client.write_register(address, value, **kwargs)
[ "def", "write_register", "(", "self", ",", "unit", ",", "address", ",", "value", ")", ":", "with", "self", ".", "_lock", ":", "kwargs", "=", "{", "\"unit\"", ":", "unit", "}", "if", "unit", "else", "{", "}", "self", ".", "_client", ".", "write_regist...
[ 368, 4 ]
[ 372, 65 ]
python
en
['en', 'no', 'en']
False
ModbusHub.write_registers
(self, unit, address, values)
Write registers.
Write registers.
def write_registers(self, unit, address, values): """Write registers.""" with self._lock: kwargs = {"unit": unit} if unit else {} self._client.write_registers(address, values, **kwargs)
[ "def", "write_registers", "(", "self", ",", "unit", ",", "address", ",", "values", ")", ":", "with", "self", ".", "_lock", ":", "kwargs", "=", "{", "\"unit\"", ":", "unit", "}", "if", "unit", "else", "{", "}", "self", ".", "_client", ".", "write_regi...
[ 374, 4 ]
[ 378, 67 ]
python
en
['en', 'af', 'en']
False