gurudesh/pytracebugs huggingface dataset:
# Buggy code
def get_instance(self):
    return model(
        **{field.attname: getattr(self, field.attname) for field in fields.values()}
    )


# Traceback (TypeError)
Traceback (most recent call last):
File "manage.py", line 10, in <module>
execute_from_command_line(sys.argv)
File "/srv/venv/local/lib/python2.7/site-packages/django/core/management/__init__.py", line 364, in execute_from_command_line
utility.execute()
File "/srv/venv/local/lib/python2.7/site-packages/django/core/management/__init__.py", line 356, in execute
self.fetch_command(subcommand).run_from_argv(self.argv)
File "/srv/venv/local/lib/python2.7/site-packages/django/core/management/base.py", line 283, in run_from_argv
self.execute(*args, **cmd_options)
File "/srv/venv/local/lib/python2.7/site-packages/django/core/management/base.py", line 330, in execute
output = self.handle(*args, **options)
File "/srv/venv/local/lib/python2.7/site-packages/simple_history/management/commands/populate_history.py", line 65, in handle
self._process(to_process, batch_size=options['batchsize'])
File "/srv/venv/local/lib/python2.7/site-packages/simple_history/management/commands/populate_history.py", line 110, in _process
utils.bulk_history_create(model, history_model, batch_size)
File "/srv/venv/local/lib/python2.7/site-packages/simple_history/management/commands/_populate_utils.py", line 28, in bulk_history_create
) for instance in model.objects.all()]
File "/srv/venv/local/lib/python2.7/site-packages/django/db/models/base.py", line 572, in __init__
raise TypeError("'%s' is an invalid keyword argument for this function" % list(kwargs)[0])
TypeError: 'description' is an invalid keyword argument for this function

# Fixed code
def get_instance(self):
    attrs = {field.attname: getattr(self, field.attname) for field in fields.values()}
    if self._history_excluded_fields:
        excluded_attnames = [
            model._meta.get_field(field).attname
            for field in self._history_excluded_fields
        ]
        values = (
            model.objects.filter(pk=getattr(self, model._meta.pk.attname))
            .values(*excluded_attnames)
            .get()
        )
        attrs.update(values)
    return model(**attrs)
# Buggy code
def setup_platform(hass, config, add_entities, discovery_info=None):
    """Set up the HomeMatic binary sensor platform."""
    if discovery_info is None:
        return

    devices = []
    for conf in discovery_info[ATTR_DISCOVER_DEVICES]:
        if discovery_info[ATTR_DISCOVERY_TYPE] == DISCOVER_BATTERY:
            devices.append(HMBatterySensor(conf))
        else:
            devices.append(HMBinarySensor(conf))

    add_entities(devices)


# Traceback (AttributeError)
Error doing job: Task exception was never retrieved
Traceback (most recent call last):
File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 344, in _async_add_entity
capabilities=entity.capability_attributes,
File "/usr/src/homeassistant/homeassistant/components/climate/__init__.py", line 179, in capability_attributes
ATTR_HVAC_MODES: self.hvac_modes,
File "/usr/src/homeassistant/homeassistant/components/homematic/climate.py", line 87, in hvac_modes
if "AUTO_MODE" in self._hmdevice.ACTIONNODE:
AttributeError: 'NoneType' object has no attribute 'ACTIONNODE'

# Fixed code
def setup_platform(hass, config, add_entities, discovery_info=None):
    """Set up the HomeMatic binary sensor platform."""
    if discovery_info is None:
        return

    devices = []
    for conf in discovery_info[ATTR_DISCOVER_DEVICES]:
        if discovery_info[ATTR_DISCOVERY_TYPE] == DISCOVER_BATTERY:
            devices.append(HMBatterySensor(conf))
        else:
            devices.append(HMBinarySensor(conf))

    add_entities(devices, True)
# Buggy code
def setup_platform(hass, config, add_entities, discovery_info=None):
    """Set up the Homematic thermostat platform."""
    if discovery_info is None:
        return

    devices = []
    for conf in discovery_info[ATTR_DISCOVER_DEVICES]:
        new_device = HMThermostat(conf)
        devices.append(new_device)

    add_entities(devices)


# Traceback (AttributeError)
Error doing job: Task exception was never retrieved
Traceback (most recent call last):
File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 344, in _async_add_entity
capabilities=entity.capability_attributes,
File "/usr/src/homeassistant/homeassistant/components/climate/__init__.py", line 179, in capability_attributes
ATTR_HVAC_MODES: self.hvac_modes,
File "/usr/src/homeassistant/homeassistant/components/homematic/climate.py", line 87, in hvac_modes
if "AUTO_MODE" in self._hmdevice.ACTIONNODE:
AttributeError: 'NoneType' object has no attribute 'ACTIONNODE'

# Fixed code
def setup_platform(hass, config, add_entities, discovery_info=None):
    """Set up the Homematic thermostat platform."""
    if discovery_info is None:
        return

    devices = []
    for conf in discovery_info[ATTR_DISCOVER_DEVICES]:
        new_device = HMThermostat(conf)
        devices.append(new_device)

    add_entities(devices, True)
# Buggy code
def setup_platform(hass, config, add_entities, discovery_info=None):
    """Set up the platform."""
    if discovery_info is None:
        return

    devices = []
    for conf in discovery_info[ATTR_DISCOVER_DEVICES]:
        new_device = HMCover(conf)
        devices.append(new_device)

    add_entities(devices)


# Traceback (AttributeError)
Error doing job: Task exception was never retrieved
Traceback (most recent call last):
File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 344, in _async_add_entity
capabilities=entity.capability_attributes,
File "/usr/src/homeassistant/homeassistant/components/climate/__init__.py", line 179, in capability_attributes
ATTR_HVAC_MODES: self.hvac_modes,
File "/usr/src/homeassistant/homeassistant/components/homematic/climate.py", line 87, in hvac_modes
if "AUTO_MODE" in self._hmdevice.ACTIONNODE:
AttributeError: 'NoneType' object has no attribute 'ACTIONNODE'

# Fixed code
def setup_platform(hass, config, add_entities, discovery_info=None):
    """Set up the platform."""
    if discovery_info is None:
        return

    devices = []
    for conf in discovery_info[ATTR_DISCOVER_DEVICES]:
        new_device = HMCover(conf)
        devices.append(new_device)

    add_entities(devices, True)
