Skip to content

Commit

Permalink
fix: make format
Browse files Browse the repository at this point in the history
  • Loading branch information
Almas-Ali committed May 1, 2024
1 parent 59ad2c1 commit 2543065
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 8 deletions.
3 changes: 1 addition & 2 deletions core/builtin_classes/string_object.py
Original file line number Diff line number Diff line change
Expand Up @@ -68,8 +68,7 @@ def count(ctx):
string = ctx.symbol_table.get("string")
if len(string.value) == 0:
return res.failure(
RTError(string.pos_start, string.pos_end,
"Cannot count an empty string", string.context)
RTError(string.pos_start, string.pos_end, "Cannot count an empty string", string.context)
)
return res.success(Number(self.value.count(string.value)))

Expand Down
12 changes: 8 additions & 4 deletions core/datatypes.py
Original file line number Diff line number Diff line change
Expand Up @@ -1015,7 +1015,8 @@ def __init__(self, parent_class, symbol_table):
self.symbol_table = SymbolTable(symbol_table)

@abstractmethod
def operator(self, operator: str, *args: Value) -> ResultTuple: ...
def operator(self, operator: str, *args: Value) -> ResultTuple:
...

def added_to(self, other: Value) -> ResultTuple:
return self.operator("__add__", other)
Expand Down Expand Up @@ -1121,7 +1122,8 @@ def __init__(self, name: str, symbol_table: SymbolTable) -> None:
self.symbol_table = symbol_table

@abstractmethod
def get(self, name: str) -> Optional[Value]: ...
def get(self, name: str) -> Optional[Value]:
...

def dived_by(self, other: Value) -> ResultTuple:
if not isinstance(other, String):
Expand All @@ -1134,10 +1136,12 @@ def dived_by(self, other: Value) -> ResultTuple:
return value, None

@abstractmethod
def create(self, args: list[Value]) -> RTResult[BaseInstance]: ...
def create(self, args: list[Value]) -> RTResult[BaseInstance]:
...

@abstractmethod
def init(self, inst: BaseInstance, args: list[Value], kwargs: dict[str, Value]) -> RTResult[None]: ...
def init(self, inst: BaseInstance, args: list[Value], kwargs: dict[str, Value]) -> RTResult[None]:
...

def execute(self, args: list[Value], kwargs: dict[str, Value]) -> RTResult[Value]:
res = RTResult[Value]()
Expand Down
6 changes: 4 additions & 2 deletions core/nodes.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,12 @@
@runtime_checkable
class Node(Protocol):
@property
def pos_start(self) -> Position: ...
def pos_start(self) -> Position:
...

@property
def pos_end(self) -> Position: ...
def pos_end(self) -> Position:
...


class NumberNode:
Expand Down

0 comments on commit 2543065

Please sign in to comment.