Skip to content

Commit

Permalink
Remove quotes from return types
Browse files Browse the repository at this point in the history
  • Loading branch information
deathaxe committed Apr 21, 2024
1 parent 276953c commit 804cf7f
Show file tree
Hide file tree
Showing 10 changed files with 82 additions and 82 deletions.
2 changes: 1 addition & 1 deletion plugin/core/file_watcher.py
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ def create(
events: List[FileWatcherEventType],
ignores: List[str],
handler: FileWatcherProtocol
) -> 'FileWatcher':
) -> FileWatcher:
"""
Creates a new instance of the file watcher.
Expand Down
6 changes: 3 additions & 3 deletions plugin/core/promise.py
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ def process_value(value):
"""

@staticmethod
def resolve(resolve_value: S) -> 'Promise[S]':
def resolve(resolve_value: S) -> Promise[S]:
"""Immediately resolves a Promise.
Convenience function for creating a Promise that gets immediately
Expand Down Expand Up @@ -100,7 +100,7 @@ def __call__(self, resolver: ResolveFunc[TExecutor]) -> None:

# Could also support passing plain S.
@staticmethod
def all(promises: List['Promise[S]']) -> 'Promise[List[S]]':
def all(promises: List[Promise[S]]) -> Promise[List[S]]:
"""
Takes a list of promises and returns a Promise that gets resolved when all promises
gets resolved.
Expand Down Expand Up @@ -148,7 +148,7 @@ def __repr__(self) -> str:
return 'Promise({})'.format(self.value)
return 'Promise(<pending>)'

def then(self, onfullfilled: FullfillFunc[T, TResult]) -> 'Promise[TResult]':
def then(self, onfullfilled: FullfillFunc[T, TResult]) -> Promise[TResult]:
"""Create a new promise and chain it with this promise.
When this promise gets resolved, the callback will be called with the
Expand Down
12 changes: 6 additions & 6 deletions plugin/core/sessions.py
Original file line number Diff line number Diff line change
Expand Up @@ -196,7 +196,7 @@ def window(self) -> sublime.Window:
raise NotImplementedError()

@abstractmethod
def sessions(self, view: sublime.View, capability: Optional[str] = None) -> 'Generator[Session, None, None]':
def sessions(self, view: sublime.View, capability: Optional[str] = None) -> Generator[Session, None, None]:
"""
Iterate over the sessions stored in this manager, applicable to the given view, with the given capability.
"""
Expand Down Expand Up @@ -534,19 +534,19 @@ def get_initialize_params(variables: Dict[str, str], workspace_folders: List[Wor
class SessionViewProtocol(Protocol):

@property
def session(self) -> 'Session':
def session(self) -> Session:
...

@property
def view(self) -> sublime.View:
...

@property
def listener(self) -> 'weakref.ref[AbstractViewListener]':
def listener(self) -> weakref.ref[AbstractViewListener]:
...

@property
def session_buffer(self) -> 'SessionBufferProtocol':
def session_buffer(self) -> SessionBufferProtocol:
...

def get_uri(self) -> Optional[DocumentUri]:
Expand Down Expand Up @@ -603,11 +603,11 @@ def reset_show_definitions(self) -> None:
class SessionBufferProtocol(Protocol):

@property
def session(self) -> 'Session':
def session(self) -> Session:
...

@property
def session_views(self) -> 'WeakSet[SessionViewProtocol]':
def session_views(self) -> WeakSet[SessionViewProtocol]:
...

@property
Expand Down
2 changes: 1 addition & 1 deletion plugin/core/workspace.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ def __init__(self, name: str, path: str) -> None:
self.path = path

@classmethod
def from_path(cls, path: str) -> 'WorkspaceFolder':
def from_path(cls, path: str) -> WorkspaceFolder:
return cls(os.path.basename(path) or path, path)

def __hash__(self) -> int:
Expand Down
2 changes: 1 addition & 1 deletion plugin/session_buffer.py
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,7 @@ def session(self) -> Session:
return self._session

@property
def session_views(self) -> 'WeakSet[SessionViewProtocol]':
def session_views(self) -> WeakSet[SessionViewProtocol]:
return self._session_views

@property
Expand Down
2 changes: 1 addition & 1 deletion tests/server.py
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ def to_lsp(self) -> StringDict:
return {"code": self.code, "message": super().__str__()}

@classmethod
def from_lsp(cls, d: StringDict) -> 'Error':
def from_lsp(cls, d: StringDict) -> Error:
return Error(d["code"], d["message"])

def __str__(self) -> str:
Expand Down
14 changes: 7 additions & 7 deletions tests/setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ def remove_config(config):
client_configs.remove_for_testing(config)


def close_test_view(view: Optional[sublime.View]) -> 'Generator':
def close_test_view(view: Optional[sublime.View]) -> Generator:
if view:
view.set_scratch(True)
yield {"condition": lambda: not view.is_loading(), "timeout": TIMEOUT_TIME}
Expand Down Expand Up @@ -157,7 +157,7 @@ def ensure_document_listener_created(cls) -> bool:
return False

@classmethod
def await_message(cls, method: str, promise: Optional[YieldPromise] = None) -> 'Generator':
def await_message(cls, method: str, promise: Optional[YieldPromise] = None) -> Generator:
"""
Awaits until server receives a request with a specified method.
Expand Down Expand Up @@ -235,7 +235,7 @@ def error_handler(params: Any) -> None:
self.session.send_request(Request("$test/setResponses", payload), handler, error_handler)
yield from self.await_promise(promise)

def await_client_notification(self, method: str, params: Any = None) -> 'Generator':
def await_client_notification(self, method: str, params: Any = None) -> Generator:
self.assertIsNotNone(self.session)
assert self.session # mypy
promise = YieldPromise()
Expand All @@ -250,15 +250,15 @@ def error_handler(params: Any) -> None:
self.session.send_request(req, handler, error_handler)
yield from self.await_promise(promise)

def await_clear_view_and_save(self) -> 'Generator':
def await_clear_view_and_save(self) -> Generator:
assert self.view # type: Optional[sublime.View]
self.view.run_command("select_all")
self.view.run_command("left_delete")
self.view.run_command("save")
yield from self.await_message("textDocument/didChange")
yield from self.await_message("textDocument/didSave")

def await_view_change(self, expected_change_count: int) -> 'Generator':
def await_view_change(self, expected_change_count: int) -> Generator:
assert self.view # type: Optional[sublime.View]

def condition() -> bool:
Expand All @@ -276,7 +276,7 @@ def insert_characters(self, characters: str) -> int:
return self.view.change_count()

@classmethod
def tearDownClass(cls) -> 'Generator':
def tearDownClass(cls) -> Generator:
if cls.session and cls.wm:
sublime.set_timeout_async(cls.session.end_async)
yield lambda: cls.session.state == ClientStates.STOPPING
Expand All @@ -288,7 +288,7 @@ def tearDownClass(cls) -> 'Generator':
remove_config(cls.config)
super().tearDownClass()

def doCleanups(self) -> 'Generator':
def doCleanups(self) -> Generator:
if self.view and self.view.is_valid():
yield from close_test_view(self.view)
yield from super().doCleanups()
Loading

0 comments on commit 804cf7f

Please sign in to comment.