# Buggy code
def _init_data_struct(self):
    """Generate a data dictionary (self._data) from metadata."""
    self._state = "LEVEL"
    self._data.update({self._state: STATE_UNKNOWN})
    if "LEVEL_2" in self._hmdevice.WRITENODE:
        self._data.update({"LEVEL_2": STATE_UNKNOWN})


# Traceback (AttributeError)
Error doing job: Task exception was never retrieved
Traceback (most recent call last):
File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 344, in _async_add_entity
capabilities=entity.capability_attributes,
File "/usr/src/homeassistant/homeassistant/components/climate/__init__.py", line 179, in capability_attributes
ATTR_HVAC_MODES: self.hvac_modes,
File "/usr/src/homeassistant/homeassistant/components/homematic/climate.py", line 87, in hvac_modes
if "AUTO_MODE" in self._hmdevice.ACTIONNODE:
AttributeError: 'NoneType' object has no attribute 'ACTIONNODE'

# Fixed code
def _init_data_struct(self):
    """Generate a data dictionary (self._data) from metadata."""
    self._state = "LEVEL"
    self._data.update({self._state: None})
    if "LEVEL_2" in self._hmdevice.WRITENODE:
        self._data.update({"LEVEL_2": None})
# Buggy code
def setup_platform(hass, config, add_entities, discovery_info=None):
    """Set up the Homematic light platform."""
    if discovery_info is None:
        return

    devices = []
    for conf in discovery_info[ATTR_DISCOVER_DEVICES]:
        new_device = HMLight(conf)
        devices.append(new_device)

    add_entities(devices)


# Traceback (AttributeError)
Error doing job: Task exception was never retrieved
Traceback (most recent call last):
File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 344, in _async_add_entity
capabilities=entity.capability_attributes,
File "/usr/src/homeassistant/homeassistant/components/climate/__init__.py", line 179, in capability_attributes
ATTR_HVAC_MODES: self.hvac_modes,
File "/usr/src/homeassistant/homeassistant/components/homematic/climate.py", line 87, in hvac_modes
if "AUTO_MODE" in self._hmdevice.ACTIONNODE:
AttributeError: 'NoneType' object has no attribute 'ACTIONNODE'

# Fixed code
def setup_platform(hass, config, add_entities, discovery_info=None):
    """Set up the Homematic light platform."""
    if discovery_info is None:
        return

    devices = []
    for conf in discovery_info[ATTR_DISCOVER_DEVICES]:
        new_device = HMLight(conf)
        devices.append(new_device)

    add_entities(devices, True)
# Buggy code
def setup_platform(hass, config, add_entities, discovery_info=None):
    """Set up the Homematic lock platform."""
    if discovery_info is None:
        return

    devices = []
    for conf in discovery_info[ATTR_DISCOVER_DEVICES]:
        devices.append(HMLock(conf))

    add_entities(devices)


# Traceback (AttributeError)
Error doing job: Task exception was never retrieved
Traceback (most recent call last):
File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 344, in _async_add_entity
capabilities=entity.capability_attributes,
File "/usr/src/homeassistant/homeassistant/components/climate/__init__.py", line 179, in capability_attributes
ATTR_HVAC_MODES: self.hvac_modes,
File "/usr/src/homeassistant/homeassistant/components/homematic/climate.py", line 87, in hvac_modes
if "AUTO_MODE" in self._hmdevice.ACTIONNODE:
AttributeError: 'NoneType' object has no attribute 'ACTIONNODE'

# Fixed code
def setup_platform(hass, config, add_entities, discovery_info=None):
    """Set up the Homematic lock platform."""
    if discovery_info is None:
        return

    devices = []
    for conf in discovery_info[ATTR_DISCOVER_DEVICES]:
        devices.append(HMLock(conf))

    add_entities(devices, True)
# Buggy code
def _init_data_struct(self):
    """Generate the data dictionary (self._data) from metadata."""
    self._state = "STATE"
    self._data.update({self._state: STATE_UNKNOWN})


# Traceback (AttributeError)
Error doing job: Task exception was never retrieved
Traceback (most recent call last):
File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 344, in _async_add_entity
capabilities=entity.capability_attributes,
File "/usr/src/homeassistant/homeassistant/components/climate/__init__.py", line 179, in capability_attributes
ATTR_HVAC_MODES: self.hvac_modes,
File "/usr/src/homeassistant/homeassistant/components/homematic/climate.py", line 87, in hvac_modes
if "AUTO_MODE" in self._hmdevice.ACTIONNODE:
AttributeError: 'NoneType' object has no attribute 'ACTIONNODE'

# Fixed code
def _init_data_struct(self):
    """Generate the data dictionary (self._data) from metadata."""
    self._state = "STATE"
    self._data.update({self._state: None})
# Buggy code
def setup_platform(hass, config, add_entities, discovery_info=None):
    """Set up the HomeMatic sensor platform."""
    if discovery_info is None:
        return

    devices = []
    for conf in discovery_info[ATTR_DISCOVER_DEVICES]:
        new_device = HMSensor(conf)
        devices.append(new_device)

    add_entities(devices)


# Traceback (AttributeError)
Error doing job: Task exception was never retrieved
Traceback (most recent call last):
File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 344, in _async_add_entity
capabilities=entity.capability_attributes,
File "/usr/src/homeassistant/homeassistant/components/climate/__init__.py", line 179, in capability_attributes
ATTR_HVAC_MODES: self.hvac_modes,
File "/usr/src/homeassistant/homeassistant/components/homematic/climate.py", line 87, in hvac_modes
if "AUTO_MODE" in self._hmdevice.ACTIONNODE:
AttributeError: 'NoneType' object has no attribute 'ACTIONNODE'

# Fixed code
def setup_platform(hass, config, add_entities, discovery_info=None):
    """Set up the HomeMatic sensor platform."""
    if discovery_info is None:
        return

    devices = []
    for conf in discovery_info[ATTR_DISCOVER_DEVICES]:
        new_device = HMSensor(conf)
        devices.append(new_device)

    add_entities(devices, True)
