Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings
This repository was archived by the owner on Mar 25, 2025. It is now read-only.

Commit 627c22e

Browse filesBrowse files
committed
Fix typing-related TypeError
Older typing versions don't allow what we did[1]. We don't really need to be that precise here anyway. The error: $ python Python 3.5.2 (default, Nov 23 2017, 16:37:01) [GCC 5.4.0 20160609] on linux Type "help", "copyright", "credits" or "license" for more information. >>> import zeroconf Traceback (most recent call last): File "<stdin>", line 1, in <module> File "/scraper/venv/lib/python3.5/site-packages/zeroconf.py", line 320, in <module> OptionalExcInfo = Tuple[Optional[Type[BaseException]], Optional[BaseException], Optional[TracebackType]] File "/usr/lib/python3.5/typing.py", line 649, in __getitem__ return Union[arg, type(None)] File "/usr/lib/python3.5/typing.py", line 552, in __getitem__ dict(self.__dict__), parameters, _root=True) File "/usr/lib/python3.5/typing.py", line 512, in __new__ for t2 in all_params - {t1} if not isinstance(t2, TypeVar)): File "/usr/lib/python3.5/typing.py", line 512, in <genexpr> for t2 in all_params - {t1} if not isinstance(t2, TypeVar)): File "/usr/lib/python3.5/typing.py", line 1077, in __subclasscheck__ if super().__subclasscheck__(cls): File "/usr/lib/python3.5/abc.py", line 225, in __subclasscheck__ for scls in cls.__subclasses__(): TypeError: descriptor '__subclasses__' of 'type' object needs an argument Closes python-zeroconf#141 Fixes: 1f33c4f ("Introduce some static type analysis to the codebase") [1] python/typing#266
1 parent 1684a46 commit 627c22e
Copy full SHA for 627c22e

File tree

Expand file treeCollapse file tree

1 file changed

+2
-5
lines changed
Filter options
Expand file treeCollapse file tree

1 file changed

+2
-5
lines changed

‎zeroconf.py

Copy file name to clipboardExpand all lines: zeroconf.py
+2-5Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -31,9 +31,8 @@
3131
import threading
3232
import time
3333
from functools import reduce
34-
from types import TracebackType
3534
from typing import Callable # noqa # used in type hints
36-
from typing import Dict, List, Optional, Tuple, Type, Union
35+
from typing import Dict, List, Optional, Union
3736

3837
import ifaddr
3938

@@ -317,11 +316,9 @@ class BadTypeInNameException(Error):
317316

318317
# implementation classes
319318

320-
OptionalExcInfo = Tuple[Optional[Type[BaseException]], Optional[BaseException], Optional[TracebackType]]
321-
322319

323320
class QuietLogger:
324-
_seen_logs = {} # type: Dict[str, OptionalExcInfo]
321+
_seen_logs = {} # type: Dict[str, tuple]
325322

326323
@classmethod
327324
def log_exception_warning(cls, logger_data=None):

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.