Skip to content

Commit

Permalink
Create requirements_format.txt
Browse files Browse the repository at this point in the history
  • Loading branch information
firstof9 authored and github-actions[bot] committed Dec 9, 2020
1 parent ad55b32 commit 0eb21a6
Show file tree
Hide file tree
Showing 11 changed files with 414 additions and 259 deletions.
11 changes: 6 additions & 5 deletions custom_components/mail_and_packages/__init__.py
Original file line number Diff line number Diff line change
@@ -1,12 +1,14 @@
"""Mail and Packages Integration."""
from . import const
from .helpers import process_emails, update_time
import async_timeout
import logging
from datetime import timedelta

import async_timeout
from homeassistant.const import CONF_HOST
from homeassistant.exceptions import ConfigEntryNotReady
from homeassistant.helpers.update_coordinator import DataUpdateCoordinator, UpdateFailed
import logging

from . import const
from .helpers import process_emails, update_time

_LOGGER = logging.getLogger(__name__)

Expand Down Expand Up @@ -80,4 +82,3 @@ async def update_listener(hass, config_entry):
hass.async_add_job(
hass.config_entries.async_forward_entry_setup(config_entry, const.PLATFORM)
)

38 changes: 20 additions & 18 deletions custom_components/mail_and_packages/config_flow.py
Original file line number Diff line number Diff line change
@@ -1,35 +1,37 @@
"""Adds config flow for Mail and Packages."""

import logging
from collections import OrderedDict

import homeassistant.helpers.config_validation as cv
from homeassistant.core import callback
import voluptuous as vol
from homeassistant import config_entries
from .helpers import get_resources, _check_ffmpeg, _test_login, _validate_path, login
from homeassistant.const import (
CONF_HOST,
CONF_PASSWORD,
CONF_PORT,
CONF_RESOURCES,
CONF_USERNAME,
)
from homeassistant.core import callback

from .const import (
CONF_AMAZON_FWDS,
CONF_DURATION,
CONF_SCAN_INTERVAL,
CONF_FOLDER,
CONF_PATH,
CONF_IMAGE_SECURITY,
CONF_GENERATE_MP4,
DOMAIN,
DEFAULT_PORT,
DEFAULT_PATH,
CONF_IMAGE_SECURITY,
CONF_PATH,
CONF_SCAN_INTERVAL,
DEFAULT_FOLDER,
DEFAULT_IMAGE_SECURITY,
DEFAULT_GIF_DURATION,
DEFAULT_IMAGE_SECURITY,
DEFAULT_PATH,
DEFAULT_PORT,
DEFAULT_SCAN_INTERVAL,
DOMAIN,
)
from homeassistant.const import (
CONF_HOST,
CONF_PASSWORD,
CONF_USERNAME,
CONF_PORT,
CONF_RESOURCES,
)
import logging
import voluptuous as vol
from .helpers import _check_ffmpeg, _test_login, _validate_path, get_resources, login

_LOGGER = logging.getLogger(__name__)

Expand Down
40 changes: 23 additions & 17 deletions custom_components/mail_and_packages/helpers.py
Original file line number Diff line number Diff line change
@@ -1,28 +1,29 @@
""" Functions for Mail and Packages """

from . import const
import aiohttp
import datetime
import email
from homeassistant.const import (
CONF_HOST,
CONF_PORT,
CONF_USERNAME,
CONF_PASSWORD,
CONF_RESOURCES,
)
import imageio as io
import imaplib
import logging
import os
from PIL import Image
import quopri
import re
from resizeimage import resizeimage
from shutil import copyfile, which
import subprocess
import uuid
from shutil import copyfile, which

import aiohttp
import imageio as io
from homeassistant.const import (
CONF_HOST,
CONF_PASSWORD,
CONF_PORT,
CONF_RESOURCES,
CONF_USERNAME,
)
from PIL import Image
from resizeimage import resizeimage

from . import const

_LOGGER = logging.getLogger(__name__)

Expand Down Expand Up @@ -117,7 +118,11 @@ def process_emails(hass, config):
count = {}
if sensor == "usps_mail":
count[sensor] = get_mails(
account, img_out_path, gif_duration, image_name, generate_mp4,
account,
img_out_path,
gif_duration,
image_name,
generate_mp4,
)
elif sensor == const.AMAZON_PACKAGES:
count[sensor] = get_items(account, const.ATTR_COUNT, amazon_fwds)
Expand Down Expand Up @@ -221,7 +226,7 @@ def update_time():


def email_search(account, address, date, subject=None):
""" Search emails with from, subject, senton date.
"""Search emails with from, subject, senton date.
Returns a tuple
"""
Expand Down Expand Up @@ -252,7 +257,7 @@ def email_search(account, address, date, subject=None):


def email_fetch(account, num, type="(RFC822)"):
""" Download specified email for parsing.
"""Download specified email for parsing.
Returns tuple
"""
Expand Down Expand Up @@ -474,7 +479,8 @@ def copy_overlays(path):
for file in overlays:
_LOGGER.debug("Copying file to: %s", str(path + file))
copyfile(
os.path.dirname(__file__) + "/" + file, path + file,
os.path.dirname(__file__) + "/" + file,
path + file,
)


Expand Down
10 changes: 6 additions & 4 deletions custom_components/mail_and_packages/sensor.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,14 @@
Configuration code contribution from @firstof9 https://github.com/firstof9/
"""
from . import const
from homeassistant.helpers.entity import Entity
from homeassistant.const import CONF_RESOURCES, CONF_HOST
from homeassistant.core import callback
import logging

from homeassistant.const import CONF_HOST, CONF_RESOURCES
from homeassistant.core import callback
from homeassistant.helpers.entity import Entity

from . import const

_LOGGER = logging.getLogger(__name__)


Expand Down
2 changes: 2 additions & 0 deletions requirements_format.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
black
isort
Loading

0 comments on commit 0eb21a6

Please sign in to comment.