# Buggy code
def _init_data_struct(self):
    """Generate a data dictionary (self._data) from metadata."""
    if self._state:
        self._data.update({self._state: STATE_UNKNOWN})
    else:
        _LOGGER.critical("Unable to initialize sensor: %s", self._name)


# Traceback (AttributeError)
Error doing job: Task exception was never retrieved
Traceback (most recent call last):
File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 344, in _async_add_entity
capabilities=entity.capability_attributes,
File "/usr/src/homeassistant/homeassistant/components/climate/__init__.py", line 179, in capability_attributes
ATTR_HVAC_MODES: self.hvac_modes,
File "/usr/src/homeassistant/homeassistant/components/homematic/climate.py", line 87, in hvac_modes
if "AUTO_MODE" in self._hmdevice.ACTIONNODE:
AttributeError: 'NoneType' object has no attribute 'ACTIONNODE'

# Fixed code
def _init_data_struct(self):
    """Generate a data dictionary (self._data) from metadata."""
    if self._state:
        self._data.update({self._state: None})
    else:
        _LOGGER.critical("Unable to initialize sensor: %s", self._name)
# Buggy code
def setup_platform(hass, config, add_entities, discovery_info=None):
    """Set up the HomeMatic switch platform."""
    if discovery_info is None:
        return

    devices = []
    for conf in discovery_info[ATTR_DISCOVER_DEVICES]:
        new_device = HMSwitch(conf)
        devices.append(new_device)

    add_entities(devices)


# Traceback (AttributeError)
Error doing job: Task exception was never retrieved
Traceback (most recent call last):
File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 344, in _async_add_entity
capabilities=entity.capability_attributes,
File "/usr/src/homeassistant/homeassistant/components/climate/__init__.py", line 179, in capability_attributes
ATTR_HVAC_MODES: self.hvac_modes,
File "/usr/src/homeassistant/homeassistant/components/homematic/climate.py", line 87, in hvac_modes
if "AUTO_MODE" in self._hmdevice.ACTIONNODE:
AttributeError: 'NoneType' object has no attribute 'ACTIONNODE'

# Fixed code
def setup_platform(hass, config, add_entities, discovery_info=None):
    """Set up the HomeMatic switch platform."""
    if discovery_info is None:
        return

    devices = []
    for conf in discovery_info[ATTR_DISCOVER_DEVICES]:
        new_device = HMSwitch(conf)
        devices.append(new_device)

    add_entities(devices, True)
# Buggy code
def _init_data_struct(self):
    """Generate the data dictionary (self._data) from metadata."""
    self._state = "STATE"
    self._data.update({self._state: STATE_UNKNOWN})

    # Need sensor values for SwitchPowermeter
    for node in self._hmdevice.SENSORNODE:
        self._data.update({node: STATE_UNKNOWN})


# Traceback (AttributeError)
Error doing job: Task exception was never retrieved
Traceback (most recent call last):
File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 344, in _async_add_entity
capabilities=entity.capability_attributes,
File "/usr/src/homeassistant/homeassistant/components/climate/__init__.py", line 179, in capability_attributes
ATTR_HVAC_MODES: self.hvac_modes,
File "/usr/src/homeassistant/homeassistant/components/homematic/climate.py", line 87, in hvac_modes
if "AUTO_MODE" in self._hmdevice.ACTIONNODE:
AttributeError: 'NoneType' object has no attribute 'ACTIONNODE'

# Fixed code
def _init_data_struct(self):
    """Generate the data dictionary (self._data) from metadata."""
    self._state = "STATE"
    self._data.update({self._state: None})

    # Need sensor values for SwitchPowermeter
    for node in self._hmdevice.SENSORNODE:
        self._data.update({node: None})
# Buggy code
async def async_setup_entry(hass, config_entry, async_add_entities):
    """Set up PS4 from a config entry."""
    config = config_entry
    await async_setup_platform(hass, config, async_add_entities, discovery_info=None)


# Traceback (AttributeError)
Error while setting up platform ps4
Traceback (most recent call last):
File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 146, in _async_setup_platform
await asyncio.wait_for(asyncio.shield(task), SLOW_SETUP_MAX_WAIT)
File "/usr/local/lib/python3.7/asyncio/tasks.py", line 442, in wait_for
return fut.result()
File "/usr/src/homeassistant/homeassistant/components/ps4/media_player.py", line 66, in async_setup_platform
creds = config.data[CONF_TOKEN]
AttributeError: 'collections.OrderedDict' object has no attribute 'data'

# Fixed code
async def async_setup_entry(hass, config_entry, async_add_entities):
    """Set up PS4 from a config entry."""
    config = config_entry
    creds = config.data[CONF_TOKEN]
    device_list = []
    for device in config.data["devices"]:
        host = device[CONF_HOST]
        region = device[CONF_REGION]
        name = device[CONF_NAME]
        ps4 = pyps4.Ps4Async(host, creds, device_name=DEFAULT_ALIAS)
        device_list.append(PS4Device(config, name, host, region, ps4, creds))
    async_add_entities(device_list, update_before_add=True)
# Buggy code
async def async_setup_platform(hass, config, async_add_entities, discovery_info=None):
    """Set up PS4 Platform."""
    creds = config.data[CONF_TOKEN]
    device_list = []
    for device in config.data["devices"]:
        host = device[CONF_HOST]
        region = device[CONF_REGION]
        name = device[CONF_NAME]
        ps4 = pyps4.Ps4Async(host, creds, device_name=DEFAULT_ALIAS)
        device_list.append(PS4Device(config, name, host, region, ps4, creds))
    async_add_entities(device_list, update_before_add=True)


# Traceback (AttributeError)
Error while setting up platform ps4
Traceback (most recent call last):
File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 146, in _async_setup_platform
await asyncio.wait_for(asyncio.shield(task), SLOW_SETUP_MAX_WAIT)
File "/usr/local/lib/python3.7/asyncio/tasks.py", line 442, in wait_for
return fut.result()
File "/usr/src/homeassistant/homeassistant/components/ps4/media_player.py", line 66, in async_setup_platform
creds = config.data[CONF_TOKEN]
AttributeError: 'collections.OrderedDict' object has no attribute 'data'

# Fixed code
async def async_setup_platform(hass, config, async_add_entities, discovery_info=None):
    """Not Implemented."""
    pass
