Skip to content

Commit

Permalink
black and isort
Browse files Browse the repository at this point in the history
  • Loading branch information
tusharsadhwani committed Oct 11, 2023
1 parent 6f41b83 commit 2f2c983
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions src/interpreted/parser.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
Compare,
Constant,
Continue,
Decorator,
Dict,
Expression,
ExprStmt,
Expand All @@ -35,7 +36,6 @@
UnaryOp,
While,
alias,
Decorator
)
from interpreted.tokenizer import EOF, Token, TokenType, index_to_line_column, tokenize

Expand Down Expand Up @@ -177,7 +177,7 @@ def expect_op(self, op: str) -> None:
if not self.match_op(op):
token = self.peek()
raise ParseError(f"Expected '{op}', found '{token.string}'", self.index)

def expect_name(self, name: str) -> None:
if not self.match_name(name):
token = self.peek()
Expand All @@ -196,7 +196,7 @@ def parse_statement(self) -> Statement:
while self.match_type(TokenType.NEWLINE):
pass

if self.peek().string == '@':
if self.peek().string == "@":
decorators = self.parse_decorators()
self.expect_name("def")
function_def = self.parse_function_def()
Expand All @@ -205,7 +205,7 @@ def parse_statement(self) -> Statement:
if self.match_name("def", "if", "for", "while"):
return self.parse_multiline_statement()
return self.parse_single_line_statement()

def parse_decorators(self) -> list[Decorator]:
decorators = []
while self.match_op("@"):
Expand All @@ -214,7 +214,7 @@ def parse_decorators(self) -> list[Decorator]:
decorators.append(Decorator(value=expression))

return decorators

def parse_multiline_statement(self) -> FunctionDef | For | If | While:
keyword = self.current().string
if keyword == "def":
Expand Down

0 comments on commit 2f2c983

Please sign in to comment.