python: Fix misuse of Optional types for optional parameters.

There seems to have been a confusion between two different uses of the
word “optional”:

• An optional parameter may be omitted and replaced with a default
  value.
• An Optional type has None as a possible value.

Sometimes an optional parameter has a default value of None, or None
is otherwise a meaningful value to provide, in which case it makes
sense for the optional parameter to have an Optional type.  But in
other cases, optional parameters should not have Optional type.  Fix
them.

Signed-off-by: Anders Kaseorg <anders@zulip.com>
This commit is contained in:
Anders Kaseorg
2020-06-12 16:57:21 -07:00
committed by Tim Abbott
parent 7229088b6c
commit 69c0959f34
34 changed files with 100 additions and 102 deletions

View File

@@ -313,7 +313,7 @@ def init_worker(counter: Synchronized) -> None:
print("*** Upload directory not found.")
class TestSuite(unittest.TestSuite):
def run(self, result: TestResult, debug: Optional[bool]=False) -> TestResult:
def run(self, result: TestResult, debug: bool=False) -> TestResult:
"""
This function mostly contains the code from
unittest.TestSuite.run. The need to override this function