# Buggy code
def _fill_device_lists():
    for dev in devices.values():
        if isinstance(dev, SmartPlug):
            if dev.is_dimmable:  # Dimmers act as lights
                lights.append(dev)
            else:
                switches.append(dev)
        elif isinstance(dev, SmartBulb):
            lights.append(dev)
        else:
            _LOGGER.error("Unknown smart device type: %s", type(dev))


# Traceback (OSError)
2019-03-07 01:08:44 ERROR (MainThread) [homeassistant.config_entries] Error setting up entry TP-Link Smart Home for tplink
Traceback (most recent call last):
File "/usr/local/lib/python3.7/site-packages/pyHS100/smartdevice.py", line 116, in _query_helper
request=request,
File "/usr/local/lib/python3.7/site-packages/pyHS100/protocol.py", line 47, in query
sock = socket.create_connection((host, port), timeout)
File "/usr/local/lib/python3.7/socket.py", line 727, in create_connection
raise err
File "/usr/local/lib/python3.7/socket.py", line 716, in create_connection
sock.connect(sa)
OSError: [Errno 113] No route to host
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File "/usr/src/app/homeassistant/config_entries.py", line 283, in async_setup
result = await component.async_setup_entry(hass, self)
File "/usr/src/app/homeassistant/components/tplink/__init__.py", line 120, in async_setup_entry
await hass.async_add_executor_job(_fill_device_lists)
File "/usr/local/lib/python3.7/concurrent/futures/thread.py", line 57, in run
result = self.fn(*self.args, **self.kwargs)
File "/usr/src/app/homeassistant/components/tplink/__init__.py", line 110, in _fill_device_lists
if dev.is_dimmable:  # Dimmers act as lights
File "/usr/local/lib/python3.7/site-packages/pyHS100/smartplug.py", line 131, in is_dimmable
return "brightness" in self.sys_info
File "/usr/local/lib/python3.7/site-packages/pyHS100/smartdevice.py", line 185, in sys_info
return defaultdict(lambda: None, self.get_sysinfo())
File "/usr/local/lib/python3.7/site-packages/pyHS100/smartdevice.py", line 195, in get_sysinfo
return self._query_helper("system", "get_sysinfo")
File "/usr/local/lib/python3.7/site-packages/pyHS100/smartdevice.py", line 119, in _query_helper
raise SmartDeviceException('Communication error') from ex
pyHS100.smartdevice.SmartDeviceException: Communication error

# Fixed code
def _fill_device_lists():
    for dev in devices.values():
        if isinstance(dev, SmartPlug):
            try:
                if dev.is_dimmable:  # Dimmers act as lights
                    lights.append(dev)
                else:
                    switches.append(dev)
            except SmartDeviceException as ex:
                _LOGGER.error("Unable to connect to device %s: %s", dev.host, ex)

        elif isinstance(dev, SmartBulb):
            lights.append(dev)
        else:
            _LOGGER.error("Unknown smart device type: %s", type(dev))
# Buggy code
def setup_platform(hass, config, add_entities, discovery_info=None):
    """Perform the setup for Xiaomi devices."""
    devices = []
    for _, gateway in hass.data[PY_XIAOMI_GATEWAY].gateways.items():
        for device in gateway.devices["cover"]:
            model = device["model"]
            if model == "curtain":
                devices.append(
                    XiaomiGenericCover(
                        device,
                        "Curtain",
                        {"status": "status", "pos": "curtain_level"},
                        gateway,
                    )
                )
    add_entities(devices)


# Traceback (miio.device.DeviceException)
2018-03-29 03:47:13 ERROR (Thread-7) [miio.device] Unable to discover a device at address 192.168.10.213
2018-03-29 03:47:13 ERROR (MainThread) [homeassistant.components.fan] Error while setting up platform smart_mi_fan
Traceback (most recent call last):
File "/srv/homeassistant/lib/python3.5/site-packages/homeassistant/helpers/entity_platform.py", line 82, in async_setup
SLOW_SETUP_MAX_WAIT, loop=hass.loop)
File "/usr/lib/python3.5/asyncio/tasks.py", line 400, in wait_for
return fut.result()
File "/usr/lib/python3.5/asyncio/futures.py", line 293, in result
raise self._exception
File "/usr/lib/python3.5/concurrent/futures/thread.py", line 55, in run
result = self.fn(*self.args, **self.kwargs)
File "/home/homeassistant/.homeassistant/custom_components/fan/smart_mi_fan.py", line 77, in setup_platform
SmartMiFan(hass, name, host, token),
File "/home/homeassistant/.homeassistant/custom_components/fan/smart_mi_fan.py", line 165, in __init__
self._state_attrs = self.fan_get_prop()
File "/home/homeassistant/.homeassistant/custom_components/fan/smart_mi_fan.py", line 404, in fan_get_prop
"natural_level", "child_lock", "buzzer", "led_b"])
File "/srv/homeassistant/lib/python3.5/site-packages/miio/device.py", line 210, in send
self.do_discover()
File "/srv/homeassistant/lib/python3.5/site-packages/miio/device.py", line 148, in do_discover
raise DeviceException("Unable to discover the device %s" % self.ip)
miio.device.DeviceException: Unable to discover the device 192.168.10.213

# Fixed code
def setup_platform(hass, config, add_entities, discovery_info=None):
    """Perform the setup for Xiaomi devices."""
    devices = []
    for _, gateway in hass.data[PY_XIAOMI_GATEWAY].gateways.items():
        for device in gateway.devices["cover"]:
            model = device["model"]
            if model == "curtain":
                devices.append(XiaomiGenericCover(device, "Curtain", "status", gateway))
    add_entities(devices)
# Buggy code
def close_cover(self, **kwargs):
    """Close the cover."""
    self._write_to_hub(self._sid, **{self._data_key["status"]: "close"})


