Disable assuming Optional type for values with None default (#16029)

https://www.python.org/dev/peps/pep-0484/#union-types
"Type checkers should move towards requiring the optional type to be
made explicit."
This commit is contained in:
Ville Skyttä authored and Paulus Schoutsen committed 2018-08-17 20:22:49 +02:00
1 parent 2ad0bd4036
commit 3800f00564
9 files changed
+24 -17

No files matched your search

+2 -2
View File
@@ -154,7 +154,7 @@ class OrderedEnum(enum.Enum):
class OrderedSet(MutableSet[T]):
"""Ordered set taken from http://code.activestate.com/recipes/576694/."""
def __init__(self, iterable: Iterable[T] = None) -> None:
def __init__(self, iterable: Optional[Iterable[T]] = None) -> None:
"""Initialize the set."""
self.end = end = [] # type: List[Any]
end += [None, end, end] # sentinel node for doubly linked list
@@ -260,7 +260,7 @@ class Throttle:
"""
def __init__(self, min_time: timedelta,
limit_no_throttle: timedelta = None) -> None:
limit_no_throttle: Optional[timedelta] = None) -> None:
"""Initialize the throttle."""
self.min_time = min_time
self.limit_no_throttle = limit_no_throttle