Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix extra files path type hint #18958

Merged
merged 3 commits into from
Oct 10, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 6 additions & 7 deletions lib/galaxy/datatypes/genetics.py
Original file line number Diff line number Diff line change
Expand Up @@ -863,16 +863,15 @@ def set_meta(self, dataset: DatasetProtocol, overwrite: bool = True, **kwd) -> N
pp = os.path.join(dataset.extra_files_path, pn)
dataset.metadata.pheno_path = pp
try:
with open(pp) as f:
pf = f.readlines() # read the basename.phenodata in the extra_files_path
with open(pp) as file:
pf = file.readlines() # read the basename.phenodata in the extra_files_path
except Exception:
pf = None
if pf:
h = pf[0].strip()
h = h.split("\t") # hope is header
h = [escape(x) for x in h]
dataset.metadata.column_names = h
dataset.metadata.columns = len(h)
header = pf[0].strip()
columns = [escape(x) for x in header.split("\t")] # hope is header
dataset.metadata.column_names = columns
dataset.metadata.columns = len(columns)
dataset.peek = "".join(pf[:5])
else:
dataset.metadata.column_names = []
Expand Down
2 changes: 1 addition & 1 deletion lib/galaxy/datatypes/protocols.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ def ext(self): ...

class HasExtraFilesPath(Protocol):
@property
def extra_files_path(self): ...
def extra_files_path(self) -> str: ...


class HasFileName(Protocol):
Expand Down
Loading