# Traceback (miio.device.DeviceException)
2018-03-29 03:47:13 ERROR (Thread-7) [miio.device] Unable to discover a device at address 192.168.10.213
2018-03-29 03:47:13 ERROR (MainThread) [homeassistant.components.fan] Error while setting up platform smart_mi_fan
Traceback (most recent call last):
File "/srv/homeassistant/lib/python3.5/site-packages/homeassistant/helpers/entity_platform.py", line 82, in async_setup
SLOW_SETUP_MAX_WAIT, loop=hass.loop)
File "/usr/lib/python3.5/asyncio/tasks.py", line 400, in wait_for
return fut.result()
File "/usr/lib/python3.5/asyncio/futures.py", line 293, in result
raise self._exception
File "/usr/lib/python3.5/concurrent/futures/thread.py", line 55, in run
result = self.fn(*self.args, **self.kwargs)
File "/home/homeassistant/.homeassistant/custom_components/fan/smart_mi_fan.py", line 77, in setup_platform
SmartMiFan(hass, name, host, token),
File "/home/homeassistant/.homeassistant/custom_components/fan/smart_mi_fan.py", line 165, in __init__
self._state_attrs = self.fan_get_prop()
File "/home/homeassistant/.homeassistant/custom_components/fan/smart_mi_fan.py", line 404, in fan_get_prop
"natural_level", "child_lock", "buzzer", "led_b"])
File "/srv/homeassistant/lib/python3.5/site-packages/miio/device.py", line 210, in send
self.do_discover()
File "/srv/homeassistant/lib/python3.5/site-packages/miio/device.py", line 148, in do_discover
raise DeviceException("Unable to discover the device %s" % self.ip)
miio.device.DeviceException: Unable to discover the device 192.168.10.213

# Fixed code
def close_cover(self, **kwargs):
    """Close the cover."""
    self._write_to_hub(self._sid, **{self._data_key: "close"})
# Buggy code
def open_cover(self, **kwargs):
    """Open the cover."""
    self._write_to_hub(self._sid, **{self._data_key["status"]: "open"})


# Traceback (miio.device.DeviceException)
2018-03-29 03:47:13 ERROR (Thread-7) [miio.device] Unable to discover a device at address 192.168.10.213
2018-03-29 03:47:13 ERROR (MainThread) [homeassistant.components.fan] Error while setting up platform smart_mi_fan
Traceback (most recent call last):
File "/srv/homeassistant/lib/python3.5/site-packages/homeassistant/helpers/entity_platform.py", line 82, in async_setup
SLOW_SETUP_MAX_WAIT, loop=hass.loop)
File "/usr/lib/python3.5/asyncio/tasks.py", line 400, in wait_for
return fut.result()
File "/usr/lib/python3.5/asyncio/futures.py", line 293, in result
raise self._exception
File "/usr/lib/python3.5/concurrent/futures/thread.py", line 55, in run
result = self.fn(*self.args, **self.kwargs)
File "/home/homeassistant/.homeassistant/custom_components/fan/smart_mi_fan.py", line 77, in setup_platform
SmartMiFan(hass, name, host, token),
File "/home/homeassistant/.homeassistant/custom_components/fan/smart_mi_fan.py", line 165, in __init__
self._state_attrs = self.fan_get_prop()
File "/home/homeassistant/.homeassistant/custom_components/fan/smart_mi_fan.py", line 404, in fan_get_prop
"natural_level", "child_lock", "buzzer", "led_b"])
File "/srv/homeassistant/lib/python3.5/site-packages/miio/device.py", line 210, in send
self.do_discover()
File "/srv/homeassistant/lib/python3.5/site-packages/miio/device.py", line 148, in do_discover
raise DeviceException("Unable to discover the device %s" % self.ip)
miio.device.DeviceException: Unable to discover the device 192.168.10.213

# Fixed code
def open_cover(self, **kwargs):
    """Open the cover."""
    self._write_to_hub(self._sid, **{self._data_key: "open"})
# Buggy code
def stop_cover(self, **kwargs):
    """Stop the cover."""
    self._write_to_hub(self._sid, **{self._data_key["status"]: "stop"})


# Traceback (miio.device.DeviceException)
2018-03-29 03:47:13 ERROR (Thread-7) [miio.device] Unable to discover a device at address 192.168.10.213
2018-03-29 03:47:13 ERROR (MainThread) [homeassistant.components.fan] Error while setting up platform smart_mi_fan
Traceback (most recent call last):
File "/srv/homeassistant/lib/python3.5/site-packages/homeassistant/helpers/entity_platform.py", line 82, in async_setup
SLOW_SETUP_MAX_WAIT, loop=hass.loop)
File "/usr/lib/python3.5/asyncio/tasks.py", line 400, in wait_for
return fut.result()
File "/usr/lib/python3.5/asyncio/futures.py", line 293, in result
raise self._exception
File "/usr/lib/python3.5/concurrent/futures/thread.py", line 55, in run
result = self.fn(*self.args, **self.kwargs)
File "/home/homeassistant/.homeassistant/custom_components/fan/smart_mi_fan.py", line 77, in setup_platform
SmartMiFan(hass, name, host, token),
File "/home/homeassistant/.homeassistant/custom_components/fan/smart_mi_fan.py", line 165, in __init__
self._state_attrs = self.fan_get_prop()
File "/home/homeassistant/.homeassistant/custom_components/fan/smart_mi_fan.py", line 404, in fan_get_prop
"natural_level", "child_lock", "buzzer", "led_b"])
File "/srv/homeassistant/lib/python3.5/site-packages/miio/device.py", line 210, in send
self.do_discover()
File "/srv/homeassistant/lib/python3.5/site-packages/miio/device.py", line 148, in do_discover
raise DeviceException("Unable to discover the device %s" % self.ip)
miio.device.DeviceException: Unable to discover the device 192.168.10.213

# Fixed code
def stop_cover(self, **kwargs):
    """Stop the cover."""
    self._write_to_hub(self._sid, **{self._data_key: "stop"})
# Buggy code
def set_cover_position(self, **kwargs):
    """Move the cover to a specific position."""
    position = kwargs.get(ATTR_POSITION)
    self._write_to_hub(self._sid, **{self._data_key["pos"]: str(position)})


