From 720b678b8670cadb71fb7668dc7d461f88d69c19 Mon Sep 17 00:00:00 2001 From: nuwang <2070605+nuwang@users.noreply.github.com> Date: Fri, 9 Feb 2024 15:57:29 +0530 Subject: [PATCH] Use dataclass to initialize default values --- lib/galaxy/files/sources/__init__.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/lib/galaxy/files/sources/__init__.py b/lib/galaxy/files/sources/__init__.py index 7c6f575d7690..63cddab44f1d 100644 --- a/lib/galaxy/files/sources/__init__.py +++ b/lib/galaxy/files/sources/__init__.py @@ -1,4 +1,5 @@ import abc +from dataclasses import dataclass, field import os import time from enum import Enum @@ -88,6 +89,7 @@ class FilesSourceProperties(TypedDict): browsable: NotRequired[bool] +@dataclass class FilesSourceOptions: """Options to control behavior of file source operations, such as realize_to, write_from and list.""" @@ -100,7 +102,7 @@ class FilesSourceOptions: # 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: {}) class EntryData(TypedDict):