Skip to content

Commit

Permalink
Merge pull request #17445 from nuwang/make_extra_props_more_defensive
Browse files Browse the repository at this point in the history
More defensive access of extra props in filesources
  • Loading branch information
mvdbeek authored Feb 10, 2024
2 parents 7bffadb + c7a5e4f commit 9d0a200
Showing 1 changed file with 12 additions and 2 deletions.
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

0 comments on commit 9d0a200

Please sign in to comment.