# Traceback (miio.device.DeviceException)
2018-03-29 03:47:13 ERROR (Thread-7) [miio.device] Unable to discover a device at address 192.168.10.213
2018-03-29 03:47:13 ERROR (MainThread) [homeassistant.components.fan] Error while setting up platform smart_mi_fan
Traceback (most recent call last):
File "/srv/homeassistant/lib/python3.5/site-packages/homeassistant/helpers/entity_platform.py", line 82, in async_setup
SLOW_SETUP_MAX_WAIT, loop=hass.loop)
File "/usr/lib/python3.5/asyncio/tasks.py", line 400, in wait_for
return fut.result()
File "/usr/lib/python3.5/asyncio/futures.py", line 293, in result
raise self._exception
File "/usr/lib/python3.5/concurrent/futures/thread.py", line 55, in run
result = self.fn(*self.args, **self.kwargs)
File "/home/homeassistant/.homeassistant/custom_components/fan/smart_mi_fan.py", line 77, in setup_platform
SmartMiFan(hass, name, host, token),
File "/home/homeassistant/.homeassistant/custom_components/fan/smart_mi_fan.py", line 165, in __init__
self._state_attrs = self.fan_get_prop()
File "/home/homeassistant/.homeassistant/custom_components/fan/smart_mi_fan.py", line 404, in fan_get_prop
"natural_level", "child_lock", "buzzer", "led_b"])
File "/srv/homeassistant/lib/python3.5/site-packages/miio/device.py", line 210, in send
self.do_discover()
File "/srv/homeassistant/lib/python3.5/site-packages/miio/device.py", line 148, in do_discover
raise DeviceException("Unable to discover the device %s" % self.ip)
miio.device.DeviceException: Unable to discover the device 192.168.10.213

# Fixed code
def set_cover_position(self, **kwargs):
    """Move the cover to a specific position."""
    position = kwargs.get(ATTR_POSITION)
    self._write_to_hub(self._sid, **{ATTR_CURTAIN_LEVEL: str(position)})
# Buggy code
async def cors_startup(app):
    """Initialize cors when app starts up."""
    cors_added = set()

    for route in list(app.router.routes()):
        if hasattr(route, "resource"):
            route = route.resource
        if route in cors_added:
            continue
        cors.add(route)
        cors_added.add(route)


# Traceback (ValueError)
2018-07-24 20:02:02 ERROR (MainThread) [homeassistant.core] Error doing job: Task exception was never retrieved
Traceback (most recent call last):
File "/usr/src/app/homeassistant/components/http/__init__.py", line 132, in start_server
await server.start()
File "/usr/src/app/homeassistant/components/http/__init__.py", line 284, in start
await self.app.startup()
File "/usr/local/lib/python3.6/site-packages/aiohttp/web_app.py", line 278, in startup
await self.on_startup.send(self)
File "/usr/local/lib/python3.6/site-packages/aiohttp/signals.py", line 35, in send
await receiver(*args, **kwargs)
File "/usr/src/app/homeassistant/components/http/cors.py", line 53, in cors_startup
cors.add(route)
File "/usr/local/lib/python3.6/site-packages/aiohttp_cors/cors_config.py", line 263, in add
return self._cors_impl.add(routing_entity, config)
File "/usr/local/lib/python3.6/site-packages/aiohttp_cors/cors_config.py", line 137, in add
routing_entity, parsed_config)
File "/usr/local/lib/python3.6/site-packages/aiohttp_cors/urldispatcher_router_adapter.py", line 240, in set_config_for_routing_entity
resource))
ValueError: CORS is already configured for <PlainResource  /auth/token> resource.

# Fixed code
async def cors_startup(app):
    """Initialize cors when app starts up."""
    for route in list(app.router.routes()):
        _allow_cors(route)
# Buggy code
def register(self, app, router):
    """Register the view with a router."""
    assert self.url is not None, "No url set for view"
    urls = [self.url] + self.extra_urls
    routes = []

    for method in ("get", "post", "delete", "put"):
        handler = getattr(self, method, None)

        if not handler:
            continue

        handler = request_handler_factory(self, handler)

        for url in urls:
            routes.append((method, router.add_route(method, url, handler)))

    if not self.cors_allowed:
        return

    for method, route in routes:
        app["allow_cors"](route, [method.upper()])


# Traceback (ValueError)
2018-07-24 20:02:02 ERROR (MainThread) [homeassistant.core] Error doing job: Task exception was never retrieved
Traceback (most recent call last):
File "/usr/src/app/homeassistant/components/http/__init__.py", line 132, in start_server
await server.start()
File "/usr/src/app/homeassistant/components/http/__init__.py", line 284, in start
await self.app.startup()
File "/usr/local/lib/python3.6/site-packages/aiohttp/web_app.py", line 278, in startup
await self.on_startup.send(self)
File "/usr/local/lib/python3.6/site-packages/aiohttp/signals.py", line 35, in send
await receiver(*args, **kwargs)
File "/usr/src/app/homeassistant/components/http/cors.py", line 53, in cors_startup
cors.add(route)
File "/usr/local/lib/python3.6/site-packages/aiohttp_cors/cors_config.py", line 263, in add
return self._cors_impl.add(routing_entity, config)
File "/usr/local/lib/python3.6/site-packages/aiohttp_cors/cors_config.py", line 137, in add
routing_entity, parsed_config)
File "/usr/local/lib/python3.6/site-packages/aiohttp_cors/urldispatcher_router_adapter.py", line 240, in set_config_for_routing_entity
resource))
ValueError: CORS is already configured for <PlainResource  /auth/token> resource.

# Fixed code
def register(self, app, router):
    """Register the view with a router."""
    assert self.url is not None, "No url set for view"
    urls = [self.url] + self.extra_urls
    routes = []

    for method in ("get", "post", "delete", "put"):
        handler = getattr(self, method, None)

        if not handler:
            continue

        handler = request_handler_factory(self, handler)

        for url in urls:
            routes.append(router.add_route(method, url, handler))

    if not self.cors_allowed:
        return

    for route in routes:
        app["allow_cors"](route)
# Buggy code
def update_as_of(self, utc_point_in_time):
    """Calculate sun state at a point in UTC time."""
    mod = -1
    while True:
        next_rising_dt = self.location.sunrise(
            utc_point_in_time + timedelta(days=mod), local=False
        )
        if next_rising_dt > utc_point_in_time:
            break
        mod += 1

    mod = -1
    while True:
        next_setting_dt = self.location.sunset(
            utc_point_in_time + timedelta(days=mod), local=False
        )
        if next_setting_dt > utc_point_in_time:
            break
        mod += 1

    self.next_rising = next_rising_dt
    self.next_setting = next_setting_dt


