Skip to content

Commit

Permalink
fix "TypeError: 'ABCMeta' object is not subscriptable" on python<3.9
Browse files Browse the repository at this point in the history
  • Loading branch information
fphammerle committed Feb 5, 2022
1 parent d9ed83a commit 878afa9
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 6 deletions.
3 changes: 1 addition & 2 deletions setup.py
Expand Up @@ -72,8 +72,7 @@
"Topic :: Home Automation",
],
entry_points={"console_scripts": ["switchbot-mqtt = switchbot_mqtt._cli:_main"]},
# >=3.6 variable type hints, f-strings, collections.abc.Collection
# & * to force keyword-only arguments
# >=3.6 variable type hints, f-strings, typing.Collection & * to force keyword-only arguments
# >=3.7 postponed evaluation of type annotations (PEP563) & dataclass
python_requires=">=3.7",
install_requires=[
Expand Down
3 changes: 1 addition & 2 deletions switchbot_mqtt/_actors/_base.py
Expand Up @@ -19,7 +19,6 @@
from __future__ import annotations # PEP563 (default in python>=3.10)

import abc
import collections.abc
import dataclasses
import logging
import queue
Expand Down Expand Up @@ -138,7 +137,7 @@ def _init_from_topic(
cls,
userdata: _MQTTCallbackUserdata,
topic: str,
expected_topic_levels: collections.abc.Collection[_MQTTTopicLevel],
expected_topic_levels: typing.Collection[_MQTTTopicLevel],
) -> typing.Optional[_MQTTControlledActor]:
try:
mac_address = _parse_mqtt_topic(
Expand Down
3 changes: 1 addition & 2 deletions switchbot_mqtt/_utils.py
Expand Up @@ -16,7 +16,6 @@
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <https://www.gnu.org/licenses/>.

import collections.abc
import enum
import logging
import queue # pylint: disable=unused-import; in type hint
Expand Down Expand Up @@ -47,7 +46,7 @@ def _join_mqtt_topic_levels(


def _parse_mqtt_topic(
topic: str, expected_levels: collections.abc.Collection[_MQTTTopicLevel]
topic: str, expected_levels: typing.Collection[_MQTTTopicLevel]
) -> typing.Dict[_MQTTTopicPlaceholder, str]:
attrs: typing.Dict[_MQTTTopicPlaceholder, str] = {}
topic_split = topic.split("/")
Expand Down

0 comments on commit 878afa9

Please sign in to comment.