Skip to content

Commit

Permalink
Revert "Optimize imports"
Browse files Browse the repository at this point in the history
This reverts commit 91dc4d7.
  • Loading branch information
syssi committed Apr 1, 2018
1 parent dab234e commit f5547d7
Show file tree
Hide file tree
Showing 39 changed files with 121 additions and 177 deletions.
28 changes: 14 additions & 14 deletions miio/__init__.py
Original file line number Diff line number Diff line change
@@ -1,22 +1,22 @@
# flake8: noqa
from miio.airconditioningcompanion import AirConditioningCompanion
from miio.airhumidifier import AirHumidifier
from miio.protocol import Message, Utils
from miio.vacuumcontainers import (VacuumStatus, ConsumableStatus, DNDStatus,
CleaningDetails, CleaningSummary, Timer)
from miio.vacuum import Vacuum, VacuumException
from miio.chuangmi_plug import (Plug, PlugV1, PlugV3, ChuangmiPlug)
from miio.airpurifier import AirPurifier
from miio.airqualitymonitor import AirQualityMonitor
from miio.airhumidifier import AirHumidifier
from miio.waterpurifier import WaterPurifier
from miio.powerstrip import PowerStrip
from miio.ceil import Ceil
from miio.chuangmi_ir import ChuangmiIr
from miio.chuangmi_plug import (Plug, PlugV1, PlugV3, ChuangmiPlug)
from miio.device import Device, DeviceException
from miio.fan import Fan
from miio.philips_bulb import PhilipsBulb
from miio.philips_eyecare import PhilipsEyecare
from miio.powerstrip import PowerStrip
from miio.protocol import Message, Utils
from miio.vacuum import Vacuum, VacuumException
from miio.vacuumcontainers import (VacuumStatus, ConsumableStatus, DNDStatus,
CleaningDetails, CleaningSummary, Timer, )
from miio.waterpurifier import WaterPurifier
from miio.wifirepeater import WifiRepeater
from miio.chuangmi_ir import ChuangmiIr
from miio.fan import Fan
from miio.wifispeaker import WifiSpeaker
from miio.wifirepeater import WifiRepeater
from miio.airqualitymonitor import AirQualityMonitor
from miio.airconditioningcompanion import AirConditioningCompanion
from miio.yeelight import Yeelight
from miio.device import Device, DeviceException
from miio.discovery import Discovery
3 changes: 1 addition & 2 deletions miio/airconditioningcompanion.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
from .device import Device
import enum
from typing import Optional

from .device import Device


class OperationMode(enum.Enum):
Heat = 0
Expand Down
10 changes: 4 additions & 6 deletions miio/airhumidifier.py
Original file line number Diff line number Diff line change
@@ -1,12 +1,10 @@
import enum
import logging
from collections import defaultdict
from typing import Any, Dict, Optional

import enum
import click

from .click_common import command, format_output, EnumType
from typing import Any, Dict, Optional
from collections import defaultdict
from .device import Device, DeviceException
from .click_common import command, format_output, EnumType

_LOGGER = logging.getLogger(__name__)

Expand Down
8 changes: 3 additions & 5 deletions miio/airpurifier.py
Original file line number Diff line number Diff line change
@@ -1,13 +1,11 @@
import enum
import logging
import enum
import re
from collections import defaultdict
from typing import Any, Dict, Optional

from collections import defaultdict
import click

from .click_common import command, format_output, EnumType
from .device import Device, DeviceException
from .click_common import command, format_output, EnumType

_LOGGER = logging.getLogger(__name__)

Expand Down
3 changes: 1 addition & 2 deletions miio/airqualitymonitor.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
import logging
from collections import defaultdict

from .click_common import command, format_output
from .device import Device
from .click_common import command, format_output

_LOGGER = logging.getLogger(__name__)

Expand Down
8 changes: 3 additions & 5 deletions miio/ceil.py
Original file line number Diff line number Diff line change
@@ -1,11 +1,9 @@
import logging
from collections import defaultdict
from typing import Any, Dict

import click

from .click_common import command, format_output
from typing import Any, Dict
from collections import defaultdict
from .device import Device, DeviceException
from .click_common import command, format_output

_LOGGER = logging.getLogger(__name__)

Expand Down
9 changes: 4 additions & 5 deletions miio/ceil_cli.py
Original file line number Diff line number Diff line change
@@ -1,12 +1,11 @@
# -*- coding: UTF-8 -*-
import logging
import sys

import click

import miio # noqa: E402
import sys
from miio.click_common import (ExceptionHandlerGroup, validate_ip,
validate_token, )
validate_token)
import miio # noqa: E402


