Skip to content

Commit

Permalink
Add comments.
Browse files Browse the repository at this point in the history
  • Loading branch information
YooSunYoung committed Nov 1, 2024
1 parent 3d6a2ad commit c933985
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions src/scicat_dataset.py
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,13 @@ def convert_to_type(input_value: Any, dtype_desc: str) -> Any:
ast.literal_eval(value) if isinstance(value, str) else value
),
# "evaluate": lambda value: ast.literal_eval(value),
# We are not adding the evaluate function here since
# ``evaluate`` function should be avoided if possible.
# It might seem easy to use, but it is very easy to break
# when the input is not as expected.
# It is better to use the specific converters for the types.
# However, if it is the only way to go, you can add it here.
# Please add a comment to explain why it is needed.
"filename": lambda value: os.path.basename(value),
"dirname": lambda value: os.path.dirname(value),
"dirname-2": lambda value: os.path.dirname(os.path.dirname(value)),
Expand Down

0 comments on commit c933985

Please sign in to comment.