fix-spelling-error,-code-bug,-and-improve-test#1991
Conversation
…ode-bug,-and-improve-test Fix path helper and documentation in utils
@microsoft-github-policy-service agree |
|
Hi, @TianqiTang1117 |
Abhijais4896
left a comment
There was a problem hiding this comment.
from typing import Dict, Tuple, Union, Callable, List
from typing import Dict, Tuple, Callable, List
import bisect
import numpy as np
import pandas as pd
def concat(data_list: Union[SingleData], axis=0) -> MultiData:
"""concat all SingleData by index.
def concat(data_list: List["SingleData"], axis=0) -> "MultiData":
"""Concat multiple :class:SingleData objects by index.
TODO: now just for SingleData.
Parameters
Abhijais4896
left a comment
There was a problem hiding this comment.
from typing import Dict, Tuple, Union, Callable, List
from typing import Dict, Tuple, Callable, List
import bisect
import numpy as np
import pandas as pd
Abhijais4896
left a comment
There was a problem hiding this comment.
if return_dir:
_, path = tempfile.mkdtemp(dir=temp_dir)
# mkdtemp returns the created directory path directly, while mkstemp
# returns a tuple of (fd, path). The previous implementation tried to
# unpack the return value of mkdtemp into two variables, which raises a
# ValueError at runtime. This branch should therefore assign the path
# directly without unpacking.
path = tempfile.mkdtemp(dir=temp_dir)
else:
_, path = tempfile.mkstemp(dir=temp_dir)
Abhijais4896
left a comment
There was a problem hiding this comment.
from typing import Dict, Tuple, Union, Callable, List
from typing import Dict, Tuple, Callable, List
import bisect
import numpy as np
import pandas as pd
Abhijais4896
left a comment
There was a problem hiding this comment.
if return_dir:
_, path = tempfile.mkdtemp(dir=temp_dir)
# mkdtemp returns the created directory path directly, while mkstemp
# returns a tuple of (fd, path). The previous implementation tried to
# unpack the return value of mkdtemp into two variables, which raises a
# ValueError at runtime. This branch should therefore assign the path
# directly without unpacking.
path = tempfile.mkdtemp(dir=temp_dir)
else:
_, path = tempfile.mkstemp(dir=temp_dir)
return path
Summary
Testing
python -m pytest tests/misc/test_file_utils.py -q