_LOGGER = logging.getLogger(__name__)
pass_dev = click.make_pass_decorator(miio.Ceil)
Expand Down
4 changes: 1 addition & 3 deletions miio/chuangmi_ir.py
Original file line number Diff line number Diff line change
@@ -1,14 +1,12 @@
import base64
import re

import click
from construct import (
Struct, Const, Rebuild, this, len_, Adapter, Computed,
Int16ul, Int32ul, Int16ub, Array, BitStruct, BitsInteger,
)

from .click_common import command, format_output
from .device import Device, DeviceException
from .click_common import command, format_output


class ChuangmiIrException(DeviceException):
Expand Down
8 changes: 3 additions & 5 deletions miio/chuangmi_plug.py
Original file line number Diff line number Diff line change
@@ -1,12 +1,10 @@
import logging
from collections import defaultdict
from typing import Dict, Any, Optional

import click

from .click_common import command, format_output
from typing import Dict, Any, Optional
from collections import defaultdict
from .device import Device
from .utils import deprecated
from .click_common import command, format_output

_LOGGER = logging.getLogger(__name__)

Expand Down
2 changes: 0 additions & 2 deletions miio/cli.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
# -*- coding: UTF-8 -*-
import logging

import click

from miio.click_common import (
ExceptionHandlerGroup, DeviceGroupMeta, GlobalContextObject,
json_output,
Expand Down
15 changes: 7 additions & 8 deletions miio/device.py
Original file line number Diff line number Diff line change
@@ -1,19 +1,18 @@
import binascii
import codecs
import datetime
import logging
import socket
from enum import Enum
from typing import Any, List, Optional # noqa: F401

import click
import logging
import construct
import binascii
import click
from typing import Any, List, Optional # noqa: F401
from enum import Enum

from .click_common import (
DeviceGroupMeta, command, format_output,
DeviceGroupMeta, command, format_output
)
from .exceptions import DeviceException, DeviceError
from .protocol import Message
from .exceptions import DeviceException, DeviceError

_LOGGER = logging.getLogger(__name__)

Expand Down
18 changes: 9 additions & 9 deletions miio/discovery.py
Original file line number Diff line number Diff line change
@@ -1,17 +1,17 @@
import codecs
import inspect
import ipaddress
import logging
from functools import partial
from typing import Union, Callable, Dict, Optional # noqa: F401

import zeroconf

import ipaddress
import inspect
import codecs
from . import (Device, Vacuum, ChuangmiPlug, PowerStrip, AirPurifier, Ceil,
PhilipsBulb, PhilipsEyecare, ChuangmiIr, AirHumidifier,
WaterPurifier, WifiSpeaker, WifiRepeater, Yeelight, )
WaterPurifier, WifiSpeaker, WifiRepeater, Yeelight)
from .chuangmi_plug import (MODEL_CHUANGMI_PLUG_V1, MODEL_CHUANGMI_PLUG_V3,
MODEL_CHUANGMI_PLUG_M1, )
MODEL_CHUANGMI_PLUG_M1)

from functools import partial
from typing import Union, Callable, Dict, Optional # noqa: F401


_LOGGER = logging.getLogger(__name__)

Expand Down
11 changes: 5 additions & 6 deletions miio/extract_tokens.py
Original file line number Diff line number Diff line change
@@ -1,14 +1,13 @@
import logging
import sqlite3
import click
import tempfile
import sqlite3
from cryptography.hazmat.primitives.ciphers import Cipher, algorithms, modes
from cryptography.hazmat.backends import default_backend
from pprint import pformat as pf
from typing import Iterator

import attr
import click
from android_backup import AndroidBackup
from cryptography.hazmat.backends import default_backend
from cryptography.hazmat.primitives.ciphers import Cipher, algorithms, modes
from typing import Iterator

logging.basicConfig(level=logging.INFO)
_LOGGER = logging.getLogger(__name__)
Expand Down
9 changes: 4 additions & 5 deletions miio/philips_eyecare_cli.py
Original file line number Diff line number Diff line change
@@ -1,12 +1,11 @@
# -*- coding: UTF-8 -*-
import logging
import sys

import click

import miio # noqa: E402
import sys
from miio.click_common import (ExceptionHandlerGroup, validate_ip,
validate_token, )
validate_token)
import miio # noqa: E402


_LOGGER = logging.getLogger(__name__)
pass_dev = click.make_pass_decorator(miio.PhilipsEyecare)
Expand Down
11 changes: 5 additions & 6 deletions miio/plug_cli.py
Original file line number Diff line number Diff line change
@@ -1,14 +1,13 @@
# -*- coding: UTF-8 -*-
import ast
import logging
import click
import ast
import sys
from typing import Any # noqa: F401

