mirror of
https://github.com/home-assistant/core.git
synced 2025-07-23 21:27:38 +00:00
Move dominos imports at top-level (#29090)
This commit is contained in:
parent
c84590b18c
commit
9a388e2dd2
@ -2,6 +2,8 @@
|
|||||||
from datetime import timedelta
|
from datetime import timedelta
|
||||||
import logging
|
import logging
|
||||||
|
|
||||||
|
from pizzapi import Address, Customer, Order
|
||||||
|
from pizzapi.address import StoreException
|
||||||
import voluptuous as vol
|
import voluptuous as vol
|
||||||
|
|
||||||
from homeassistant.components import http
|
from homeassistant.components import http
|
||||||
@ -91,8 +93,6 @@ class Dominos:
|
|||||||
def __init__(self, hass, config):
|
def __init__(self, hass, config):
|
||||||
"""Set up main service."""
|
"""Set up main service."""
|
||||||
conf = config[DOMAIN]
|
conf = config[DOMAIN]
|
||||||
from pizzapi import Address, Customer
|
|
||||||
from pizzapi.address import StoreException
|
|
||||||
|
|
||||||
self.hass = hass
|
self.hass = hass
|
||||||
self.customer = Customer(
|
self.customer = Customer(
|
||||||
@ -127,8 +127,6 @@ class Dominos:
|
|||||||
@Throttle(MIN_TIME_BETWEEN_STORE_UPDATES)
|
@Throttle(MIN_TIME_BETWEEN_STORE_UPDATES)
|
||||||
def update_closest_store(self):
|
def update_closest_store(self):
|
||||||
"""Update the shared closest store (if open)."""
|
"""Update the shared closest store (if open)."""
|
||||||
from pizzapi.address import StoreException
|
|
||||||
|
|
||||||
try:
|
try:
|
||||||
self.closest_store = self.address.closest_store()
|
self.closest_store = self.address.closest_store()
|
||||||
return True
|
return True
|
||||||
@ -209,8 +207,6 @@ class DominosOrder(Entity):
|
|||||||
@Throttle(MIN_TIME_BETWEEN_UPDATES)
|
@Throttle(MIN_TIME_BETWEEN_UPDATES)
|
||||||
def update(self):
|
def update(self):
|
||||||
"""Update the order state and refreshes the store."""
|
"""Update the order state and refreshes the store."""
|
||||||
from pizzapi.address import StoreException
|
|
||||||
|
|
||||||
try:
|
try:
|
||||||
self.dominos.update_closest_store()
|
self.dominos.update_closest_store()
|
||||||
except StoreException:
|
except StoreException:
|
||||||
@ -226,9 +222,6 @@ class DominosOrder(Entity):
|
|||||||
|
|
||||||
def order(self):
|
def order(self):
|
||||||
"""Create the order object."""
|
"""Create the order object."""
|
||||||
from pizzapi import Order
|
|
||||||
from pizzapi.address import StoreException
|
|
||||||
|
|
||||||
if self.dominos.closest_store is None:
|
if self.dominos.closest_store is None:
|
||||||
raise StoreException
|
raise StoreException
|
||||||
|
|
||||||
@ -246,8 +239,6 @@ class DominosOrder(Entity):
|
|||||||
|
|
||||||
def place(self):
|
def place(self):
|
||||||
"""Place the order."""
|
"""Place the order."""
|
||||||
from pizzapi.address import StoreException
|
|
||||||
|
|
||||||
try:
|
try:
|
||||||
order = self.order()
|
order = self.order()
|
||||||
order.place()
|
order.place()
|
||||||
|
Loading…
x
Reference in New Issue
Block a user