Skip to content

Commit 4193b4a

Browse files
committed
🖤 black format everything
1 parent 6691599 commit 4193b4a

File tree

14 files changed

+338
-305
lines changed

14 files changed

+338
-305
lines changed

codeboxapi/__init__.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44

55

66
__all__ = [
7-
"CodeBox",
8-
"set_api_key",
7+
"CodeBox",
8+
"set_api_key",
99
"settings",
10-
]
10+
]

codeboxapi/box/basebox.py

Lines changed: 60 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -4,89 +4,108 @@
44
from typing_extensions import Self
55
from abc import ABC, abstractmethod
66
from codeboxapi.schema import (
7-
CodeBoxStatus,
7+
CodeBoxStatus,
88
CodeBoxOutput,
99
CodeBoxFile,
1010
)
1111

1212

1313
class BaseBox(ABC):
14-
"""
14+
"""
1515
ABC for Isolated Execution Environments
1616
"""
17-
17+
1818
def __init__(self) -> None:
1919
self.id: Optional[int] = None
2020
self.last_interaction = datetime.now()
2121

2222
def _update(self) -> None:
2323
self.last_interaction = datetime.now()
24-
24+
2525
@abstractmethod
26-
def start(self) -> CodeBoxStatus: ...
27-
26+
def start(self) -> CodeBoxStatus:
27+
...
28+
29+
@abstractmethod
30+
async def astart(self) -> CodeBoxStatus:
31+
...
32+
2833
@abstractmethod
29-
async def astart(self) -> CodeBoxStatus: ...
30-
31-
@abstractmethod
32-
def status(self) -> CodeBoxStatus: ...
34+
def status(self) -> CodeBoxStatus:
35+
...
3336

3437
@abstractmethod
35-
async def astatus(self) -> CodeBoxStatus: ...
36-
38+
async def astatus(self) -> CodeBoxStatus:
39+
...
40+
3741
@abstractmethod
38-
def run(self, code: Optional[str] = None, file_path: Optional[os.PathLike] = None) -> CodeBoxOutput: ...
39-
42+
def run(
43+
self, code: Optional[str] = None, file_path: Optional[os.PathLike] = None
44+
) -> CodeBoxOutput:
45+
...
46+
4047
@abstractmethod
41-
async def arun(self, code: Optional[str] = None, file_path: Optional[os.PathLike] = None) -> CodeBoxOutput: ...
42-
48+
async def arun(
49+
self, code: Optional[str] = None, file_path: Optional[os.PathLike] = None
50+
) -> CodeBoxOutput:
51+
...
52+
4353
@abstractmethod
44-
def upload(self, file_name: str, content: bytes) -> CodeBoxStatus: ...
45-
54+
def upload(self, file_name: str, content: bytes) -> CodeBoxStatus:
55+
...
56+
4657
@abstractmethod
47-
async def aupload(self, file_name: str, content: bytes) -> CodeBoxStatus: ...
58+
async def aupload(self, file_name: str, content: bytes) -> CodeBoxStatus:
59+
...
4860

4961
@abstractmethod
50-
def download(self, file_name: str) -> CodeBoxFile: ...
51-
62+
def download(self, file_name: str) -> CodeBoxFile:
63+
...
64+
5265
@abstractmethod
53-
async def adownload(self, file_name: str) -> CodeBoxFile: ...
54-
66+
async def adownload(self, file_name: str) -> CodeBoxFile:
67+
...
68+
5569
@abstractmethod
56-
def install(self, package_name: str) -> CodeBoxStatus: ...
57-
70+
def install(self, package_name: str) -> CodeBoxStatus:
71+
...
72+
5873
@abstractmethod
59-
async def ainstall(self, package_name: str) -> CodeBoxStatus: ...
60-
74+
async def ainstall(self, package_name: str) -> CodeBoxStatus:
75+
...
76+
6177
@abstractmethod
62-
def list_files(self) -> list[CodeBoxFile]: ...
63-
78+
def list_files(self) -> list[CodeBoxFile]:
79+
...
80+
6481
@abstractmethod
65-
async def alist_files(self) -> list[CodeBoxFile]: ...
66-
82+
async def alist_files(self) -> list[CodeBoxFile]:
83+
...
84+
6785
# @abstractmethod # TODO: implement
6886
# def restart(self) -> CodeBoxStatus: ...
69-
87+
7088
# @abstractmethod # TODO: implement
7189
# async def arestart(self) -> CodeBoxStatus: ...
72-
90+
7391
@abstractmethod
74-
def stop(self) -> CodeBoxStatus: ...
75-
92+
def stop(self) -> CodeBoxStatus:
93+
...
94+
7695
@abstractmethod
77-
async def astop(self) -> CodeBoxStatus: ...
78-
96+
async def astop(self) -> CodeBoxStatus:
97+
...
98+
7999
def __enter__(self) -> Self:
80100
self.start()
81101
return self
82-
102+
83103
async def __aenter__(self) -> Self:
84104
await self.astart()
85105
return self
86-
106+
87107
def __exit__(self, exc_type, exc_value, traceback) -> None:
88108
self.stop()
89-
109+
90110
async def __aexit__(self, exc_type, exc_value, traceback) -> None:
91111
await self.astop()
92-

0 commit comments

Comments
 (0)