Skip to content

Commit

Permalink
fix more issue
Browse files Browse the repository at this point in the history
  • Loading branch information
tunglxfast committed Dec 17, 2024
1 parent 32d0ddb commit 0d23b7b
Show file tree
Hide file tree
Showing 5 changed files with 12 additions and 5 deletions.
9 changes: 8 additions & 1 deletion datamimic_ce/tasks/array_task.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ def __init__(self, ctx: SetupContext | None, statement: ArrayStatement):
def statement(self) -> ArrayStatement:
return self._statement

def execute(self, parent_context: GenIterContext) -> None:
def execute(self, parent_context: GenIterContext) -> None: # TODO: mypy issue [override]
"""
Generate data for element "array"
:param parent_context:
Expand All @@ -49,6 +49,9 @@ def _execute_type_generate(self, parent_context: GenIterContext) -> None:
array_type = self._statement.type
count = self.statement.count

if not count:
return None

data_generation_util = parent_context.root.class_factory_util.get_data_generation_util()

value: list[str | int | bool | float] = [
Expand All @@ -63,6 +66,10 @@ def _execute_script_generate(self, parent_context: GenIterContext) -> None:
Result value datatype must be a List
"""
valid_py_types = ["str", "int", "bool", "float"]

if not self._statement.script:
return None

value = parent_context.evaluate_python_expression(self._statement.script)
if isinstance(value, list):
if len(value) > 0:
Expand Down
2 changes: 1 addition & 1 deletion datamimic_ce/tasks/condition_task.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ def __init__(self, statement: ConditionStatement, class_factory_util: BaseClassF
def statement(self) -> ConditionStatement:
return self._statement

def execute(self, parent_context: GenIterContext) -> None | dict:
def execute(self, parent_context: GenIterContext) -> None | dict: # TODO: mypy issue [override]
"""
Generate data for element "condition"
:param parent_context:
Expand Down
2 changes: 1 addition & 1 deletion datamimic_ce/tasks/database_task.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ class DatabaseTask(Task):
def __init__(self, statement: DatabaseStatement):
self._statement = statement

def execute(self, ctx: SetupContext):
def execute(self, ctx: SetupContext): # TODO: mypy issue [override]
client = RdbmsClient(self._statement.db_credential, ctx.task_id)
ctx.add_client(self._statement.db_id, client)

Expand Down
2 changes: 1 addition & 1 deletion datamimic_ce/tasks/item_task.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ def __init__(
def statement(self) -> ItemStatement:
return self._statement

def execute(self, parent_context: GenIterContext):
def execute(self, parent_context: GenIterContext): # TODO: mypy issue [override]
"""
Generate data for element "item"
:param parent_context:
Expand Down
2 changes: 1 addition & 1 deletion datamimic_ce/tasks/mongodb_task.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ def __init__(self, statement: MongoDBStatement):
def statement(self) -> MongoDBStatement:
return self._statement

def execute(self, ctx: SetupContext):
def execute(self, ctx: SetupContext): # TODO: mypy issue [override]
ctx.add_client(
self._statement.mongodb_id,
MongoDBClient(self._statement.mongodb_credential),
Expand Down

0 comments on commit 0d23b7b

Please sign in to comment.