6500cb791588e115a62712199c0cbed626af8f31,homeassistant/components/camera/rpi_camera.py,,setup_platform,#Any#Any#Any#Any#,64

Before Change



    hass.bus.listen_once(EVENT_HOMEASSISTANT_STOP, kill_raspistill)

    try:
        // Try to create an empty file (or open existing) to ensure we have
        // proper permissions.
        open(setup_config[CONF_FILE_PATH], "a").close()

        add_devices([RaspberryCamera(setup_config)])
    except PermissionError:
        _LOGGER.error("File path is not writable")
        return False
    except FileNotFoundError:
        _LOGGER.error("Could not create output file (missing directory?)")
        return False


class RaspberryCamera(Camera):
    Representation of a Raspberry Pi camera.

    def __init__(self, device_info):

After Change


    // If no file path is defined, use a temporary file
    if file_path is None:
        temp_file = NamedTemporaryFile(suffix=".jpg", delete=False)
        temp_file.close()
        file_path = temp_file.name
        setup_config[CONF_FILE_PATH] = file_path
        hass.bus.listen_once(EVENT_HOMEASSISTANT_STOP, delete_temp_file)
Italian Trulli
In pattern: SUPERPATTERN

Frequency: 3

Non-data size: 3

Instances


Project Name: home-assistant/home-assistant
Commit Name: 6500cb791588e115a62712199c0cbed626af8f31
Time: 2018-02-13
Author: frederik.bolding@gmail.com
File Name: homeassistant/components/camera/rpi_camera.py
Class Name:
Method Name: setup_platform


Project Name: ilastik/ilastik
Commit Name: c1eb48be25f490a7653cc3fc60de483fc3ff09af
Time: 2019-11-22
Author: tomaz.vieira@embl.de
File Name: ilastik/shell/projectManager.py
Class Name: ProjectManager
Method Name: _importProject


Project Name: estnltk/estnltk
Commit Name: cf5f38373ec0a08518dae7051e53e44c316c166c
Time: 2015-07-28
Author: karl.valliste@gmail.com
File Name: estnltk/prettyprinter/prettyprinter.py
Class Name: PrettyPrinter
Method Name: render