Make `DataConverter` accept a list of files to convert instead of only a directory
还没有人认领这个 Issue。
评估
调研方向
The issue identifies DataConverter.__call__ and GraphNeTFileReader.find_files() as the relevant entry points. Read those definitions and their tests to see how inputs are currently collected. Done means DataConverter accepts explicit file paths as well as directories and converts the selected files; the issue gives no test file to run.
由索引模型根据 Issue 内容生成。
描述
Is your feature request related to a problem? Please describe.
DataConverter accepts a single argument input_dir: Union[str, List[str]] which point to one or multiple directories. These directories are searched using the GraphNeTFileReader.find_files() method to create a list of file paths for conversion.
This construction appeals to a workflow where data files of interest are copied to a separate directory and all intended for conversion.
There are examples of use cases where converting all files in a directory is unwanted behavior.
Describe the solution you'd like
Make DataConverter accept a list of user-generated file paths for conversion, instead of assuming all files in the input_dir: Union[str, List[str]] should be converted.
We rename the input_dir: Union[str, List[str]] -> input: Union[str, List[str]] : A list of files and/or directories to convert
and then slightly adjust the DataConverter from
@final
def __call__(self, input_dir: Union[str, List[str]]) -> None:
"""Extract data from files in `input_dir` and save to disk.
Args:
input_dir: A directory that contains the input files.
The directory will be searched recursively for files
matching the file extension.
"""
# Get the file reader to produce a list of input files
# in the directory
input_files = self._file_reader.find_files(path=input_dir)
self._launch_jobs(input_files=input_files)
to
from path import isdir, isfile
@final
def __call__(self, input: Union[str, List[str]]) -> None:
"""Extract data from files in `input` and save to disk.
Args:
input: A list of file paths and/or directories containing files selected for conversion.
Directories are searched recursively, and all files in the directories will be converter.
"""
# Get the file reader to produce a list of input files
# in the directory
input_files = [path for path in input if isfile(path)]
directories_to_search = [path for path in input if isdir(path)]
files_from_directories = self._file_reader.find_files(path=directories_to_search)
input_files.extend(files_from_directories)
self._launch_jobs(input_files=input_files)
Additional context
Multiple people have mentioned a wish for this feature
- 主要语言
- Python
- 星标
- 117
- 派生
- 115
- 平均合并
- 2 天 21 小时
- 30 天内合并 PR
- 1
环境准备
- 提供 Dockerfile 或 Docker Compose 文件
- 没有 Pull Request 模板
- 没有贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
graphnet-team/graphnet 的其他 Issue
-
难度 2/5 1-3 小时 新手友好度 62/100
graphnet-team/graphnet#933 ·
-
Spring clean未关闭
难度 5/5 一周以上 新手友好度 25/100
graphnet-team/graphnet#927 · 1 条评论 ·
-
Time for a new version release v1.8.1可能重新可做 @Aske-Rosted 于 75 天前认领,目前没有进行中的 PR。 未关闭decision
graphnet-team/graphnet#924 · 已指派 1 人 ·
-
Make kaggle checkpoints part of the CI可能重新可做 @sevmag 于 75 天前认领,目前没有进行中的 PR。 未关闭bug
graphnet-team/graphnet#921 · 2 条评论 · 已指派 1 人 ·
-
decision deferred
难度 5/5 一周以上 新手友好度 25/100
graphnet-team/graphnet#919 ·
查看 graphnet-team/graphnet 的全部 Issue
相似的 Issue
-
separate_packages splits imports from the same explicitly configured package可能已有人在做 @rahul05ranjan 今天认领。 未关闭
难度 2/5 1-3 小时 新手友好度 72/100
维护者通常 2 天内回复
-
难度 2/5 1-3 小时 新手友好度 66/100
TigreGotico/text2spoken#626 ·
维护者通常 1 天内回复
-
oncoref MappingProxyType in proteome.layers breaks deepcopy in reference_coverage._inventory可能已有人在做 @iskandr 今天认领。 未关闭
难度 2/5 1-3 小时 新手友好度 62/100
维护者通常 1 天内回复
-
难度 2/5 1-3 小时 新手友好度 82/100
pipecat-ai/pipecat#7014 ·
维护者通常 1 天内回复
-
难度 2/5 1-3 小时 新手友好度 62/100
NL-BioImaging/biomero#136 ·
维护者通常 1 天内回复