Skip to content

Commit

Permalink
fix typo
Browse files Browse the repository at this point in the history
  • Loading branch information
micpst committed Jul 15, 2024
1 parent 8c831ef commit 79b1828
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 8 deletions.
8 changes: 4 additions & 4 deletions src/dbally/iql/_exceptions.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import ast
from typing import List, Optional, Union
from typing import List, Optional

from dbally.exceptions import DbAllyError

Expand Down Expand Up @@ -31,7 +31,7 @@ def __init__(self, source: str) -> None:
class IQLMultipleExpressionsError(IQLError):
"""Raised when IQL contains multiple expressions."""

def __init__(self, nodes: List[Union[ast.stmt, ast.expr]], source: str) -> None:
def __init__(self, nodes: List[ast.stmt], source: str) -> None:
message = "Multiple expressions or statements in IQL are not supported"
super().__init__(message, source)
self.nodes = nodes
Expand All @@ -41,7 +41,7 @@ class IQLExpressionError(IQLError):
"""Raised when IQL expression is invalid."""

def __init__(self, message: str, node: ast.expr, source: str) -> None:
message = message + ": " + source[node.col_offset : node.end_col_offset]
message = f"{message}: {source[node.col_offset : node.end_col_offset]}"
super().__init__(message, source)
self.node = node

Expand Down Expand Up @@ -84,7 +84,7 @@ def __init__(self, node: ast.Name, source: str) -> None:
super().__init__(message, node, source)


class IQLIcorrectNumberArgumentsError(IQLExpressionError):
class IQLIncorrectNumberArgumentsError(IQLExpressionError):
"""Raised when IQL contains too many arguments for a function."""

def __init__(self, node: ast.Call, source: str) -> None:
Expand Down
4 changes: 2 additions & 2 deletions src/dbally/iql/_processor.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
IQLArgumentValidationError,
IQLEmptyExpressionError,
IQLFunctionNotExists,
IQLIcorrectNumberArgumentsError,
IQLIncorrectNumberArgumentsError,
IQLMultipleExpressionsError,
IQLNoExpressionError,
IQLSyntaxError,
Expand Down Expand Up @@ -93,7 +93,7 @@ async def _parse_call(self, node: ast.Call) -> syntax.FunctionCall:
args = []

if len(func_def.parameters) != len(node.args):
raise IQLIcorrectNumberArgumentsError(node, self.source)
raise IQLIncorrectNumberArgumentsError(node, self.source)

for arg, arg_def in zip(node.args, func_def.parameters):
arg_value = self._parse_arg(arg)
Expand Down
4 changes: 2 additions & 2 deletions tests/unit/iql/test_iql_parser.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
IQLArgumentValidationError,
IQLEmptyExpressionError,
IQLFunctionNotExists,
IQLIcorrectNumberArgumentsError,
IQLIncorrectNumberArgumentsError,
IQLMultipleExpressionsError,
IQLNoExpressionError,
IQLSyntaxError,
Expand Down Expand Up @@ -185,7 +185,7 @@ async def test_iql_parser_method_not_exists():


async def test_iql_parser_incorrect_number_of_arguments_fail():
with pytest.raises(IQLIcorrectNumberArgumentsError) as exc_info:
with pytest.raises(IQLIncorrectNumberArgumentsError) as exc_info:
await IQLQuery.parse(
"filter_by_age('too old', 40)",
allowed_functions=[
Expand Down

0 comments on commit 79b1828

Please sign in to comment.