Warning

This document is for an old release of Galaxy. You can alternatively view this page in the latest release if it exists or view the top of the latest release's documentation.

galaxy.files package

class galaxy.files.FileSourcePath(file_source, path)[source]

Bases: tuple

file_source: BaseFilesSource

Alias for field number 0

path: str

Alias for field number 1

class galaxy.files.FileSourceScore(file_source, score)[source]

Bases: tuple

file_source: BaseFilesSource

Alias for field number 0

score: int

Alias for field number 1

exception galaxy.files.NoMatchingFileSource[source]

Bases: Exception

class galaxy.files.ConfiguredFileSources(file_sources_config: ConfiguredFileSourcesConfig, conf_file=None, conf_dict=None, load_stock_plugins=False)[source]

Bases: object

Load plugins and resolve Galaxy URIs to FileSource objects.

__init__(file_sources_config: ConfiguredFileSourcesConfig, conf_file=None, conf_dict=None, load_stock_plugins=False)[source]
find_best_match(url: str)[source]

Returns the best matching file source for handling a particular url. Each filesource scores its own ability to match a particular url, and the highest scorer with a score > 0 is selected.

get_file_source_path(uri)[source]

Parse uri into a FileSource object and a path relative to its base.

validate_uri_root(uri, user_context)[source]
looks_like_uri(path_or_uri)[source]
plugins_to_dict(for_serialization: bool = False, user_context: FileSourceDictifiable | None = None, browsable_only: bool | None = False, include_kind: Set[PluginKind] | None = None, exclude_kind: Set[PluginKind] | None = None) List[Dict[str, Any]][source]
to_dict(for_serialization: bool = False, user_context: FileSourceDictifiable | None = None) Dict[str, Any][source]
static from_app_config(config)[source]
static from_dict(as_dict, load_stock_plugins=False)[source]
class galaxy.files.NullConfiguredFileSources[source]

Bases: ConfiguredFileSources

__init__()[source]
class galaxy.files.ConfiguredFileSourcesConfig(symlink_allowlist=None, fetch_url_allowlist=None, library_import_dir=None, user_library_import_dir=None, ftp_upload_dir=None, ftp_upload_purge=True)[source]

Bases: object

__init__(symlink_allowlist=None, fetch_url_allowlist=None, library_import_dir=None, user_library_import_dir=None, ftp_upload_dir=None, ftp_upload_purge=True)[source]
static from_app_config(config)[source]
to_dict()[source]
static from_dict(as_dict)[source]
class galaxy.files.FileSourceDictifiable[source]

Bases: Dictifiable

dict_collection_visible_keys = ('email', 'username', 'ftp_dir', 'preferences', 'is_admin')
to_dict(view='collection', value_mapper=None)[source]

Return item dictionary.

property role_names: Set[str]
property group_names: Set[str]
property file_sources

Return other filesources available in the system, for chained filesource resolution

class galaxy.files.ProvidesUserFileSourcesUserContext(trans, **kwargs)[source]

Bases: FileSourceDictifiable

Implement a FileSourcesUserContext from a Galaxy ProvidesUserContext (e.g. trans).

__init__(trans, **kwargs)[source]
property email
property username
property ftp_dir
property preferences
property role_names: Set[str]

The set of role names of this user.

property group_names: Set[str]

The set of group names to which this user belongs.

property is_admin

Whether this user is an administrator.

property user_vault

User vault namespace

property app_vault

App vault namespace

property file_sources

Return other filesources available in the system, for chained filesource resolution

class galaxy.files.DictFileSourcesUserContext(**kwd)[source]

Bases: FileSourceDictifiable

__init__(**kwd)[source]
property email
property username
property ftp_dir
property preferences
property role_names
property group_names
property is_admin
property user_vault
property app_vault
property file_sources

Return other filesources available in the system, for chained filesource resolution

Subpackages

Submodules

galaxy.files.uris module

galaxy.files.uris.stream_url_to_str(path: str, file_sources: ConfiguredFileSources | None = None, prefix: str = 'gx_file_stream') str[source]
galaxy.files.uris.stream_url_to_file(url: str, file_sources: ConfiguredFileSources | None = None, prefix: str = 'gx_file_stream', dir: str | None = None, user_context=None, target_path: str | None = None, file_source_opts: FilesSourceOptions | None = None) str[source]
galaxy.files.uris.stream_to_file(stream, suffix='', prefix='', dir=None, text=False, **kwd)[source]

Writes a stream to a temporary file, returns the temporary file’s name

galaxy.files.uris.validate_uri_access(uri: str, is_admin: bool, ip_allowlist: List[IPv4Address | IPv6Address | IPv4Network | IPv6Network]) None[source]

Perform uniform checks on supplied URIs.

  • Prevent access to local IPs not found in ip_allowlist.

  • Don’t allow non-admins to access file:// URIs.

galaxy.files.uris.split_port(parsed_url: str, url: str) Tuple[str, int][source]
galaxy.files.uris.validate_non_local(uri: str, ip_allowlist: List[IPv4Address | IPv6Address | IPv4Network | IPv6Network]) str[source]