Skip to content

Commit 005f486

Browse files
committed
🪓 fix mypy issues
1 parent 7fe37d1 commit 005f486

File tree

4 files changed

+12
-12
lines changed

4 files changed

+12
-12
lines changed

.github/workflows/pre-commit.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ jobs:
99
- uses: actions/checkout@v2
1010
- uses: actions/setup-python@v2
1111
with:
12-
python-version: 3.8
12+
python-version: 3.9
1313
- name: Install pre-commit
1414
run: pip install pre-commit
1515
- name: Run pre-commit

codeboxapi/box/basebox.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
from abc import ABC, abstractmethod
44
from datetime import datetime
55
from os import PathLike
6-
from typing import Optional
6+
from typing import List, Optional
77
from uuid import UUID
88

99
from typing_extensions import Self
@@ -76,11 +76,11 @@ async def ainstall(self, package_name: str) -> CodeBoxStatus:
7676
"""Async Install a python package to the venv"""
7777

7878
@abstractmethod
79-
def list_files(self) -> list[CodeBoxFile]:
79+
def list_files(self) -> List[CodeBoxFile]:
8080
"""List all available files inside the CodeBox instance"""
8181

8282
@abstractmethod
83-
async def alist_files(self) -> list[CodeBoxFile]:
83+
async def alist_files(self) -> List[CodeBoxFile]:
8484
"""Async List all available files inside the CodeBox instance"""
8585

8686
@abstractmethod

codeboxapi/box/codebox.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@
3434
"""
3535

3636
from os import PathLike
37-
from typing import Any, Optional
37+
from typing import Any, Dict, List, Optional
3838
from uuid import UUID
3939

4040
from aiohttp import ClientSession
@@ -62,7 +62,7 @@ def __init__(self, *args, **kwargs) -> None:
6262
self.session_id: Optional[UUID] = kwargs.get("id", None)
6363
self.aiohttp_session: Optional[ClientSession] = None
6464

65-
def codebox_request(self, method, endpoint, *args, **kwargs) -> dict[str, Any]:
65+
def codebox_request(self, method, endpoint, *args, **kwargs) -> Dict[str, Any]:
6666
"""Basic request to the CodeBox API"""
6767
self._update()
6868
return base_request(
@@ -71,7 +71,7 @@ def codebox_request(self, method, endpoint, *args, **kwargs) -> dict[str, Any]:
7171

7272
async def acodebox_request(
7373
self, method, endpoint, *args, **kwargs
74-
) -> dict[str, Any]:
74+
) -> Dict[str, Any]:
7575
"""Basic async request to the CodeBox API"""
7676
self._update()
7777
if self.aiohttp_session is None:
@@ -213,7 +213,7 @@ async def ainstall(self, package_name: str) -> CodeBoxStatus:
213213
)
214214
)
215215

216-
def list_files(self) -> list[CodeBoxFile]:
216+
def list_files(self) -> List[CodeBoxFile]:
217217
return [
218218
CodeBoxFile(name=file_name, content=None)
219219
for file_name in (
@@ -224,7 +224,7 @@ def list_files(self) -> list[CodeBoxFile]:
224224
)["files"]
225225
]
226226

227-
async def alist_files(self) -> list[CodeBoxFile]:
227+
async def alist_files(self) -> List[CodeBoxFile]:
228228
return [
229229
CodeBoxFile(name=file_name, content=None)
230230
for file_name in (

codeboxapi/box/localbox.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
import subprocess
1212
import time
1313
from asyncio.subprocess import Process
14-
from typing import Optional, Union
14+
from typing import List, Optional, Union
1515
from uuid import uuid4
1616

1717
import aiohttp
@@ -449,13 +449,13 @@ async def ainstall(self, package_name: str) -> CodeBoxStatus:
449449
# restart kernel if needed TODO
450450
return CodeBoxStatus(status=f"{package_name} installed successfully")
451451

452-
def list_files(self) -> list[CodeBoxFile]:
452+
def list_files(self) -> List[CodeBoxFile]:
453453
return [
454454
CodeBoxFile(name=file_name, content=None)
455455
for file_name in os.listdir(".codebox")
456456
]
457457

458-
async def alist_files(self) -> list[CodeBoxFile]:
458+
async def alist_files(self) -> List[CodeBoxFile]:
459459
return await asyncio.to_thread(self.list_files)
460460

461461
def restart(self) -> CodeBoxStatus:

0 commit comments

Comments
 (0)