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

More defensive access of extra props in filesources #17445

Merged
Merged
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
14 changes: 12 additions & 2 deletions lib/galaxy/files/sources/__init__.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
import abc
import os
import time
from dataclasses import (
dataclass,
field,
)
from typing import (
Any,
ClassVar,
Expand Down Expand Up @@ -52,14 +56,20 @@ class FilesSourceProperties(TypedDict):
browsable: NotRequired[bool]


@dataclass
class FilesSourceOptions:
"""Options to control behaviour of filesource operations, such as realize_to and write_from"""
"""Options to control behavior of file source operations, such as realize_to, write_from and list."""

# Indicates access to the FS operation with intent to write.
# Even if a file source is "writeable" some directories (or elements) may be restricted or read-only
# so those should be skipped while browsing with writeable=True.
writeable: Optional[bool] = False

# Property overrides for values initially configured through the constructor. For example
# the HTTPFilesSource passes in additional http_headers through these properties, which
# are merged with constructor defined http_headers. The interpretation of these properties
# are filesystem specific.
extra_props: Optional[FilesSourceProperties]
extra_props: Optional[FilesSourceProperties] = field(default_factory=lambda: FilesSourceProperties())


class SingleFileSource(metaclass=abc.ABCMeta):
Expand Down
Loading