Skip to content

Commit 8d20c0c

Browse files
committed
add pyright support for mypyconsole
1 parent dd5f5ac commit 8d20c0c

File tree

5 files changed

+10
-7
lines changed

5 files changed

+10
-7
lines changed

.github/workflows/tests.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ jobs:
4444
- name: Run Pyright
4545
run: |
4646
pip install pyright
47-
pyright mypylib # wip support whole project
47+
pyright mypylib mypyconsole # wip support whole project
4848
4949
- name: Run pytest
5050
run: |

mypyconsole/mypyconsole.py

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,9 @@
66
import readline
77
from collections import deque
88

9+
from mypylib import MyPyClass
10+
11+
912
class MyPyConsoleItem():
1013
def __init__(self, cmd: str, func, desc: str, usage: str = ''):
1114
self.cmd = cmd
@@ -15,12 +18,12 @@ def __init__(self, cmd: str, func, desc: str, usage: str = ''):
1518
#end define
1619
#end class
1720

18-
class MyPyConsole():
21+
class MyPyConsole:
1922
RED = '\033[31m'
2023
GREEN = '\033[92m'
2124
ENDC = '\033[0m'
2225

23-
def __init__(self):
26+
def __init__(self, local: MyPyClass):
2427
self.debug = False
2528
self.name = "console"
2629
self.color = self.GREEN
@@ -30,7 +33,7 @@ def __init__(self):
3033
self.start_function = None
3134
self.menu_items = list()
3235
self.history = deque(maxlen=100)
33-
self.local = None
36+
self.local: MyPyClass = local
3437
self.add_item("help", self.help, "Print help text")
3538
self.add_item("clear", self.clear, "Clear console")
3639
self.add_item("history", self.print_history, "Print last commands")

mytonctrl/mytonctrl.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1070,6 +1070,6 @@ def mytonctrl():
10701070
local = MyPyClass('mytonctrl.py')
10711071
mytoncore_local = MyPyClass('mytoncore.py')
10721072
ton = MyTonCore(mytoncore_local)
1073-
console = MyPyConsole()
1073+
console = MyPyConsole(local)
10741074
Init(local, ton, console, sys.argv[1:])
10751075
console.Run()

mytoninstaller/mytoninstaller.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -348,7 +348,7 @@ def General(local, console):
348348
###
349349
def mytoninstaller():
350350
local = MyPyClass(__file__)
351-
console = MyPyConsole()
351+
console = MyPyConsole(local)
352352

353353
Init(local, console)
354354
if len(sys.argv) > 1:

tests/conftest.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -108,7 +108,7 @@ def execute(self, command: str, no_color: bool = False) -> str:
108108

109109
@pytest.fixture()
110110
def cli(local, ton) -> TestMyPyConsole:
111-
console = TestMyPyConsole()
111+
console = TestMyPyConsole(local)
112112
mp = pytest.MonkeyPatch()
113113
mp.setattr(MyTonCore, "using_pool", lambda self: True)
114114
mp.setattr(MyTonCore, "using_nominator_pool", lambda self: True)

0 commit comments

Comments
 (0)