# Traceback (ValueError)
16-05-16 15:41:28 homeassistant.bootstrap: Error during setup of component sun
Traceback (most recent call last):
File "/home/vidar/.homeassistant/deps/astral.py", line 1464, in sunrise_utc
return self._calc_time(90 + 0.833, SUN_RISING, date, latitude, longitude)
File "/home/vidar/.homeassistant/deps/astral.py", line 2120, in _calc_time
hourangle = self._hour_angle(latitude, solarDec, depression)
File "/home/vidar/.homeassistant/deps/astral.py", line 2093, in _hour_angle
HA = acos(h)
ValueError: math domain error

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "/usr/local/lib/python3.4/dist-packages/homeassistant/bootstrap.py", line 157, in _setup_component
if not component.setup(hass, config):
File "/usr/local/lib/python3.4/dist-packages/homeassistant/components/sun.py", line 118, in setup
sun.point_in_time_listener(dt_util.utcnow())
File "/usr/local/lib/python3.4/dist-packages/homeassistant/components/sun.py", line 194, in point_in_time_listener
self.update_as_of(now)
File "/usr/local/lib/python3.4/dist-packages/homeassistant/components/sun.py", line 176, in update_as_of
utc_point_in_time + timedelta(days=mod), local=False)
File "/home/vidar/.homeassistant/deps/astral.py", line 769, in sunrise
sunrise = self.astral.sunrise_utc(date, self.latitude, self.longitude)
File "/home/vidar/.homeassistant/deps/astral.py", line 1466, in sunrise_utc
raise AstralError(('Sun remains below the horizon on this day, '
astral.AstralError: Sun remains below the horizon on this day, at this location.

# Fixed code
def update_as_of(self, utc_point_in_time):
    """Calculate sun state at a point in UTC time."""
    import astral

    mod = -1
    while True:
        try:
            next_rising_dt = self.location.sunrise(
                utc_point_in_time + timedelta(days=mod), local=False
            )
            if next_rising_dt > utc_point_in_time:
                break
        except astral.AstralError:
            pass
        mod += 1

    mod = -1
    while True:
        try:
            next_setting_dt = self.location.sunset(
                utc_point_in_time + timedelta(days=mod), local=False
            )
            if next_setting_dt > utc_point_in_time:
                break
        except astral.AstralError:
            pass
        mod += 1

    self.next_rising = next_rising_dt
    self.next_setting = next_setting_dt
# Buggy code
def detect_location_info():
    """Detect location information."""
    try:
        raw_info = requests.get("https://freegeoip.net/json/", timeout=5).json()
    except requests.RequestException:
        return

    data = {key: raw_info.get(key) for key in LocationInfo._fields}

    # From Wikipedia: Fahrenheit is used in the Bahamas, Belize,
    # the Cayman Islands, Palau, and the United States and associated
    # territories of American Samoa and the U.S. Virgin Islands
    data["use_fahrenheit"] = data["country_code"] in (
        "BS",
        "BZ",
        "KY",
        "PW",
        "US",
        "AS",
        "VI",
    )

    return LocationInfo(**data)


# Traceback (AttributeError)
C:\Users\fredr>py -m homeassistant --open-ui
Traceback (most recent call last):
File "", line 1, in
File "C:\Users\fredr\AppData\Local\Programs\Python\Python35\lib\multiprocessing\spawn.py", line 106, in spawn_main
exitcode = main(fd)
File "C:\Users\fredr\AppData\Local\Programs\Python\Python35\lib\multiprocessing\spawn.py", line 116, in main
self = pickle.load(from_parent)
AttributeError: Can't get attribute 'setup_and_run_hass' on <module '__main' (built-in)>

# Fixed code
def detect_location_info():
    """Detect location information."""
    try:
        raw_info = requests.get("https://freegeoip.net/json/", timeout=5).json()
    except (requests.RequestException, ValueError):
        return None

    data = {key: raw_info.get(key) for key in LocationInfo._fields}

    # From Wikipedia: Fahrenheit is used in the Bahamas, Belize,
    # the Cayman Islands, Palau, and the United States and associated
    # territories of American Samoa and the U.S. Virgin Islands
    data["use_fahrenheit"] = data["country_code"] in (
        "BS",
        "BZ",
        "KY",
        "PW",
        "US",
        "AS",
        "VI",
    )

    return LocationInfo(**data)
# Buggy code
def handle_receive(event):
    """Callback all subscribers for RFXtrx gateway."""

    # Log RFXCOM event
    entity_id = slugify(event.device.id_string.lower())
    packet_id = "".join("{0:02x}".format(x) for x in event.data)
    entity_name = "%s : %s" % (entity_id, packet_id)
    _LOGGER.info("Receive RFXCOM event from %s => %s", event.device, entity_name)

    # Callback to HA registered components
    for subscriber in RECEIVED_EVT_SUBSCRIBERS:
        subscriber(event)


# Traceback (KeyError)
INFO:homeassistant.components.rfxtrx:Receive RFXCOM event from <class 'RFXtrx.LightingDevice'> type='LightwaveRF, Siemens' id='f11043:16' => f1104316 : 0a140005f1104310050050
INFO:homeassistant.components.switch.rfxtrx:Automatic add f1104316 rfxtrx.switch (Class: LightingDevice Sub: 0)
INFO:homeassistant.core:Bus:Handling <Event state_changed[L]: new_state=<state switch.f1104316__0a140005f1104310050050=off; friendly_name=f1104316 : 0a140005f1104310050050 @ 20:34:47 03-02-2016>, entity_id=switch.f1104316__0a140005f1104310050050>
INFO:homeassistant.core:Bus:Handling <Event state_changed[L]: new_state=<state group.all_switches=off; hidden=True, order=0, entity_id=('switch.f1104316__0a140005f1104310050050',), auto=True, friendly_name=all switches @ 20:34:47 03-02-2016>, entity_id=group.all_switches>
Traceback (most recent call last):
File "/usr/local/lib/python3.4/threading.py", line 911, in _bootstrap_inner
self.run()
File "/usr/local/lib/python3.4/threading.py", line 859, in run
self._target(*self._args, **self._kwargs)
File "/usr/local/lib/python3.4/site-packages/RFXtrx/__init__.py", line 55, in _connect
self._event_callback(event)
File "/usr/src/app/homeassistant/components/rfxtrx.py", line 48, in handle_receive
subscriber(event)
File "/usr/src/app/homeassistant/components/switch/rfxtrx.py", line 81, in switch_update
event.values['Command']
KeyError: 'Command'

# Fixed code
def handle_receive(event):
    """Callback all subscribers for RFXtrx gateway."""

    # Log RFXCOM event
    if not event.device.id_string:
        return
    entity_id = slugify(event.device.id_string.lower())
    packet_id = "".join("{0:02x}".format(x) for x in event.data)
    entity_name = "%s : %s" % (entity_id, packet_id)
    _LOGGER.info("Receive RFXCOM event from %s => %s", event.device, entity_name)

    # Callback to HA registered components
    for subscriber in RECEIVED_EVT_SUBSCRIBERS:
        subscriber(event)
# Buggy code
def run(self):
    """Do nothing so the command intentionally fails."""
    pass


# Traceback (IndexError)
Building wheels for collected packages: qiskit
Building wheel for qiskit (setup.py) ... done
Exception:
Traceback (most recent call last):
File "/home/ima/envs/test/lib/python3.6/site-packages/pip/_internal/cli/base_command.py", line 179, in main
status = self.run(options, args)
File "/home/ima/envs/test/lib/python3.6/site-packages/pip/_internal/commands/install.py", line 355, in run
session=session, autobuilding=True
File "/home/ima/envs/test/lib/python3.6/site-packages/pip/_internal/wheel.py", line 980, in build
python_tag=python_tag,
File "/home/ima/envs/test/lib/python3.6/site-packages/pip/_internal/wheel.py", line 813, in _build_one
python_tag=python_tag)
File "/home/ima/envs/test/lib/python3.6/site-packages/pip/_internal/wheel.py", line 821, in _build_one_inside_env
wheel_path = builder(req, temp_dir.path, python_tag=python_tag)
File "/home/ima/envs/test/lib/python3.6/site-packages/pip/_internal/wheel.py", line 898, in _build_one_legacy
return os.path.join(tempd, sorted(os.listdir(tempd))[0])
IndexError: list index out of range

# Fixed code
def run(self):
    """Intentionally terminating the process with an error code."""
    sys.exit(-1)
# Buggy code
async def write(self, uuid):
    p = f"{self.path}/{uuid}.{self.count[uuid]}"
    async with AIOFile(p, mode="a") as fp:
        r = await fp.write("\n".join(self.data[uuid]) + "\n", offset=self.pointer[uuid])
        self.pointer[uuid] += len(r)
        self.data[uuid] = []

    if self.pointer[uuid] >= self.rotate:
        self.count[uuid] += 1
        self.pointer[uuid] = 0


# Traceback (TypeError)
2020-08-23 14:18:45,985 : ERROR : COINBASE: encountered an exception, reconnecting
Traceback (most recent call last):
File "/home/g/.local/lib/python3.8/site-packages/cryptofeed/feedhandler.py", line 211, in _connect
await self._handler(websocket, feed.message_handler, feed.uuid)
File "/home/g/.local/lib/python3.8/site-packages/cryptofeed/feedhandler.py", line 231, in _handler
await self.raw_message_capture(message, self.last_msg[feed_id], feed_id)
File "/home/g/.local/lib/python3.8/site-packages/cryptofeed/util/async_file.py", line 42, in __call__
await self.write(uuid)
File "/home/g/.local/lib/python3.8/site-packages/cryptofeed/util/async_file.py", line 32, in write
self.pointer[uuid] += len(r)
TypeError: object of type 'int' has no len()

# Fixed code
async def write(self, uuid):
    p = f"{self.path}/{uuid}.{self.count[uuid]}"
    async with AIOFile(p, mode="a") as fp:
        r = await fp.write("\n".join(self.data[uuid]) + "\n", offset=self.pointer[uuid])
        self.pointer[uuid] += r
        self.data[uuid] = []

    if self.pointer[uuid] >= self.rotate:
        self.count[uuid] += 1
        self.pointer[uuid] = 0
# Buggy code
def ignore_function(method=None, tracer=None):
    if not tracer:
        tracer = get_tracer()

    def inner(func):
        @functools.wraps(func)
        def ignore_wrapper(*args, **kwargs):
            tracer.pause()
            ret = func(*args, **kwargs)
            tracer.resume()
            return ret

        return ignore_wrapper

    if method:
        return inner(method)
    return inner


# Traceback (AttributeError)
Traceback (most recent call last):
File "C:/Users/PycharmProjects/oneway_test/test.py", line 12, in <module>
f()
File "D:\virtual\Envs\venv37\lib\site-packages\viztracer\decorator.py", line 17, in ignore_wrapper
tracer.pause()
AttributeError: 'NoneType' object has no attribute 'pause'

# Fixed code
def ignore_function(method=None, tracer=None):
    def inner(func):
        @functools.wraps(func)
        def ignore_wrapper(*args, **kwargs):
            # We need this to keep trace a local variable
            t = tracer
            if not t:
                t = get_tracer()
                if not t:
                    raise NameError("ignore_function only works with global tracer")
            t.pause()
            ret = func(*args, **kwargs)
            t.resume()
            return ret

        return ignore_wrapper

    if method:
        return inner(method)
    return inner
# Buggy code
def inner(func):
    @functools.wraps(func)
    def ignore_wrapper(*args, **kwargs):
        tracer.pause()
        ret = func(*args, **kwargs)
        tracer.resume()
        return ret

    return ignore_wrapper


# Traceback (AttributeError)
Traceback (most recent call last):
File "C:/Users/PycharmProjects/oneway_test/test.py", line 12, in <module>
f()
File "D:\virtual\Envs\venv37\lib\site-packages\viztracer\decorator.py", line 17, in ignore_wrapper
tracer.pause()
AttributeError: 'NoneType' object has no attribute 'pause'

# Fixed code
def inner(func):
    @functools.wraps(func)
    def ignore_wrapper(*args, **kwargs):
        # We need this to keep trace a local variable
        t = tracer
        if not t:
            t = get_tracer()
            if not t:
                raise NameError("ignore_function only works with global tracer")
        t.pause()
        ret = func(*args, **kwargs)
        t.resume()
        return ret

    return ignore_wrapper