Skip to content

Commit

Permalink
mypy
Browse files Browse the repository at this point in the history
  • Loading branch information
rchl committed Feb 14, 2021
1 parent de8cb4d commit 725ec67
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions plugin/core/promise.py
Original file line number Diff line number Diff line change
Expand Up @@ -75,19 +75,19 @@ def resolve(cls, resolve_value: T = None) -> 'Promise[T]':
resolve_value: The value to resolve the promise with.
"""
def executor_func(resolve_fn: ResolveFunc[T]) -> None:
resolve_fn(resolve_value)
resolve_fn(resolve_value or None)

return cls(executor_func)

@classmethod
def on_main_thread(cls, value: T = None) -> 'Promise[T]':
"""Return a promise that resolves on the main thread."""
return Promise(lambda resolve: sublime.set_timeout(lambda: resolve(value)))
return Promise(lambda resolve: sublime.set_timeout(lambda: resolve(value or None)))

@classmethod
def on_async_thread(cls, value: T = None) -> 'Promise[T]':
"""Return a promise that resolves on the worker thread."""
return Promise(lambda resolve: sublime.set_timeout_async(lambda: resolve(value)))
return Promise(lambda resolve: sublime.set_timeout_async(lambda: resolve(value or None)))

@classmethod
def packaged_task(cls) -> PackagedTask[T]:
Expand Down

0 comments on commit 725ec67

Please sign in to comment.