import click

import miio # noqa: E402
from miio.click_common import (ExceptionHandlerGroup, validate_ip,
validate_token, )
validate_token)
import miio # noqa: E402


_LOGGER = logging.getLogger(__name__)
pass_dev = click.make_pass_decorator(miio.Plug)
Expand Down
10 changes: 6 additions & 4 deletions miio/protocol.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,20 +10,22 @@
An usage example can be seen in the source of :func:`miio.Device.send`.
"""
import calendar
import datetime
import hashlib
import json
import logging
import calendar
from typing import Any, Dict, Tuple
from pprint import pprint as pp # noqa: F401

import construct
from construct import (Struct, Bytes, Const, Int16ub, Int32ub, GreedyBytes,
Adapter, Checksum, RawCopy, Rebuild, IfThenElse,
Default, Pointer, Hex, )
Default, Pointer, Hex, Probe)
import construct

from cryptography.hazmat.primitives.ciphers import Cipher, algorithms, modes
from cryptography.hazmat.backends import default_backend
from cryptography.hazmat.primitives import padding
from cryptography.hazmat.primitives.ciphers import Cipher, algorithms, modes

_LOGGER = logging.getLogger(__name__)

Expand Down
10 changes: 3 additions & 7 deletions miio/tests/test_airconditioningcompanion.py
Original file line number Diff line number Diff line change
@@ -1,13 +1,9 @@
import string
from unittest import TestCase

import pytest

from miio import AirConditioningCompanion
from miio.airconditioningcompanion import (OperationMode, FanSpeed, Power,
SwingMode, Led,
AirConditioningCompanionStatus,
STORAGE_SLOT_ID, )
from miio.airconditioningcompanion import (OperationMode, FanSpeed, Power, SwingMode, Led,
AirConditioningCompanionStatus, STORAGE_SLOT_ID, )
import pytest

STATE_ON = ['on']
STATE_OFF = ['off']
Expand Down
6 changes: 2 additions & 4 deletions miio/tests/test_airhumidifier.py
Original file line number Diff line number Diff line change
@@ -1,11 +1,9 @@
from unittest import TestCase

import pytest

from miio import AirHumidifier
from miio.airhumidifier import (OperationMode, LedBrightness,
AirHumidifierStatus, AirHumidifierException, )
AirHumidifierStatus, AirHumidifierException)
from .dummies import DummyDevice
import pytest


class DummyAirHumidifier(DummyDevice, AirHumidifier):
Expand Down
7 changes: 2 additions & 5 deletions miio/tests/test_airpurifier.py
Original file line number Diff line number Diff line change
@@ -1,12 +1,9 @@
from unittest import TestCase

import pytest

from miio import AirPurifier
from miio.airpurifier import (OperationMode, LedBrightness, FilterType,
SleepMode, AirPurifierStatus,
AirPurifierException, )
SleepMode, AirPurifierStatus, AirPurifierException)
from .dummies import DummyDevice
import pytest


class DummyAirPurifier(DummyDevice, AirPurifier):
Expand Down
4 changes: 1 addition & 3 deletions miio/tests/test_airqualitymonitor.py
Original file line number Diff line number Diff line change
@@ -1,10 +1,8 @@
from unittest import TestCase

import pytest

from miio import AirQualityMonitor
from miio.airqualitymonitor import AirQualityMonitorStatus
from .dummies import DummyDevice
import pytest


class DummyAirQualityMonitor(DummyDevice, AirQualityMonitor):
Expand Down
4 changes: 1 addition & 3 deletions miio/tests/test_ceil.py
Original file line number Diff line number Diff line change
@@ -1,10 +1,8 @@
from unittest import TestCase

import pytest

from miio import Ceil
from miio.ceil import CeilStatus, CeilException
from .dummies import DummyDevice
import pytest


class DummyCeil(DummyDevice, Ceil):
Expand Down
10 changes: 4 additions & 6 deletions miio/tests/test_chuangmi_ir.py
Original file line number Diff line number Diff line change
@@ -1,13 +1,11 @@
import base64
import json
import os
from unittest import TestCase

import pytest

from miio import ChuangmiIr
from miio.chuangmi_ir import ChuangmiIrException
from .dummies import DummyDevice
import pytest
import base64
import json
import os

with open(os.path.join(
os.path.dirname(__file__), 'test_chuangmi_ir.json')) as inp:
Expand Down
Loading

0 comments on commit f5547d7

Please sign in to comment.