"""
Much code from https://github.com/vsergeev/python-periphery/blob/master/periphery/gpio.py
Copyright (c) 2015-2019 vsergeev / Ivan (Vanya) A. Sergeev
"""
Much code from https://github.com/vsergeev/python-periphery/blob/master/periphery/gpio.py
Copyright (c) 2015-2019 vsergeev / Ivan (Vanya) A. Sergeev
# pylint: disable=unnecessary-pass
class GPIOError(IOError):
"""Base class for GPIO errors."""
# pylint: disable=unnecessary-pass
class GPIOError(IOError):
"""Base class for GPIO errors."""
- with open(os.path.join(gpio_path, "direction"), "w") as f_direction:
+ with open(
+ os.path.join(gpio_path, "direction"), "w", encoding="utf-8"
+ ) as f_direction:
- with open(os.path.join(gpio_path, "direction"), "w") as f_direction:
+ with open(
+ os.path.join(gpio_path, "direction"), "w", encoding="utf-8"
+ ) as f_direction:
label = f_label.read()
except (GPIOError, IOError) as e:
if isinstance(e, IOError):
label = f_label.read()
except (GPIOError, IOError) as e:
if isinstance(e, IOError):
- with open(os.path.join(self._path, "direction"), "r") as f_direction:
+ with open(
+ os.path.join(self._path, "direction"), "r", encoding="utf-8"
+ ) as f_direction:
- with open(os.path.join(self._path, "direction"), "w") as f_direction:
+ with open(
+ os.path.join(self._path, "direction"), "w", encoding="utf-8"
+ ) as f_direction: