mirror of
https://github.com/esphome/esphome.git
synced 2024-11-21 14:38:10 +01:00
Lint
This commit is contained in:
parent
9ea9b4b102
commit
1576e1847e
5 changed files with 12 additions and 20 deletions
|
@ -15,7 +15,8 @@ RUN platformio settings set enable_telemetry No && \
|
|||
platformio run -e espressif32 -e espressif8266; exit 0
|
||||
|
||||
COPY . .
|
||||
RUN pip install -e .
|
||||
RUN pip install -e . && \
|
||||
pip install pillow tzlocal
|
||||
|
||||
WORKDIR /config
|
||||
ENTRYPOINT ["esphomeyaml"]
|
||||
|
|
|
@ -27,6 +27,6 @@ RUN apt-get update && apt-get install -y \
|
|||
binfmt-support \
|
||||
&& rm -rf /var/lib/apt/lists/*
|
||||
|
||||
COPY hassio-builder.sh /usr/bin/
|
||||
COPY docker/hassio-builder.sh /usr/bin/
|
||||
|
||||
WORKDIR /data
|
||||
|
|
|
@ -1,4 +1,6 @@
|
|||
FROM python:2.7
|
||||
|
||||
RUN pip install -r requirements.txt && \
|
||||
pip install flake8==3.5.0 pylint==1.8.4
|
||||
COPY requirements.txt /requirements.txt
|
||||
|
||||
RUN pip install -r /requirements.txt && \
|
||||
pip install flake8==3.5.0 pylint==1.8.4 tzlocal pillow
|
||||
|
|
|
@ -46,7 +46,7 @@ def validate_pillow_installed(value):
|
|||
try:
|
||||
import PIL
|
||||
except ImportError:
|
||||
raise vol.Invalid("Please install the pillow python package to use fonts. "
|
||||
raise vol.Invalid("Please install the pillow python package to use this feature. "
|
||||
"(pip2 install pillow)")
|
||||
|
||||
if PIL.__version__[0] < '4':
|
||||
|
@ -103,7 +103,7 @@ def to_code(config):
|
|||
_, (offset_x, offset_y) = font.font.getsize(glyph)
|
||||
width, height = mask.size
|
||||
width8 = ((width + 7) // 8) * 8
|
||||
glyph_data = [0 for _ in range(height * width8 // 8)]
|
||||
glyph_data = [0 for _ in range(height * width8 // 8)] # noqa: F812
|
||||
for y in range(height):
|
||||
for x in range(width):
|
||||
if not mask.getpixel((x, y)):
|
||||
|
|
|
@ -6,7 +6,7 @@ import voluptuous as vol
|
|||
|
||||
import esphomeyaml.config_validation as cv
|
||||
from esphomeyaml import core
|
||||
from esphomeyaml.components import display
|
||||
from esphomeyaml.components import display, font
|
||||
from esphomeyaml.const import CONF_FILE, CONF_ID, CONF_RESIZE
|
||||
from esphomeyaml.core import HexInt
|
||||
from esphomeyaml.helpers import App, ArrayInitializer, MockObj, Pvariable, RawExpression, add
|
||||
|
@ -18,17 +18,6 @@ DEPENDENCIES = ['display']
|
|||
Image_ = display.display_ns.Image
|
||||
|
||||
|
||||
def validate_pillow_installed(value):
|
||||
try:
|
||||
# pylint: disable=unused-variable
|
||||
import PIL
|
||||
except ImportError:
|
||||
raise vol.Invalid("Please install the pillow python package to use images. "
|
||||
"(pip2 install pillow)")
|
||||
|
||||
return value
|
||||
|
||||
|
||||
def validate_image_file(value):
|
||||
value = cv.string(value)
|
||||
path = os.path.join(os.path.dirname(core.CONFIG_PATH), value)
|
||||
|
@ -39,14 +28,14 @@ def validate_image_file(value):
|
|||
|
||||
CONF_RAW_DATA_ID = 'raw_data_id'
|
||||
|
||||
FONT_SCHEMA = vol.Schema({
|
||||
IMAGE_SCHEMA = vol.Schema({
|
||||
vol.Required(CONF_ID): cv.declare_variable_id(Image_),
|
||||
vol.Required(CONF_FILE): validate_image_file,
|
||||
vol.Optional(CONF_RESIZE): cv.dimensions,
|
||||
cv.GenerateID(CONF_RAW_DATA_ID): cv.declare_variable_id(None),
|
||||
})
|
||||
|
||||
CONFIG_SCHEMA = vol.All(validate_pillow_installed, cv.ensure_list, [FONT_SCHEMA])
|
||||
CONFIG_SCHEMA = vol.All(font.validate_pillow_installed, cv.ensure_list, [IMAGE_SCHEMA])
|
||||
|
||||
|
||||
def to_code(config):
|
||||
|
|
Loading…
Reference in a new issue