Skip to content

Commit 7ee34e4

Browse files
committed
move mypy settings to pyproject.toml
1 parent 3f473b0 commit 7ee34e4

File tree

7 files changed

+28
-30
lines changed

7 files changed

+28
-30
lines changed

mypy.ini

Lines changed: 0 additions & 23 deletions
This file was deleted.

pyproject.toml

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -124,3 +124,15 @@ exclude_lines = [
124124
"raise NotImplementedError",
125125
]
126126
fail_under = 40
127+
128+
[tool.mypy]
129+
# MyPy config
130+
# File reference here - http://mypy.readthedocs.io/en/latest/config_file.html#config-file
131+
python_version = 3.8
132+
warn_redundant_casts = true
133+
warn_unused_ignores = true
134+
warn_return_any = true
135+
warn_unused_configs = true
136+
strict = true
137+
disallow_subclassing_any = false
138+
ignore_missing_imports = true

robotcode/debugger/modifiers/longname_modifiers.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
from robot.running import TestCase, TestSuite
55

66

7-
class ByLongName(SuiteVisitor): # type: ignore
7+
class ByLongName(SuiteVisitor):
88
def __init__(self, *included: str) -> None:
99
super().__init__()
1010
self.included = included
@@ -26,7 +26,7 @@ def end_suite(self, suite: TestSuite) -> None:
2626
suite.suites = [s for s in suite.suites if s.test_count > 0]
2727

2828

29-
class ExcludedByLongName(SuiteVisitor): # type: ignore
29+
class ExcludedByLongName(SuiteVisitor):
3030
def __init__(self, *included: str) -> None:
3131
super().__init__()
3232
self.included = included

robotcode/jsonrpc2/server.py

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -158,16 +158,25 @@ def start_tcp(self, host: Optional[str] = None, port: int = 0) -> None:
158158

159159
@_logger.call
160160
def start_pipe(self, pipe_name: Optional[str]) -> None:
161+
from typing import TYPE_CHECKING
162+
163+
if TYPE_CHECKING:
164+
from asyncio.streams import StreamReaderProtocol
165+
from asyncio.windows_events import ProactorEventLoop
166+
161167
if pipe_name is None:
162168
raise ValueError("pipe name missing.")
163169

164170
self.mode = JsonRpcServerMode.PIPE
165171

166172
try:
173+
# check if we are on windows and using the ProactorEventLoop, to use the undocumented
174+
# create_pipe_connection method
167175
if sys.platform == "win32" and hasattr(self.loop, "create_pipe_connection"):
168-
# this is a proactor event loop and we can use the not documented method create_pipe_connection
169176
self.loop.run_until_complete(
170-
self.loop.create_pipe_connection(self.create_protocol, pipe_name), # type: ignore
177+
cast("ProactorEventLoop", self.loop).create_pipe_connection(
178+
lambda: cast("StreamReaderProtocol", self.create_protocol()), pipe_name
179+
),
171180
)
172181
else:
173182
self.loop.run_until_complete(self.loop.create_unix_connection(self.create_protocol, pipe_name))

robotcode/language_server/robotframework/diagnostics/imports_manager.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -575,7 +575,7 @@ async def get_libdoc_from_model(
575575

576576
ResourceBuilder(res).visit(model)
577577

578-
class MyUserLibrary(UserLibrary): # type: ignore
578+
class MyUserLibrary(UserLibrary):
579579
current_kw: Any = None
580580

581581
def _log_creating_failed(self, handler: UserErrorHandler, error: BaseException) -> None:

robotcode/language_server/robotframework/diagnostics/library_doc.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -981,7 +981,7 @@ def get_library_doc(
981981
from robot.running.testlibraries import _get_lib_class
982982
from robot.utils import Importer
983983

984-
class Logger(AbstractLogger): # type: ignore
984+
class Logger(AbstractLogger):
985985
def __init__(self) -> None:
986986
super().__init__()
987987
self.messages: List[Tuple[str, str, bool]] = []

robotcode/language_server/robotframework/parts/robocop_diagnostics.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,7 @@ async def collect(
100100
if extension_config.configurations:
101101
config.configure = set(extension_config.configurations)
102102

103-
class MyRobocop(Robocop): # type: ignore
103+
class MyRobocop(Robocop):
104104
async def run_check(self, ast_model, filename, source=None): # type: ignore
105105
await check_canceled()
106106

0 commit comments

Comments
 (0)