index int64 0 50.7k | project_path stringclasses 279
values | completion_path stringlengths 57 199 | signature_postion stringlengths 3 11 | class_position stringlengths 3 11 | function_name stringlengths 1 62 | class_name stringlengths 0 55 | body_position stringlengths 3 11 | body_position_with_comments stringlengths 3 11 | masked_class stringlengths 14 8.32k | masked_class_with_comment stringlengths 14 8.32k | func_body stringlengths 9 6.72k | func_body_with_comment stringlengths 9 6.72k | len_func_body int64 1 643 | len_input int64 10 2.02k | len_output int64 4 1.9k | total int64 20 2.05k | file_code stringlengths 14 442k | file_code_with_comment stringlengths 14 442k |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
46,269 | /home/hieuvd/dung_repo/raw/stars_03/galaxyproject_galaxy/galaxy | /home/hieuvd/dung_repo/raw/stars_03/galaxyproject_galaxy/galaxy/lib/galaxy/tool_util/toolbox/parser.py | 140,141 | 1,174 | ensure_tool_conf_item | 141,162 | 141,162 | """This module is used to parse tool_conf files.
These files define tool lists, sections, labels, etc... the elements of the
Galaxy tool panel.
"""
from abc import (
ABCMeta,
abstractmethod,
)
import yaml
from galaxy.util import (
parse_xml,
string_as_bool,
)
from galaxy.util.path import StrPath
DE... | """This module is used to parse tool_conf files.
These files define tool lists, sections, labels, etc... the elements of the
Galaxy tool panel.
"""
from abc import (
ABCMeta,
abstractmethod,
)
import yaml
from galaxy.util import (
parse_xml,
string_as_bool,
)
from galaxy.util.path import StrPath
DE... | if xml_or_item is None:
return None
elif isinstance(xml_or_item, ToolConfItem):
return xml_or_item
elif isinstance(xml_or_item, dict):
# TODO: handle sections...
as_dict = xml_or_item.copy()
type = as_dict.pop("type")
attributes = as_dict
return ToolCo... | if xml_or_item is None:
return None
elif isinstance(xml_or_item, ToolConfItem):
return xml_or_item
elif isinstance(xml_or_item, dict):
# TODO: handle sections...
as_dict = xml_or_item.copy()
type = as_dict.pop("type")
attributes = as_dict
return ToolCo... | 61 | 1,288 | 218 | 1,506 | """This module is used to parse tool_conf files.
These files define tool lists, sections, labels, etc... the elements of the
Galaxy tool panel.
"""
from abc import (
ABCMeta,
abstractmethod,
)
import yaml
from galaxy.util import (
parse_xml,
string_as_bool,
)
from galaxy.util.path import StrPath
DE... | """This module is used to parse tool_conf files.
These files define tool lists, sections, labels, etc... the elements of the
Galaxy tool panel.
"""
from abc import (
ABCMeta,
abstractmethod,
)
import yaml
from galaxy.util import (
parse_xml,
string_as_bool,
)
from galaxy.util.path import StrPath
DE... | |
46,270 | /home/hieuvd/dung_repo/raw/stars_03/galaxyproject_galaxy/galaxy | /home/hieuvd/dung_repo/raw/stars_03/galaxyproject_galaxy/galaxy/lib/galaxy/tool_util/toolbox/parser.py | 116,118 | 88,134 | has_elem | ToolConfItem | 118,120 | 118,120 | class ToolConfItem:
"""Abstract description of a tool conf item.
These may include tools, labels, sections, and workflows.
"""
def __init__(self, type, attributes, elem=None):
self.type = type
self.attributes = attributes
self._elem = elem
@classmethod
def from_dict(cl... | class ToolConfItem:
"""Abstract description of a tool conf item.
These may include tools, labels, sections, and workflows.
"""
def __init__(self, type, attributes, elem=None):
self.type = type
self.attributes = attributes
self._elem = elem
@classmethod
def from_dict(cl... | return self._elem is not None
| return self._elem is not None
| 5 | 358 | 12 | 370 | """This module is used to parse tool_conf files.
These files define tool lists, sections, labels, etc... the elements of the
Galaxy tool panel.
"""
from abc import (
ABCMeta,
abstractmethod,
)
import yaml
from galaxy.util import (
parse_xml,
string_as_bool,
)
from galaxy.util.path import StrPath
DE... | """This module is used to parse tool_conf files.
These files define tool lists, sections, labels, etc... the elements of the
Galaxy tool panel.
"""
from abc import (
ABCMeta,
abstractmethod,
)
import yaml
from galaxy.util import (
parse_xml,
string_as_bool,
)
from galaxy.util.path import StrPath
DE... |
46,271 | /home/hieuvd/dung_repo/raw/stars_03/galaxyproject_galaxy/galaxy | /home/hieuvd/dung_repo/raw/stars_03/galaxyproject_galaxy/galaxy/lib/galaxy/tool_util/toolbox/parser.py | 38,39 | 23,43 | parse_monitor | ToolConfSource | 40,43 | 39,43 | class ToolConfSource(metaclass=ABCMeta):
"""Interface represents a container of tool references."""
@abstractmethod
def parse_items(self):
"""Return a list of ToolConfItem describing source."""
@abstractmethod
def parse_tool_path(self):
"""Return tool_path for tools in this toolbox... | class ToolConfSource(metaclass=ABCMeta):
"""Interface represents a container of tool references."""
@abstractmethod
def parse_items(self):
"""Return a list of ToolConfItem describing source."""
@abstractmethod
def parse_tool_path(self):
"""Return tool_path for tools in this toolbox... | return DEFAULT_MONITOR
| """Monitor the toolbox configuration source for changes and reload."""
return DEFAULT_MONITOR
| 2 | 159 | 13 | 172 | """This module is used to parse tool_conf files.
These files define tool lists, sections, labels, etc... the elements of the
Galaxy tool panel.
"""
from abc import (
ABCMeta,
abstractmethod,
)
import yaml
from galaxy.util import (
parse_xml,
string_as_bool,
)
from galaxy.util.path import StrPath
DE... | """This module is used to parse tool_conf files.
These files define tool lists, sections, labels, etc... the elements of the
Galaxy tool panel.
"""
from abc import (
ABCMeta,
abstractmethod,
)
import yaml
from galaxy.util import (
parse_xml,
string_as_bool,
)
from galaxy.util.path import StrPath
DE... |
46,272 | /home/hieuvd/dung_repo/raw/stars_03/galaxyproject_galaxy/galaxy | /home/hieuvd/dung_repo/raw/stars_03/galaxyproject_galaxy/galaxy/lib/galaxy/tool_util/toolbox/parser.py | 57,58 | 43,66 | is_shed_tool_conf | XmlToolConfSource | 58,62 | 58,62 | class XmlToolConfSource(ToolConfSource):
def __init__(self, config_filename: StrPath):
tree = parse_xml(config_filename)
self.root = tree.getroot()
def parse_tool_path(self):
return self.root.get("tool_path")
def parse_tool_cache_data_dir(self):
return self.root.get("tool_c... | class XmlToolConfSource(ToolConfSource):
def __init__(self, config_filename: StrPath):
tree = parse_xml(config_filename)
self.root = tree.getroot()
def parse_tool_path(self):
return self.root.get("tool_path")
def parse_tool_cache_data_dir(self):
return self.root.get("tool_c... | has_tool_path = self.parse_tool_path() is not None
is_shed_conf = string_as_bool(self.root.get("is_shed_conf", "True"))
return has_tool_path and is_shed_conf
| has_tool_path = self.parse_tool_path() is not None
is_shed_conf = string_as_bool(self.root.get("is_shed_conf", "True"))
return has_tool_path and is_shed_conf
| 14 | 197 | 70 | 267 | """This module is used to parse tool_conf files.
These files define tool lists, sections, labels, etc... the elements of the
Galaxy tool panel.
"""
from abc import (
ABCMeta,
abstractmethod,
)
import yaml
from galaxy.util import (
parse_xml,
string_as_bool,
)
from galaxy.util.path import StrPath
DE... | """This module is used to parse tool_conf files.
These files define tool lists, sections, labels, etc... the elements of the
Galaxy tool panel.
"""
from abc import (
ABCMeta,
abstractmethod,
)
import yaml
from galaxy.util import (
parse_xml,
string_as_bool,
)
from galaxy.util.path import StrPath
DE... |
46,273 | /home/hieuvd/dung_repo/raw/stars_03/galaxyproject_galaxy/galaxy | /home/hieuvd/dung_repo/raw/stars_03/galaxyproject_galaxy/galaxy/lib/galaxy/tool_util/toolbox/parser.py | 78,79 | 66,88 | parse_items | YamlToolConfSource | 79,81 | 79,81 | class YamlToolConfSource(ToolConfSource):
def __init__(self, config_filename: StrPath):
with open(config_filename) as f:
as_dict = yaml.safe_load(f)
self.as_dict = as_dict
def parse_tool_path(self):
return self.as_dict.get("tool_path")
def parse_tool_cache_data_dir(self... | class YamlToolConfSource(ToolConfSource):
def __init__(self, config_filename: StrPath):
with open(config_filename) as f:
as_dict = yaml.safe_load(f)
self.as_dict = as_dict
def parse_tool_path(self):
return self.as_dict.get("tool_path")
def parse_tool_cache_data_dir(self... | return [ToolConfItem.from_dict(_) for _ in self.as_dict.get("items")]
| return [ToolConfItem.from_dict(_) for _ in self.as_dict.get("items")]
| 6 | 196 | 29 | 225 | """This module is used to parse tool_conf files.
These files define tool lists, sections, labels, etc... the elements of the
Galaxy tool panel.
"""
from abc import (
ABCMeta,
abstractmethod,
)
import yaml
from galaxy.util import (
parse_xml,
string_as_bool,
)
from galaxy.util.path import StrPath
DE... | """This module is used to parse tool_conf files.
These files define tool lists, sections, labels, etc... the elements of the
Galaxy tool panel.
"""
from abc import (
ABCMeta,
abstractmethod,
)
import yaml
from galaxy.util import (
parse_xml,
string_as_bool,
)
from galaxy.util.path import StrPath
DE... |
46,274 | /home/hieuvd/dung_repo/raw/stars_03/galaxyproject_galaxy/galaxy | /home/hieuvd/dung_repo/raw/stars_03/galaxyproject_galaxy/galaxy/lib/galaxy/tool_util/toolbox/views/definitions.py | 90,92 | 87,119 | items_expanded | HasItems | 92,119 | 92,119 | class HasItems:
items: Optional[List[Any]]
@property
def items_expanded(self) -> Optional[List["ExpandedRootContent"]]:
FILL_FUNC_BODY | class HasItems:
items: Optional[List[Any]]
@property
def items_expanded(self) -> Optional[List["ExpandedRootContent"]]:
FILL_FUNC_BODY | if self.items is None:
return None
# replace SectionAliases with individual SectionAlias objects
# replace LabelShortcuts with Labels
items: List[ExpandedRootContent] = []
for item in self.items:
item = cast(RootContent, item)
if isinstance(it... | if self.items is None:
return None
# replace SectionAliases with individual SectionAlias objects
# replace LabelShortcuts with Labels
items: List[ExpandedRootContent] = []
for item in self.items:
item = cast(RootContent, item)
if isinstance(it... | 59 | 52 | 231 | 283 | from enum import Enum
from typing import (
Any,
cast,
List,
Optional,
Union,
)
from pydantic import (
BaseModel,
ConfigDict,
Field,
)
from typing_extensions import (
Annotated,
Literal,
)
class StaticToolBoxViewTypeEnum(str, Enum):
generic = "generic"
activity = "activ... | from enum import Enum
from typing import (
Any,
cast,
List,
Optional,
Union,
)
from pydantic import (
BaseModel,
ConfigDict,
Field,
)
from typing_extensions import (
Annotated,
Literal,
)
class StaticToolBoxViewTypeEnum(str, Enum):
generic = "generic"
activity = "activ... |
46,275 | /home/hieuvd/dung_repo/raw/stars_03/galaxyproject_galaxy/galaxy | /home/hieuvd/dung_repo/raw/stars_03/galaxyproject_galaxy/galaxy/lib/galaxy/tool_util/toolbox/views/definitions.py | 169,171 | 161,174 | from_dict | StaticToolBoxView | 171,173 | 171,173 | class StaticToolBoxView(BaseModel, HasItems):
id: str
name: str
description: Optional[str] = None
view_type: StaticToolBoxViewTypeEnum = Field(alias="type")
items: Optional[List[RootContent]] = None # if empty, use integrated tool panel
excludes: OptionalExclusionList
@staticmethod
def... | class StaticToolBoxView(BaseModel, HasItems):
id: str
name: str
description: Optional[str] = None
view_type: StaticToolBoxViewTypeEnum = Field(alias="type")
items: Optional[List[RootContent]] = None # if empty, use integrated tool panel
excludes: OptionalExclusionList
@staticmethod
def... | return StaticToolBoxView(**as_dict)
| return StaticToolBoxView(**as_dict)
| 2 | 132 | 17 | 149 | from enum import Enum
from typing import (
Any,
cast,
List,
Optional,
Union,
)
from pydantic import (
BaseModel,
ConfigDict,
Field,
)
from typing_extensions import (
Annotated,
Literal,
)
class StaticToolBoxViewTypeEnum(str, Enum):
generic = "generic"
activity = "activ... | from enum import Enum
from typing import (
Any,
cast,
List,
Optional,
Union,
)
from pydantic import (
BaseModel,
ConfigDict,
Field,
)
from typing_extensions import (
Annotated,
Literal,
)
class StaticToolBoxViewTypeEnum(str, Enum):
generic = "generic"
activity = "activ... |
46,276 | /home/hieuvd/dung_repo/raw/stars_03/galaxyproject_galaxy/galaxy | /home/hieuvd/dung_repo/raw/stars_03/galaxyproject_galaxy/galaxy/lib/galaxy/tool_util/toolbox/views/edam.py | 42,43 | 35,180 | apply_view | EdamToolPanelView | 43,132 | 43,132 | class EdamToolPanelView(ToolPanelView):
def __init__(self, edam: Dict[str, Dict], mode: EdamPanelMode = EdamPanelMode.merged):
self.edam = edam
self.mode = mode
self.include_topics = mode in [EdamPanelMode.merged, EdamPanelMode.topics]
self.include_operations = mode in [EdamPanelMode... | class EdamToolPanelView(ToolPanelView):
def __init__(self, edam: Dict[str, Dict], mode: EdamPanelMode = EdamPanelMode.merged):
self.edam = edam
self.mode = mode
self.include_topics = mode in [EdamPanelMode.merged, EdamPanelMode.topics]
self.include_operations = mode in [EdamPanelMode... | execution_timer = ExecutionTimer()
# Find the children of the top level topics
operations_list = [ROOT_OPERATION] + list(self._edam_children_of(ROOT_OPERATION))
topics_list = [ROOT_TOPIC] + list(self._edam_children_of(ROOT_TOPIC))
# Sort them (by english label)
# operat... | execution_timer = ExecutionTimer()
# Find the children of the top level topics
operations_list = [ROOT_OPERATION] + list(self._edam_children_of(ROOT_OPERATION))
topics_list = [ROOT_TOPIC] + list(self._edam_children_of(ROOT_TOPIC))
# Sort them (by english label)
# operat... | 276 | 692 | 1,244 | 1,936 | import logging
from enum import Enum
from typing import (
Dict,
List,
Tuple,
)
from galaxy.tool_util.edam_util import (
ROOT_OPERATION,
ROOT_TOPIC,
)
from galaxy.util import ExecutionTimer
from .interface import (
ToolBoxRegistry,
ToolPanelView,
ToolPanelViewModel,
ToolPanelViewMode... | import logging
from enum import Enum
from typing import (
Dict,
List,
Tuple,
)
from galaxy.tool_util.edam_util import (
ROOT_OPERATION,
ROOT_TOPIC,
)
from galaxy.util import ExecutionTimer
from .interface import (
ToolBoxRegistry,
ToolPanelView,
ToolPanelViewModel,
ToolPanelViewMode... |
46,277 | /home/hieuvd/dung_repo/raw/stars_03/galaxyproject_galaxy/galaxy | /home/hieuvd/dung_repo/raw/stars_03/galaxyproject_galaxy/galaxy/lib/galaxy/tool_util/toolbox/views/interface.py | 68,69 | 1,80 | walk_loaded_tools | 69,80 | 69,80 | from abc import abstractmethod
from enum import Enum
from typing import Optional
from pydantic import (
BaseModel,
ConfigDict,
)
from ..panel import (
HasPanelItems,
panel_item_types,
ToolPanelElements,
)
class ToolPanelViewModelType(str, Enum):
default_type = "default"
generic = "generi... | from abc import abstractmethod
from enum import Enum
from typing import Optional
from pydantic import (
BaseModel,
ConfigDict,
)
from ..panel import (
HasPanelItems,
panel_item_types,
ToolPanelElements,
)
class ToolPanelViewModelType(str, Enum):
default_type = "default"
generic = "generi... | for key, item_type, val in tool_panel.panel_items_iter():
if item_type == panel_item_types.TOOL:
tool_id = key.replace("tool_", "", 1)
if toolbox_registry.has_tool(tool_id):
yield (tool_id, key, val, val.name)
elif item_type == panel_item_types.SECTION:
... | for key, item_type, val in tool_panel.panel_items_iter():
if item_type == panel_item_types.TOOL:
tool_id = key.replace("tool_", "", 1)
if toolbox_registry.has_tool(tool_id):
yield (tool_id, key, val, val.name)
elif item_type == panel_item_types.SECTION:
... | 48 | 568 | 211 | 779 | from abc import abstractmethod
from enum import Enum
from typing import Optional
from pydantic import (
BaseModel,
ConfigDict,
)
from ..panel import (
HasPanelItems,
panel_item_types,
ToolPanelElements,
)
class ToolPanelViewModelType(str, Enum):
default_type = "default"
generic = "generi... | from abc import abstractmethod
from enum import Enum
from typing import Optional
from pydantic import (
BaseModel,
ConfigDict,
)
from ..panel import (
HasPanelItems,
panel_item_types,
ToolPanelElements,
)
class ToolPanelViewModelType(str, Enum):
default_type = "default"
generic = "generi... | |
46,278 | /home/hieuvd/dung_repo/raw/stars_03/galaxyproject_galaxy/galaxy | /home/hieuvd/dung_repo/raw/stars_03/galaxyproject_galaxy/galaxy/lib/galaxy/tool_util/toolbox/views/sources.py | 51,52 | 1,56 | looks_like_view_source_filename | 52,56 | 52,56 | import logging
import os
from typing import (
Dict,
List,
)
import yaml
from galaxy.util import config_directories_from_setting
from .definitions import StaticToolBoxView
log = logging.getLogger(__name__)
EXTENSIONS = [".yml", ".yaml", ".json"]
class StaticToolBoxViewSources:
view_directories: List[st... | import logging
import os
from typing import (
Dict,
List,
)
import yaml
from galaxy.util import config_directories_from_setting
from .definitions import StaticToolBoxView
log = logging.getLogger(__name__)
EXTENSIONS = [".yml", ".yaml", ".json"]
class StaticToolBoxViewSources:
view_directories: List[st... | for ext in EXTENSIONS:
if filename.endswith(ext):
return True
return False
| for ext in EXTENSIONS:
if filename.endswith(ext):
return True
return False
| 10 | 480 | 34 | 514 | import logging
import os
from typing import (
Dict,
List,
)
import yaml
from galaxy.util import config_directories_from_setting
from .definitions import StaticToolBoxView
log = logging.getLogger(__name__)
EXTENSIONS = [".yml", ".yaml", ".json"]
class StaticToolBoxViewSources:
view_directories: List[st... | import logging
import os
from typing import (
Dict,
List,
)
import yaml
from galaxy.util import config_directories_from_setting
from .definitions import StaticToolBoxView
log = logging.getLogger(__name__)
EXTENSIONS = [".yml", ".yaml", ".json"]
class StaticToolBoxViewSources:
view_directories: List[st... | |
46,279 | /home/hieuvd/dung_repo/raw/stars_03/galaxyproject_galaxy/galaxy | /home/hieuvd/dung_repo/raw/stars_03/galaxyproject_galaxy/galaxy/lib/galaxy/tool_util/toolbox/views/sources.py | 26,27 | 18,51 | get_definitions | StaticToolBoxViewSources | 27,51 | 27,51 | class StaticToolBoxViewSources:
view_directories: List[str]
view_dicts: List[Dict]
def __init__(self, view_directories=None, view_dicts=None):
self.view_directories = config_directories_from_setting(view_directories) or []
self.view_dicts = view_dicts or []
def get_definitions(self) ->... | class StaticToolBoxViewSources:
view_directories: List[str]
view_dicts: List[Dict]
def __init__(self, view_directories=None, view_dicts=None):
self.view_directories = config_directories_from_setting(view_directories) or []
self.view_dicts = view_dicts or []
def get_definitions(self) ->... | view_definitions = []
for view_dict in self.view_dicts:
view_definitions.append(StaticToolBoxView.from_dict(view_dict))
for view_directory in self.view_directories:
if not os.path.exists(view_directory):
log.warning(f"Failed to find toolbox view director... | view_definitions = []
for view_dict in self.view_dicts:
view_definitions.append(StaticToolBoxView.from_dict(view_dict))
for view_directory in self.view_directories:
if not os.path.exists(view_directory):
log.warning(f"Failed to find toolbox view director... | 55 | 126 | 273 | 399 | import logging
import os
from typing import (
Dict,
List,
)
import yaml
from galaxy.util import config_directories_from_setting
from .definitions import StaticToolBoxView
log = logging.getLogger(__name__)
EXTENSIONS = [".yml", ".yaml", ".json"]
class StaticToolBoxViewSources:
view_directories: List[st... | import logging
import os
from typing import (
Dict,
List,
)
import yaml
from galaxy.util import config_directories_from_setting
from .definitions import StaticToolBoxView
log = logging.getLogger(__name__)
EXTENSIONS = [".yml", ".yaml", ".json"]
class StaticToolBoxViewSources:
view_directories: List[st... |
46,281 | /home/hieuvd/dung_repo/raw/stars_03/galaxyproject_galaxy/galaxy | /home/hieuvd/dung_repo/raw/stars_03/galaxyproject_galaxy/galaxy/lib/galaxy/tool_util/toolbox/views/static.py | 70,71 | 64,218 | apply_view | StaticToolPanelView | 71,198 | 71,198 | class StaticToolPanelView(ToolPanelView):
_definition: StaticToolBoxView
def __init__(self, definition: StaticToolBoxView):
self._definition = definition
def apply_view(self, base_tool_panel: ToolPanelElements, toolbox_registry: ToolBoxRegistry) -> ToolPanelElements:
FILL_FUNC_BODY def _all_exc... | class StaticToolPanelView(ToolPanelView):
_definition: StaticToolBoxView
def __init__(self, definition: StaticToolBoxView):
self._definition = definition
def apply_view(self, base_tool_panel: ToolPanelElements, toolbox_registry: ToolBoxRegistry) -> ToolPanelElements:
FILL_FUNC_BODY def _all_exc... | def apply_filter(definition, elems):
excludes = self._all_excludes(definition)
if excludes:
elems.apply_filter(build_filter(excludes))
def definition_with_items_to_panel(definition, allow_sections: bool = True, items=None):
new_panel = ToolPanelElemen... | def apply_filter(definition, elems):
excludes = self._all_excludes(definition)
if excludes:
elems.apply_filter(build_filter(excludes))
def definition_with_items_to_panel(definition, allow_sections: bool = True, items=None):
new_panel = ToolPanelElemen... | 416 | 300 | 1,575 | 1,875 | import logging
import re
from typing import Optional
from .definitions import (
ExcludeTool,
ExcludeToolRegex,
ExcludeTypes,
ExpandedRootContent,
Label,
Section,
SectionAlias,
StaticToolBoxView,
Tool,
Workflow,
)
from .interface import (
ToolBoxRegistry,
ToolPanelView,
... | import logging
import re
from typing import Optional
from .definitions import (
ExcludeTool,
ExcludeToolRegex,
ExcludeTypes,
ExpandedRootContent,
Label,
Section,
SectionAlias,
StaticToolBoxView,
Tool,
Workflow,
)
from .interface import (
ToolBoxRegistry,
ToolPanelView,
... |
46,282 | /home/hieuvd/dung_repo/raw/stars_03/galaxyproject_galaxy/galaxy | /home/hieuvd/dung_repo/raw/stars_03/galaxyproject_galaxy/galaxy/lib/galaxy/tool_util/toolbox/watcher.py | 24,25 | 1,181 | get_tool_watcher | 25,34 | 25,34 | import logging
import os.path
import threading
try:
from watchdog.events import FileSystemEventHandler
except ImportError:
FileSystemEventHandler = object # type:ignore[assignment, misc, unused-ignore]
from galaxy.util.hash_util import md5_hash_file
from galaxy.util.watcher import (
BaseWatcher,
get_... | import logging
import os.path
import threading
try:
from watchdog.events import FileSystemEventHandler
except ImportError:
FileSystemEventHandler = object # type:ignore[assignment, misc, unused-ignore]
from galaxy.util.hash_util import md5_hash_file
from galaxy.util.watcher import (
BaseWatcher,
get_... | config_name = "watch_tools"
config_value = getattr(config, config_name, None)
observer_class = get_observer_class(config_name, config_value, default="False", monitor_what_str="tools")
if observer_class is not None:
return ToolWatcher(observer_class=observer_class, event_handler_class=ToolFileEve... | config_name = "watch_tools"
config_value = getattr(config, config_name, None)
observer_class = get_observer_class(config_name, config_value, default="False", monitor_what_str="tools")
if observer_class is not None:
return ToolWatcher(observer_class=observer_class, event_handler_class=ToolFileEve... | 26 | 1,757 | 131 | 1,888 | import logging
import os.path
import threading
try:
from watchdog.events import FileSystemEventHandler
except ImportError:
FileSystemEventHandler = object # type:ignore[assignment, misc, unused-ignore]
from galaxy.util.hash_util import md5_hash_file
from galaxy.util.watcher import (
BaseWatcher,
get_... | import logging
import os.path
import threading
try:
from watchdog.events import FileSystemEventHandler
except ImportError:
FileSystemEventHandler = object # type:ignore[assignment, misc, unused-ignore]
from galaxy.util.hash_util import md5_hash_file
from galaxy.util.watcher import (
BaseWatcher,
get_... | |
46,283 | /home/hieuvd/dung_repo/raw/stars_03/galaxyproject_galaxy/galaxy | /home/hieuvd/dung_repo/raw/stars_03/galaxyproject_galaxy/galaxy/lib/galaxy/tool_util/toolbox/watcher.py | 91,92 | 63,162 | check | ToolConfWatcher | 93,151 | 92,151 | class ToolConfWatcher:
def __init__(self, reload_callback, tool_cache=None):
self.paths = {}
self.cache = tool_cache
self._active = False
self._lock = threading.Lock()
self.thread = None
self.reload_callback = reload_callback
def start(self):
if not self... | class ToolConfWatcher:
def __init__(self, reload_callback, tool_cache=None):
self.paths = {}
self.cache = tool_cache
self._active = False
self._lock = threading.Lock()
self.thread = None
self.reload_callback = reload_callback
def start(self):
if not self... | hashes = {}
if self.cache:
self.cache.assert_hashes_initialized()
while self._active and not self.exit.is_set():
do_reload = False
drop_on_next_loop = set()
drop_now = set()
with self._lock:
paths = list(self.paths.keys(... | """Check for changes in self.paths or self.cache and call the event handler."""
hashes = {}
if self.cache:
self.cache.assert_hashes_initialized()
while self._active and not self.exit.is_set():
do_reload = False
drop_on_next_loop = set()
dro... | 201 | 353 | 679 | 1,032 | import logging
import os.path
import threading
try:
from watchdog.events import FileSystemEventHandler
except ImportError:
FileSystemEventHandler = object # type:ignore[assignment, misc, unused-ignore]
from galaxy.util.hash_util import md5_hash_file
from galaxy.util.watcher import (
BaseWatcher,
get_... | import logging
import os.path
import threading
try:
from watchdog.events import FileSystemEventHandler
except ImportError:
FileSystemEventHandler = object # type:ignore[assignment, misc, unused-ignore]
from galaxy.util.hash_util import md5_hash_file
from galaxy.util.watcher import (
BaseWatcher,
get_... |
46,284 | /home/hieuvd/dung_repo/raw/stars_03/galaxyproject_galaxy/galaxy | /home/hieuvd/dung_repo/raw/stars_03/galaxyproject_galaxy/galaxy/lib/galaxy/tool_util/toolbox/watcher.py | 41,42 | 34,63 | _handle | ToolFileEventHandler | 42,63 | 42,63 | class ToolFileEventHandler(FileSystemEventHandler):
def __init__(self, tool_watcher):
self.tool_watcher = tool_watcher
def on_any_event(self, event):
self._handle(event)
def _handle(self, event):
FILL_FUNC_BODY | class ToolFileEventHandler(FileSystemEventHandler):
def __init__(self, tool_watcher):
self.tool_watcher = tool_watcher
def on_any_event(self, event):
self._handle(event)
def _handle(self, event):
FILL_FUNC_BODY | # modified events will only have src path, move events will
# have dest_path and src_path but we only care about dest. So
# look at dest if it exists else use src.
path = getattr(event, "dest_path", None) or event.src_path
path = os.path.abspath(path)
tool_id = self.tool_... | # modified events will only have src path, move events will
# have dest_path and src_path but we only care about dest. So
# look at dest if it exists else use src.
path = getattr(event, "dest_path", None) or event.src_path
path = os.path.abspath(path)
tool_id = self.tool_... | 76 | 81 | 287 | 368 | import logging
import os.path
import threading
try:
from watchdog.events import FileSystemEventHandler
except ImportError:
FileSystemEventHandler = object # type:ignore[assignment, misc, unused-ignore]
from galaxy.util.hash_util import md5_hash_file
from galaxy.util.watcher import (
BaseWatcher,
get_... | import logging
import os.path
import threading
try:
from watchdog.events import FileSystemEventHandler
except ImportError:
FileSystemEventHandler = object # type:ignore[assignment, misc, unused-ignore]
from galaxy.util.hash_util import md5_hash_file
from galaxy.util.watcher import (
BaseWatcher,
get_... |
46,285 | /home/hieuvd/dung_repo/raw/stars_03/galaxyproject_galaxy/galaxy | /home/hieuvd/dung_repo/raw/stars_03/galaxyproject_galaxy/galaxy/lib/galaxy/tool_util/toolbox/watcher.py | 169,170 | 162,181 | watch_file | ToolWatcher | 170,176 | 170,176 | class ToolWatcher(BaseWatcher):
def __init__(self, observer_class, event_handler_class, toolbox):
super().__init__(observer_class, event_handler_class)
self.toolbox = toolbox
self.tool_file_ids = {}
self.tool_dir_callbacks = {}
def watch_file(self, tool_file, tool_id):
FILL_FUNC... | class ToolWatcher(BaseWatcher):
def __init__(self, observer_class, event_handler_class, toolbox):
super().__init__(observer_class, event_handler_class)
self.toolbox = toolbox
self.tool_file_ids = {}
self.tool_dir_callbacks = {}
def watch_file(self, tool_file, tool_id):
FILL_FUNC... | tool_file = os.path.abspath(tool_file)
self.tool_file_ids[tool_file] = tool_id
tool_dir = os.path.dirname(tool_file)
if tool_dir not in self.monitored_dirs:
self.monitor(tool_dir)
| tool_file = os.path.abspath(tool_file)
self.tool_file_ids[tool_file] = tool_id
tool_dir = os.path.dirname(tool_file)
if tool_dir not in self.monitored_dirs:
self.monitor(tool_dir)
| 15 | 188 | 87 | 275 | import logging
import os.path
import threading
try:
from watchdog.events import FileSystemEventHandler
except ImportError:
FileSystemEventHandler = object # type:ignore[assignment, misc, unused-ignore]
from galaxy.util.hash_util import md5_hash_file
from galaxy.util.watcher import (
BaseWatcher,
get_... | import logging
import os.path
import threading
try:
from watchdog.events import FileSystemEventHandler
except ImportError:
FileSystemEventHandler = object # type:ignore[assignment, misc, unused-ignore]
from galaxy.util.hash_util import md5_hash_file
from galaxy.util.watcher import (
BaseWatcher,
get_... |
46,286 | /home/hieuvd/dung_repo/raw/stars_03/galaxyproject_galaxy/galaxy | /home/hieuvd/dung_repo/raw/stars_03/galaxyproject_galaxy/galaxy/lib/galaxy/tool_util/verify/asserts/_util.py | 13,23 | 1,98 | _assert_number | 34,59 | 23,59 | from math import inf
from typing import (
Callable,
Optional,
TypeVar,
Union,
)
from galaxy.util import asbool
from galaxy.util.bytesize import parse_bytesize
def _assert_number(
count: int,
n: Optional[Union[int, str]],
delta: Union[int, str],
min: Optional[Union[int, str]],
max:... | from math import inf
from typing import (
Callable,
Optional,
TypeVar,
Union,
)
from galaxy.util import asbool
from galaxy.util.bytesize import parse_bytesize
def _assert_number(
count: int,
n: Optional[Union[int, str]],
delta: Union[int, str],
min: Optional[Union[int, str]],
max:... | negate = asbool(negate)
expected = "Expected" if not negate else "Did not expect"
if n is not None:
n_bytes = parse_bytesize(n)
delta_bytes = parse_bytesize(delta)
assert (not negate) == (abs(count - n_bytes) <= delta_bytes), (
n_text.format(expected=expected, n=n, delta=... | """
helper function for assering that count is in
- [n-delta:n+delta]
- [min:max]
raising an assertion error using n_text and min_max_text (resp)
substituting {n}, {delta}, {min}, and {max}
(and keeping potentially present {text} and {output})
n, delta, min, max can be suffixed by (K|M... | 108 | 754 | 325 | 1,079 | from math import inf
from typing import (
Callable,
Optional,
TypeVar,
Union,
)
from galaxy.util import asbool
from galaxy.util.bytesize import parse_bytesize
def _assert_number(
count: int,
n: Optional[Union[int, str]],
delta: Union[int, str],
min: Optional[Union[int, str]],
max:... | from math import inf
from typing import (
Callable,
Optional,
TypeVar,
Union,
)
from galaxy.util import asbool
from galaxy.util.bytesize import parse_bytesize
def _assert_number(
count: int,
n: Optional[Union[int, str]],
delta: Union[int, str],
min: Optional[Union[int, str]],
max:... | |
46,287 | /home/hieuvd/dung_repo/raw/stars_03/galaxyproject_galaxy/galaxy | /home/hieuvd/dung_repo/raw/stars_03/galaxyproject_galaxy/galaxy/lib/galaxy/tool_util/verify/asserts/hdf5.py | 16,17 | 1,45 | assert_has_h5_attribute | 19,28 | 17,28 | import io
try:
import h5py
except ImportError:
h5py = None
IMPORT_MISSING_MESSAGE = "h5 assertion requires unavailable optional dependency h5py"
def _assert_h5py():
if h5py is None:
raise Exception(IMPORT_MISSING_MESSAGE)
def assert_has_h5_attribute(output_bytes: bytes, key: str, value: str) -... | import io
try:
import h5py
except ImportError:
h5py = None
IMPORT_MISSING_MESSAGE = "h5 assertion requires unavailable optional dependency h5py"
def _assert_h5py():
if h5py is None:
raise Exception(IMPORT_MISSING_MESSAGE)
def assert_has_h5_attribute(output_bytes: bytes, key: str, value: str) -... | _assert_h5py()
output_temp = io.BytesIO(output_bytes)
local_attrs = h5py.File(output_temp, "r").attrs
assert (
key in local_attrs and str(local_attrs[key]) == value
), f"Not a HDF5 file or H5 attributes do not match:\n\t{list(local_attrs.items())}\n\n\t({key} : {value})"
# TODO the functio... | """Asserts the specified HDF5 output has a given key-value pair as HDF5
attribute"""
_assert_h5py()
output_temp = io.BytesIO(output_bytes)
local_attrs = h5py.File(output_temp, "r").attrs
assert (
key in local_attrs and str(local_attrs[key]) == value
), f"Not a HDF5 file or H5 attribu... | 45 | 366 | 145 | 511 | import io
try:
import h5py
except ImportError:
h5py = None
IMPORT_MISSING_MESSAGE = "h5 assertion requires unavailable optional dependency h5py"
def _assert_h5py():
if h5py is None:
raise Exception(IMPORT_MISSING_MESSAGE)
def assert_has_h5_attribute(output_bytes: bytes, key: str, value: str) -... | import io
try:
import h5py
except ImportError:
h5py = None
IMPORT_MISSING_MESSAGE = "h5 assertion requires unavailable optional dependency h5py"
def _assert_h5py():
if h5py is None:
raise Exception(IMPORT_MISSING_MESSAGE)
def assert_has_h5_attribute(output_bytes: bytes, key: str, value: str) -... | |
46,289 | /home/hieuvd/dung_repo/raw/stars_03/galaxyproject_galaxy/galaxy | /home/hieuvd/dung_repo/raw/stars_03/galaxyproject_galaxy/galaxy/lib/galaxy/tool_util/verify/asserts/json.py | 11,12 | 1,54 | any_in_tree | 12,27 | 12,27 | import json
from typing import (
Any,
Callable,
cast,
)
PropertyVisitor = Callable[[str, Any], Any]
def any_in_tree(f: PropertyVisitor, json_tree: Any):
FILL_FUNC_BODYdef assert_has_json_property_with_value(
output,
property: str,
value: str,
):
"""Assert JSON tree contains the specified ... | import json
from typing import (
Any,
Callable,
cast,
)
PropertyVisitor = Callable[[str, Any], Any]
def any_in_tree(f: PropertyVisitor, json_tree: Any):
FILL_FUNC_BODYdef assert_has_json_property_with_value(
output,
property: str,
value: str,
):
"""Assert JSON tree contains the specified ... | if isinstance(json_tree, list):
for element in json_tree:
if any_in_tree(f, element):
return True
elif isinstance(json_tree, dict):
for key, value in json_tree.items():
if f(cast(str, key), value):
return True
elif any_in_tree(... | if isinstance(json_tree, list):
for element in json_tree:
if any_in_tree(f, element):
return True
elif isinstance(json_tree, dict):
for key, value in json_tree.items():
if f(cast(str, key), value):
return True
elif any_in_tree(... | 33 | 326 | 120 | 446 | import json
from typing import (
Any,
Callable,
cast,
)
PropertyVisitor = Callable[[str, Any], Any]
def any_in_tree(f: PropertyVisitor, json_tree: Any):
FILL_FUNC_BODYdef assert_has_json_property_with_value(
output,
property: str,
value: str,
):
"""Assert JSON tree contains the specified ... | import json
from typing import (
Any,
Callable,
cast,
)
PropertyVisitor = Callable[[str, Any], Any]
def any_in_tree(f: PropertyVisitor, json_tree: Any):
FILL_FUNC_BODYdef assert_has_json_property_with_value(
output,
property: str,
value: str,
):
"""Assert JSON tree contains the specified ... | |
46,290 | /home/hieuvd/dung_repo/raw/stars_03/galaxyproject_galaxy/galaxy | /home/hieuvd/dung_repo/raw/stars_03/galaxyproject_galaxy/galaxy/lib/galaxy/tool_util/verify/asserts/size.py | 9,18 | 1,36 | assert_has_size | 23,36 | 18,36 | from typing import (
Optional,
Union,
)
from ._util import _assert_number
def assert_has_size(
output_bytes: bytes,
value: Optional[Union[int, str]] = None,
size: Optional[Union[int, str]] = None,
delta: Union[int, str] = 0,
min: Optional[Union[int, str]] = None,
max: Optional[Union[i... | from typing import (
Optional,
Union,
)
from ._util import _assert_number
def assert_has_size(
output_bytes: bytes,
value: Optional[Union[int, str]] = None,
size: Optional[Union[int, str]] = None,
delta: Union[int, str] = 0,
min: Optional[Union[int, str]] = None,
max: Optional[Union[i... | output_size = len(output_bytes)
if size is None:
size = value
_assert_number(
output_size,
value,
delta,
min,
max,
negate,
"{expected} file size of {n}+-{delta}",
"{expected} file size to be in [{min}:{max}]",
)
| """
Asserts the specified output has a size of the specified value
(size and value or synonyms),
allowing for absolute (delta) and relative (delta_frac) difference.
"""
output_size = len(output_bytes)
if size is None:
size = value
_assert_number(
output_size,
valu... | 30 | 199 | 111 | 310 | from typing import (
Optional,
Union,
)
from ._util import _assert_number
def assert_has_size(
output_bytes: bytes,
value: Optional[Union[int, str]] = None,
size: Optional[Union[int, str]] = None,
delta: Union[int, str] = 0,
min: Optional[Union[int, str]] = None,
max: Optional[Union[i... | from typing import (
Optional,
Union,
)
from ._util import _assert_number
def assert_has_size(
output_bytes: bytes,
value: Optional[Union[int, str]] = None,
size: Optional[Union[int, str]] = None,
delta: Union[int, str] = 0,
min: Optional[Union[int, str]] = None,
max: Optional[Union[i... | |
46,291 | /home/hieuvd/dung_repo/raw/stars_03/galaxyproject_galaxy/galaxy | /home/hieuvd/dung_repo/raw/stars_03/galaxyproject_galaxy/galaxy/lib/galaxy/tool_util/verify/asserts/tabular.py | 10,11 | 1,50 | get_first_line | 14,24 | 11,24 | import re
from typing import (
Optional,
Union,
)
from ._util import _assert_number
def get_first_line(output: str, comment: str) -> str:
FILL_FUNC_BODYdef assert_has_n_columns(
output: str,
n: Optional[Union[int, str]] = None,
delta: Union[int, str] = 0,
min: Optional[Union[int, str]] = None... | import re
from typing import (
Optional,
Union,
)
from ._util import _assert_number
def get_first_line(output: str, comment: str) -> str:
"""
get the first non-comment and non-empty line
"""
FILL_FUNC_BODYdef assert_has_n_columns(
output: str,
n: Optional[Union[int, str]] = None,
delt... | if comment != "":
match = re.search(f"^([^{comment}].*)$", output, flags=re.MULTILINE)
else:
match = re.search("^(.+)$", output, flags=re.MULTILINE)
if match is None:
return ""
else:
return match.group(1)
| """
get the first non-comment and non-empty line
"""
if comment != "":
match = re.search(f"^([^{comment}].*)$", output, flags=re.MULTILINE)
else:
match = re.search("^(.+)$", output, flags=re.MULTILINE)
if match is None:
return ""
else:
return match.group(1)
| 24 | 348 | 104 | 452 | import re
from typing import (
Optional,
Union,
)
from ._util import _assert_number
def get_first_line(output: str, comment: str) -> str:
FILL_FUNC_BODYdef assert_has_n_columns(
output: str,
n: Optional[Union[int, str]] = None,
delta: Union[int, str] = 0,
min: Optional[Union[int, str]] = None... | import re
from typing import (
Optional,
Union,
)
from ._util import _assert_number
def get_first_line(output: str, comment: str) -> str:
"""
get the first non-comment and non-empty line
"""
FILL_FUNC_BODYdef assert_has_n_columns(
output: str,
n: Optional[Union[int, str]] = None,
delt... | |
46,292 | /home/hieuvd/dung_repo/raw/stars_03/galaxyproject_galaxy/galaxy | /home/hieuvd/dung_repo/raw/stars_03/galaxyproject_galaxy/galaxy/lib/galaxy/tool_util/verify/asserts/text.py | 13,22 | 1,159 | assert_has_text | 25,42 | 22,42 | import re
from typing import (
Optional,
Union,
)
from ._util import (
_assert_number,
_assert_presence_number,
)
def assert_has_text(
output: str,
text: str,
n: Optional[Union[int, str]] = None,
delta: Union[int, str] = 0,
min: Optional[Union[int, str]] = None,
max: Optional[... | import re
from typing import (
Optional,
Union,
)
from ._util import (
_assert_number,
_assert_presence_number,
)
def assert_has_text(
output: str,
text: str,
n: Optional[Union[int, str]] = None,
delta: Union[int, str] = 0,
min: Optional[Union[int, str]] = None,
max: Optional[... | assert output is not None, "Checking has_text assertion on empty output (None)"
_assert_presence_number(
output,
text,
n,
delta,
min,
max,
negate,
lambda o, t: o.find(t) >= 0,
lambda o, t: len(re.findall(re.escape(t), o)),
"{expecte... | """Asserts specified output contains the substring specified by
the argument text. The exact number of occurrences can be
optionally specified by the argument n"""
assert output is not None, "Checking has_text assertion on empty output (None)"
_assert_presence_number(
output,
text,
... | 60 | 1,567 | 206 | 1,773 | import re
from typing import (
Optional,
Union,
)
from ._util import (
_assert_number,
_assert_presence_number,
)
def assert_has_text(
output: str,
text: str,
n: Optional[Union[int, str]] = None,
delta: Union[int, str] = 0,
min: Optional[Union[int, str]] = None,
max: Optional[... | import re
from typing import (
Optional,
Union,
)
from ._util import (
_assert_number,
_assert_presence_number,
)
def assert_has_text(
output: str,
text: str,
n: Optional[Union[int, str]] = None,
delta: Union[int, str] = 0,
min: Optional[Union[int, str]] = None,
max: Optional[... | |
46,294 | /home/hieuvd/dung_repo/raw/stars_03/galaxyproject_galaxy/galaxy | /home/hieuvd/dung_repo/raw/stars_03/galaxyproject_galaxy/galaxy/lib/galaxy/tool_util/verify/script.py | 110,111 | 53,164 | write | Results | 111,148 | 111,148 | class Results:
test_exceptions: List[TestException]
def __init__(
self, default_suitename: str, test_json: str, append: bool = False, galaxy_url: Optional[str] = None
) -> None:
self.test_json = test_json or "-"
self.galaxy_url = galaxy_url
test_results = []
suitenam... | class Results:
test_exceptions: List[TestException]
def __init__(
self, default_suitename: str, test_json: str, append: bool = False, galaxy_url: Optional[str] = None
) -> None:
self.test_json = test_json or "-"
self.galaxy_url = galaxy_url
test_results = []
suitenam... | tests = sorted(self.test_results, key=lambda el: el["id"])
n_passed, n_failures, n_skips = 0, 0, 0
n_errors = len([e for e in self.test_exceptions if not e.was_recorded])
for test in tests:
has_data = test.get("has_data", False)
if has_data:
test_d... | tests = sorted(self.test_results, key=lambda el: el["id"])
n_passed, n_failures, n_skips = 0, 0, 0
n_errors = len([e for e in self.test_exceptions if not e.was_recorded])
for test in tests:
has_data = test.get("has_data", False)
if has_data:
test_d... | 128 | 928 | 450 | 1,378 | #!/usr/bin/env python
import argparse
import concurrent.futures.thread
import datetime as dt
import json
import logging
import os
import sys
import tempfile
from concurrent.futures import (
thread,
ThreadPoolExecutor,
)
from typing import (
Any,
Callable,
Dict,
List,
NamedTuple,
Optiona... | #!/usr/bin/env python
import argparse
import concurrent.futures.thread
import datetime as dt
import json
import logging
import os
import sys
import tempfile
from concurrent.futures import (
thread,
ThreadPoolExecutor,
)
from typing import (
Any,
Callable,
Dict,
List,
NamedTuple,
Optiona... |
46,295 | /home/hieuvd/dung_repo/raw/stars_03/galaxyproject_galaxy/galaxy | /home/hieuvd/dung_repo/raw/stars_03/galaxyproject_galaxy/galaxy/lib/galaxy/tool_util/verify/test_data.py | 60,61 | 1,125 | build_resolver | 61,67 | 61,67 | import hashlib
import os
import re
import subprocess
from string import Template
from galaxy.util import (
asbool,
in_directory,
smart_str,
)
UPDATE_TEMPLATE = Template(
"git --work-tree $dir --git-dir $dir/.git fetch && git --work-tree $dir --git-dir $dir/.git merge origin/master"
)
UPDATE_FAILED_TE... | import hashlib
import os
import re
import subprocess
from string import Template
from galaxy.util import (
asbool,
in_directory,
smart_str,
)
UPDATE_TEMPLATE = Template(
"git --work-tree $dir --git-dir $dir/.git fetch && git --work-tree $dir --git-dir $dir/.git merge origin/master"
)
UPDATE_FAILED_TE... | if uri.startswith("http") and uri.endswith(".git"):
return GitDataResolver(uri, environ)
else:
return FileDataResolver(uri)
| if uri.startswith("http") and uri.endswith(".git"):
return GitDataResolver(uri, environ)
else:
return FileDataResolver(uri)
| 10 | 1,266 | 54 | 1,320 | import hashlib
import os
import re
import subprocess
from string import Template
from galaxy.util import (
asbool,
in_directory,
smart_str,
)
UPDATE_TEMPLATE = Template(
"git --work-tree $dir --git-dir $dir/.git fetch && git --work-tree $dir --git-dir $dir/.git merge origin/master"
)
UPDATE_FAILED_TE... | import hashlib
import os
import re
import subprocess
from string import Template
from galaxy.util import (
asbool,
in_directory,
smart_str,
)
UPDATE_TEMPLATE = Template(
"git --work-tree $dir --git-dir $dir/.git fetch && git --work-tree $dir --git-dir $dir/.git merge origin/master"
)
UPDATE_FAILED_TE... | |
46,296 | /home/hieuvd/dung_repo/raw/stars_03/galaxyproject_galaxy/galaxy | /home/hieuvd/dung_repo/raw/stars_03/galaxyproject_galaxy/galaxy/lib/galaxy/tool_util/verify/test_data.py | 71,72 | 67,79 | exists | FileDataResolver | 72,75 | 72,75 | class FileDataResolver:
def __init__(self, file_dir: str):
self.file_dir = file_dir
def exists(self, filename: str):
FILL_FUNC_BODY def path(self, filename: str):
return os.path.join(self.file_dir, filename)
| class FileDataResolver:
def __init__(self, file_dir: str):
self.file_dir = file_dir
def exists(self, filename: str):
FILL_FUNC_BODY def path(self, filename: str):
return os.path.join(self.file_dir, filename)
| path = os.path.abspath(self.path(filename))
return os.path.exists(path) and in_directory(path, self.file_dir)
| path = os.path.abspath(self.path(filename))
return os.path.exists(path) and in_directory(path, self.file_dir)
| 8 | 83 | 46 | 129 | import hashlib
import os
import re
import subprocess
from string import Template
from galaxy.util import (
asbool,
in_directory,
smart_str,
)
UPDATE_TEMPLATE = Template(
"git --work-tree $dir --git-dir $dir/.git fetch && git --work-tree $dir --git-dir $dir/.git merge origin/master"
)
UPDATE_FAILED_TE... | import hashlib
import os
import re
import subprocess
from string import Template
from galaxy.util import (
asbool,
in_directory,
smart_str,
)
UPDATE_TEMPLATE = Template(
"git --work-tree $dir --git-dir $dir/.git fetch && git --work-tree $dir --git-dir $dir/.git merge origin/master"
)
UPDATE_FAILED_TE... |
46,297 | /home/hieuvd/dung_repo/raw/stars_03/galaxyproject_galaxy/galaxy | /home/hieuvd/dung_repo/raw/stars_03/galaxyproject_galaxy/galaxy/lib/galaxy/tool_util/verify/test_data.py | 92,93 | 79,125 | exists | GitDataResolver | 93,99 | 93,99 | class GitDataResolver(FileDataResolver):
def __init__(self, repository: str, environ):
self.repository = repository
self.updated = False
repo_cache = environ.get("GALAXY_TEST_DATA_REPO_CACHE", "test-data-cache")
m = hashlib.md5()
m.update(smart_str(repository))
repo_p... | class GitDataResolver(FileDataResolver):
def __init__(self, repository: str, environ):
self.repository = repository
self.updated = False
repo_cache = environ.get("GALAXY_TEST_DATA_REPO_CACHE", "test-data-cache")
m = hashlib.md5()
m.update(smart_str(repository))
repo_p... | exists_now = super().exists(filename)
if exists_now or not self.fetch_data or self.updated:
return exists_now
self.update_repository()
return super().exists(filename)
| exists_now = super().exists(filename)
if exists_now or not self.fetch_data or self.updated:
return exists_now
self.update_repository()
return super().exists(filename)
| 15 | 514 | 60 | 574 | import hashlib
import os
import re
import subprocess
from string import Template
from galaxy.util import (
asbool,
in_directory,
smart_str,
)
UPDATE_TEMPLATE = Template(
"git --work-tree $dir --git-dir $dir/.git fetch && git --work-tree $dir --git-dir $dir/.git merge origin/master"
)
UPDATE_FAILED_TE... | import hashlib
import os
import re
import subprocess
from string import Template
from galaxy.util import (
asbool,
in_directory,
smart_str,
)
UPDATE_TEMPLATE = Template(
"git --work-tree $dir --git-dir $dir/.git fetch && git --work-tree $dir --git-dir $dir/.git merge origin/master"
)
UPDATE_FAILED_TE... |
46,298 | /home/hieuvd/dung_repo/raw/stars_03/galaxyproject_galaxy/galaxy | /home/hieuvd/dung_repo/raw/stars_03/galaxyproject_galaxy/galaxy/lib/galaxy/tool_util/verify/test_data.py | 38,39 | 25,56 | get_filename | TestDataResolver | 39,47 | 39,47 | class TestDataResolver:
__test__ = False # Prevent pytest from discovering this class (issue #12071)
def __init__(self, file_dirs=None, env_var="GALAXY_TEST_FILE_DIR", environ=os.environ):
if file_dirs is None:
file_dirs = environ.get(env_var, None)
if file_dirs is None:
... | class TestDataResolver:
__test__ = False # Prevent pytest from discovering this class (issue #12071)
def __init__(self, file_dirs=None, env_var="GALAXY_TEST_FILE_DIR", environ=os.environ):
if file_dirs is None:
file_dirs = environ.get(env_var, None)
if file_dirs is None:
... | for resolver in self.resolvers or []:
if not resolver.exists(name):
continue
filename = resolver.path(name)
if filename:
return os.path.abspath(filename)
raise TestDataNotFoundError(f"Failed to find test file {name} against any test dat... | for resolver in self.resolvers or []:
if not resolver.exists(name):
continue
filename = resolver.path(name)
if filename:
return os.path.abspath(filename)
raise TestDataNotFoundError(f"Failed to find test file {name} against any test dat... | 29 | 311 | 90 | 401 | import hashlib
import os
import re
import subprocess
from string import Template
from galaxy.util import (
asbool,
in_directory,
smart_str,
)
UPDATE_TEMPLATE = Template(
"git --work-tree $dir --git-dir $dir/.git fetch && git --work-tree $dir --git-dir $dir/.git merge origin/master"
)
UPDATE_FAILED_TE... | import hashlib
import os
import re
import subprocess
from string import Template
from galaxy.util import (
asbool,
in_directory,
smart_str,
)
UPDATE_TEMPLATE = Template(
"git --work-tree $dir --git-dir $dir/.git fetch && git --work-tree $dir --git-dir $dir/.git merge origin/master"
)
UPDATE_FAILED_TE... |
46,299 | /home/hieuvd/dung_repo/raw/stars_03/galaxyproject_galaxy/galaxy | /home/hieuvd/dung_repo/raw/stars_03/galaxyproject_galaxy/galaxy/lib/galaxy/tool_util/verify/wait.py | 17,25 | 1,51 | wait_on | 33,46 | 25,46 | """Abstraction for waiting on API conditions to become true."""
import time
from typing import (
Callable,
Optional,
Union,
)
DEFAULT_POLLING_BACKOFF = 0
DEFAULT_POLLING_DELTA = 0.25
TIMEOUT_MESSAGE_TEMPLATE = "Timed out after {} seconds waiting on {}."
timeout_type = Union[int, float]
def wait_on(
... | """Abstraction for waiting on API conditions to become true."""
import time
from typing import (
Callable,
Optional,
Union,
)
DEFAULT_POLLING_BACKOFF = 0
DEFAULT_POLLING_DELTA = 0.25
TIMEOUT_MESSAGE_TEMPLATE = "Timed out after {} seconds waiting on {}."
timeout_type = Union[int, float]
def wait_on(
... | sleep = sleep_ or time.sleep
total_wait = 0.0
while True:
if total_wait > timeout:
raise TimeoutAssertionError(TIMEOUT_MESSAGE_TEMPLATE.format(total_wait, desc))
value = function()
if value is not None:
return value
total_wait += delta
sleep(de... | """Wait for function to return non-None value.
Grow the polling interval (initially ``delta`` defaulting to 0.25 seconds)
incrementally by the supplied ``polling_backoff`` (defaulting to 0).
Throw a TimeoutAssertionError if the supplied timeout is reached without
supplied function ever returning a... | 34 | 335 | 117 | 452 | """Abstraction for waiting on API conditions to become true."""
import time
from typing import (
Callable,
Optional,
Union,
)
DEFAULT_POLLING_BACKOFF = 0
DEFAULT_POLLING_DELTA = 0.25
TIMEOUT_MESSAGE_TEMPLATE = "Timed out after {} seconds waiting on {}."
timeout_type = Union[int, float]
def wait_on(
... | """Abstraction for waiting on API conditions to become true."""
import time
from typing import (
Callable,
Optional,
Union,
)
DEFAULT_POLLING_BACKOFF = 0
DEFAULT_POLLING_DELTA = 0.25
TIMEOUT_MESSAGE_TEMPLATE = "Timed out after {} seconds waiting on {}."
timeout_type = Union[int, float]
def wait_on(
... | |
46,300 | /home/hieuvd/dung_repo/raw/stars_03/galaxyproject_galaxy/galaxy | /home/hieuvd/dung_repo/raw/stars_03/galaxyproject_galaxy/galaxy/lib/galaxy/tool_util/version.py | 124,125 | 1,165 | _parse_version_parts | 125,141 | 125,141 | # Copyright (c) Donald Stufft and individual contributors.
# All rights reserved.
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
# 1. Redistributions of source code must retain the above copyright notice,
# t... | # Copyright (c) Donald Stufft and individual contributors.
# All rights reserved.
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
# 1. Redistributions of source code must retain the above copyright notice,
# t... | for part in _legacy_version_component_re.split(s):
part = _legacy_version_replacement_map.get(part, part)
if not part or part == ".":
continue
if part[:1] in "0123456789":
# pad for numeric comparison
yield part.zfill(8)
else:
yield "... | for part in _legacy_version_component_re.split(s):
part = _legacy_version_replacement_map.get(part, part)
if not part or part == ".":
continue
if part[:1] in "0123456789":
# pad for numeric comparison
yield part.zfill(8)
else:
yield "... | 41 | 1,441 | 145 | 1,586 | # Copyright (c) Donald Stufft and individual contributors.
# All rights reserved.
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
# 1. Redistributions of source code must retain the above copyright notice,
# t... | # Copyright (c) Donald Stufft and individual contributors.
# All rights reserved.
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
# 1. Redistributions of source code must retain the above copyright notice,
# t... | |
46,301 | /home/hieuvd/dung_repo/raw/stars_03/galaxyproject_galaxy/galaxy | /home/hieuvd/dung_repo/raw/stars_03/galaxyproject_galaxy/galaxy/lib/galaxy/tool_util/version.py | 108,110 | 57,113 | is_devrelease | LegacyVersion | 110,113 | 110,113 | class LegacyVersion(_BaseVersion):
def __init__(self, version: str) -> None:
self._version = str(version)
self._key = _legacy_cmpkey(self._version)
def __str__(self) -> str:
return self._version
def __repr__(self) -> str:
return f"<LegacyVersion('{self}')>"
@property
... | class LegacyVersion(_BaseVersion):
def __init__(self, version: str) -> None:
self._version = str(version)
self._key = _legacy_cmpkey(self._version)
def __str__(self) -> str:
return self._version
def __repr__(self) -> str:
return f"<LegacyVersion('{self}')>"
@property
... | return False
| return False
| 2 | 344 | 9 | 353 | # Copyright (c) Donald Stufft and individual contributors.
# All rights reserved.
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
# 1. Redistributions of source code must retain the above copyright notice,
# t... | # Copyright (c) Donald Stufft and individual contributors.
# All rights reserved.
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
# 1. Redistributions of source code must retain the above copyright notice,
# t... |
46,302 | /home/hieuvd/dung_repo/raw/stars_03/galaxyproject_galaxy/galaxy | /home/hieuvd/dung_repo/raw/stars_03/galaxyproject_galaxy/galaxy/lib/galaxy/tools/actions/data_manager.py | 12,13 | 9,22 | execute | DataManagerToolAction | 13,22 | 13,22 | class DataManagerToolAction(DefaultToolAction):
"""Tool action used for Data Manager Tools"""
def execute(self, tool, trans, **kwds):
FILL_FUNC_BODY | class DataManagerToolAction(DefaultToolAction):
"""Tool action used for Data Manager Tools"""
def execute(self, tool, trans, **kwds):
FILL_FUNC_BODY | rval = super().execute(tool, trans, **kwds)
if isinstance(rval, tuple) and len(rval) >= 2 and isinstance(rval[0], trans.app.model.Job):
assoc = trans.app.model.DataManagerJobAssociation(job=rval[0], data_manager_id=tool.data_manager_id)
trans.sa_session.add(assoc)
wit... | rval = super().execute(tool, trans, **kwds)
if isinstance(rval, tuple) and len(rval) >= 2 and isinstance(rval[0], trans.app.model.Job):
assoc = trans.app.model.DataManagerJobAssociation(job=rval[0], data_manager_id=tool.data_manager_id)
trans.sa_session.add(assoc)
wit... | 33 | 48 | 168 | 216 | import logging
from galaxy.model.base import transaction
from . import DefaultToolAction
log = logging.getLogger(__name__)
class DataManagerToolAction(DefaultToolAction):
"""Tool action used for Data Manager Tools"""
def execute(self, tool, trans, **kwds):
FILL_FUNC_BODY | import logging
from galaxy.model.base import transaction
from . import DefaultToolAction
log = logging.getLogger(__name__)
class DataManagerToolAction(DefaultToolAction):
"""Tool action used for Data Manager Tools"""
def execute(self, tool, trans, **kwds):
FILL_FUNC_BODY |
46,303 | /home/hieuvd/dung_repo/raw/stars_03/galaxyproject_galaxy/galaxy | /home/hieuvd/dung_repo/raw/stars_03/galaxyproject_galaxy/galaxy/lib/galaxy/tools/actions/data_source.py | 11,14 | 8,26 | _get_default_data_name | DataSourceToolAction | 14,26 | 14,26 | class DataSourceToolAction(DefaultToolAction):
"""Tool action used for Data Source Tools"""
def _get_default_data_name(
self, dataset, tool, on_text=None, trans=None, incoming=None, history=None, params=None, job_params=None, **kwd
):
FILL_FUNC_BODY | class DataSourceToolAction(DefaultToolAction):
"""Tool action used for Data Source Tools"""
def _get_default_data_name(
self, dataset, tool, on_text=None, trans=None, incoming=None, history=None, params=None, job_params=None, **kwd
):
FILL_FUNC_BODY | if incoming and "name" in incoming:
return incoming["name"]
return super()._get_default_data_name(
dataset,
tool,
on_text=on_text,
trans=trans,
incoming=incoming,
history=history,
params=params,
j... | if incoming and "name" in incoming:
return incoming["name"]
return super()._get_default_data_name(
dataset,
tool,
on_text=on_text,
trans=trans,
incoming=incoming,
history=history,
params=params,
j... | 19 | 88 | 100 | 188 | import logging
from . import DefaultToolAction
log = logging.getLogger(__name__)
class DataSourceToolAction(DefaultToolAction):
"""Tool action used for Data Source Tools"""
def _get_default_data_name(
self, dataset, tool, on_text=None, trans=None, incoming=None, history=None, params=None, job_param... | import logging
from . import DefaultToolAction
log = logging.getLogger(__name__)
class DataSourceToolAction(DefaultToolAction):
"""Tool action used for Data Source Tools"""
def _get_default_data_name(
self, dataset, tool, on_text=None, trans=None, incoming=None, history=None, params=None, job_param... |
46,304 | /home/hieuvd/dung_repo/raw/stars_03/galaxyproject_galaxy/galaxy | /home/hieuvd/dung_repo/raw/stars_03/galaxyproject_galaxy/galaxy/lib/galaxy/tools/actions/history_imp_exp.py | 83,84 | 78,185 | execute | ExportHistoryToolAction | 84,185 | 84,185 | class ExportHistoryToolAction(ToolAction):
"""Tool action used for exporting a history to an archive."""
produces_real_jobs = True
def execute(self, tool, trans, incoming=None, set_output_hid=False, overwrite=True, history=None, **kwargs):
FILL_FUNC_BODY | class ExportHistoryToolAction(ToolAction):
"""Tool action used for exporting a history to an archive."""
produces_real_jobs = True
def execute(self, tool, trans, incoming=None, set_output_hid=False, overwrite=True, history=None, **kwargs):
FILL_FUNC_BODY | trans.check_user_activation()
#
# Get history to export.
#
incoming = incoming or {}
history = None
for name, value in incoming.items():
if isinstance(value, trans.app.model.History):
history_param_name = name
history = ... | trans.check_user_activation()
#
# Get history to export.
#
incoming = incoming or {}
history = None
for name, value in incoming.items():
if isinstance(value, trans.app.model.History):
history_param_name = name
history = ... | 346 | 83 | 1,212 | 1,295 | import datetime
import logging
import os
import tempfile
from galaxy.job_execution.setup import create_working_directory_for_job
from galaxy.model.base import transaction
from galaxy.tools.actions import ToolAction
from galaxy.tools.imp_exp import (
JobExportHistoryArchiveWrapper,
JobImportHistoryArchiveWrappe... | import datetime
import logging
import os
import tempfile
from galaxy.job_execution.setup import create_working_directory_for_job
from galaxy.model.base import transaction
from galaxy.tools.actions import ToolAction
from galaxy.tools.imp_exp import (
JobExportHistoryArchiveWrapper,
JobImportHistoryArchiveWrappe... |
46,305 | /home/hieuvd/dung_repo/raw/stars_03/galaxyproject_galaxy/galaxy | /home/hieuvd/dung_repo/raw/stars_03/galaxyproject_galaxy/galaxy/lib/galaxy/tools/actions/history_imp_exp.py | 23,24 | 18,78 | execute | ImportHistoryToolAction | 24,78 | 24,78 | class ImportHistoryToolAction(ToolAction):
"""Tool action used for importing a history to an archive."""
produces_real_jobs = True
def execute(self, tool, trans, incoming=None, set_output_hid=False, overwrite=True, history=None, **kwargs):
FILL_FUNC_BODY | class ImportHistoryToolAction(ToolAction):
"""Tool action used for importing a history to an archive."""
produces_real_jobs = True
def execute(self, tool, trans, incoming=None, set_output_hid=False, overwrite=True, history=None, **kwargs):
FILL_FUNC_BODY | #
# Create job.
#
incoming = incoming or {}
trans.check_user_activation()
job = trans.app.model.Job()
job.galaxy_version = trans.app.config.version_major
session = trans.get_galaxy_session()
job.session_id = session and session.id
if histor... | #
# Create job.
#
incoming = incoming or {}
trans.check_user_activation()
job = trans.app.model.Job()
job.galaxy_version = trans.app.config.version_major
session = trans.get_galaxy_session()
job.session_id = session and session.id
if histor... | 190 | 82 | 624 | 706 | import datetime
import logging
import os
import tempfile
from galaxy.job_execution.setup import create_working_directory_for_job
from galaxy.model.base import transaction
from galaxy.tools.actions import ToolAction
from galaxy.tools.imp_exp import (
JobExportHistoryArchiveWrapper,
JobImportHistoryArchiveWrappe... | import datetime
import logging
import os
import tempfile
from galaxy.job_execution.setup import create_working_directory_for_job
from galaxy.model.base import transaction
from galaxy.tools.actions import ToolAction
from galaxy.tools.imp_exp import (
JobExportHistoryArchiveWrapper,
JobImportHistoryArchiveWrappe... |
46,306 | /home/hieuvd/dung_repo/raw/stars_03/galaxyproject_galaxy/galaxy | /home/hieuvd/dung_repo/raw/stars_03/galaxyproject_galaxy/galaxy/lib/galaxy/tools/actions/metadata.py | 46,59 | 14,157 | execute_via_app | SetMetadataToolAction | 62,157 | 59,157 | class SetMetadataToolAction(ToolAction):
"""Tool action used for setting external metadata on an existing dataset"""
produces_real_jobs = False
def execute(
self, tool, trans, incoming=None, set_output_hid=False, overwrite=True, history=None, job_params=None, **kwargs
):
"""
Ex... | class SetMetadataToolAction(ToolAction):
"""Tool action used for setting external metadata on an existing dataset"""
produces_real_jobs = False
def execute(
self, tool, trans, incoming=None, set_output_hid=False, overwrite=True, history=None, job_params=None, **kwargs
):
"""
Ex... | incoming = incoming or {}
for name, value in incoming.items():
# Why are we looping here and not just using a fixed input name? Needed?
if not name.startswith("input"):
continue
if isinstance(value, app.model.HistoryDatasetAssociation):
... | """
Execute using application.
"""
incoming = incoming or {}
for name, value in incoming.items():
# Why are we looping here and not just using a fixed input name? Needed?
if not name.startswith("input"):
continue
if isinstance(v... | 378 | 399 | 1,369 | 1,768 | import logging
import os
from json import dumps
from galaxy.job_execution.datasets import DatasetPath
from galaxy.metadata import get_metadata_compute_strategy
from galaxy.model.base import transaction
from galaxy.util import asbool
from . import ToolAction
log = logging.getLogger(__name__)
class SetMetadataToolAct... | import logging
import os
from json import dumps
from galaxy.job_execution.datasets import DatasetPath
from galaxy.metadata import get_metadata_compute_strategy
from galaxy.model.base import transaction
from galaxy.util import asbool
from . import ToolAction
log = logging.getLogger(__name__)
class SetMetadataToolAct... |
46,307 | /home/hieuvd/dung_repo/raw/stars_03/galaxyproject_galaxy/galaxy | /home/hieuvd/dung_repo/raw/stars_03/galaxyproject_galaxy/galaxy/lib/galaxy/tools/biotools.py | 13,14 | 1,29 | get_galaxy_biotools_metadata_source | 15,29 | 14,29 | """Adapt Galaxy-agnostic abstraction galaxy.tool_util.biotools to Galaxy config and dependencies."""
from beaker.cache import CacheManager
from beaker.util import parse_cache_config_options
from galaxy.tool_util.biotools import (
BiotoolsMetadataSource,
BiotoolsMetadataSourceConfig,
get_biotools_metadata_... | """Adapt Galaxy-agnostic abstraction galaxy.tool_util.biotools to Galaxy config and dependencies."""
from beaker.cache import CacheManager
from beaker.util import parse_cache_config_options
from galaxy.tool_util.biotools import (
BiotoolsMetadataSource,
BiotoolsMetadataSourceConfig,
get_biotools_metadata_... | biotools_metadata_source_config = BiotoolsMetadataSourceConfig()
biotools_metadata_source_config.content_directory = config.biotools_content_directory
biotools_metadata_source_config.use_api = config.biotools_use_api
cache_opts = {
"cache.type": config.biotools_service_cache_type,
"cache... | """Build a BiotoolsMetadataSource from a Galaxy configuration object."""
biotools_metadata_source_config = BiotoolsMetadataSourceConfig()
biotools_metadata_source_config.content_directory = config.biotools_content_directory
biotools_metadata_source_config.use_api = config.biotools_use_api
cache_opts... | 33 | 147 | 288 | 435 | """Adapt Galaxy-agnostic abstraction galaxy.tool_util.biotools to Galaxy config and dependencies."""
from beaker.cache import CacheManager
from beaker.util import parse_cache_config_options
from galaxy.tool_util.biotools import (
BiotoolsMetadataSource,
BiotoolsMetadataSourceConfig,
get_biotools_metadata_... | """Adapt Galaxy-agnostic abstraction galaxy.tool_util.biotools to Galaxy config and dependencies."""
from beaker.cache import CacheManager
from beaker.util import parse_cache_config_options
from galaxy.tool_util.biotools import (
BiotoolsMetadataSource,
BiotoolsMetadataSourceConfig,
get_biotools_metadata_... | |
46,309 | /home/hieuvd/dung_repo/raw/stars_03/galaxyproject_galaxy/galaxy | /home/hieuvd/dung_repo/raw/stars_03/galaxyproject_galaxy/galaxy/lib/galaxy/tools/cache.py | 228,229 | 133,265 | expire_tool | ToolCache | 229,238 | 229,238 | class ToolCache:
"""
Cache tool definitions to allow quickly reloading the whole
toolbox.
"""
def __init__(self):
self._lock = Lock()
self._hash_by_tool_paths: Dict[str, ToolHash] = {}
self._tools_by_path = {}
self._tool_paths_by_id = {}
self._macro_paths_by_... | class ToolCache:
"""
Cache tool definitions to allow quickly reloading the whole
toolbox.
"""
def __init__(self):
self._lock = Lock()
self._hash_by_tool_paths: Dict[str, ToolHash] = {}
self._tools_by_path = {}
self._tool_paths_by_id = {}
self._macro_paths_by_... | with self._lock:
if tool_id in self._tool_paths_by_id:
config_filename = self._tool_paths_by_id[tool_id]
del self._hash_by_tool_paths[config_filename]
del self._tool_paths_by_id[tool_id]
del self._tools_by_path[config_filename]
... | with self._lock:
if tool_id in self._tool_paths_by_id:
config_filename = self._tool_paths_by_id[tool_id]
del self._hash_by_tool_paths[config_filename]
del self._tool_paths_by_id[tool_id]
del self._tools_by_path[config_filename]
... | 20 | 1,590 | 134 | 1,724 | import json
import logging
import os
import shutil
import sqlite3
import tempfile
import zlib
from threading import Lock
from typing import (
Dict,
Optional,
)
from sqlitedict import SqliteDict
from galaxy.util import unicodify
from galaxy.util.hash_util import md5_hash_file
log = logging.getLogger(__name__)... | import json
import logging
import os
import shutil
import sqlite3
import tempfile
import zlib
from threading import Lock
from typing import (
Dict,
Optional,
)
from sqlitedict import SqliteDict
from galaxy.util import unicodify
from galaxy.util.hash_util import md5_hash_file
log = logging.getLogger(__name__)... |
46,310 | /home/hieuvd/dung_repo/raw/stars_03/galaxyproject_galaxy/galaxy | /home/hieuvd/dung_repo/raw/stars_03/galaxyproject_galaxy/galaxy/lib/galaxy/tools/cache.py | 85,86 | 32,133 | _make_writable | ToolDocumentCache | 86,94 | 86,94 | class ToolDocumentCache:
def __init__(self, cache_dir):
self.cache_dir = cache_dir
if not os.path.exists(self.cache_dir):
os.makedirs(self.cache_dir)
self.cache_file = os.path.join(self.cache_dir, "cache.sqlite")
self.writeable_cache_file = None
self._cache = None... | class ToolDocumentCache:
def __init__(self, cache_dir):
self.cache_dir = cache_dir
if not os.path.exists(self.cache_dir):
os.makedirs(self.cache_dir)
self.cache_file = os.path.join(self.cache_dir, "cache.sqlite")
self.writeable_cache_file = None
self._cache = None... | if not self.writeable_cache_file:
self.writeable_cache_file = tempfile.NamedTemporaryFile(
dir=self.cache_dir, suffix="cache.sqlite.tmp", delete=False
)
if os.path.exists(self.cache_file):
shutil.copy(self.cache_file, self.writeable_cache_file.... | if not self.writeable_cache_file:
self.writeable_cache_file = tempfile.NamedTemporaryFile(
dir=self.cache_dir, suffix="cache.sqlite.tmp", delete=False
)
if os.path.exists(self.cache_file):
shutil.copy(self.cache_file, self.writeable_cache_file.... | 15 | 1,005 | 119 | 1,124 | import json
import logging
import os
import shutil
import sqlite3
import tempfile
import zlib
from threading import Lock
from typing import (
Dict,
Optional,
)
from sqlitedict import SqliteDict
from galaxy.util import unicodify
from galaxy.util.hash_util import md5_hash_file
log = logging.getLogger(__name__)... | import json
import logging
import os
import shutil
import sqlite3
import tempfile
import zlib
from threading import Lock
from typing import (
Dict,
Optional,
)
from sqlitedict import SqliteDict
from galaxy.util import unicodify
from galaxy.util.hash_util import md5_hash_file
log = logging.getLogger(__name__)... |
46,311 | /home/hieuvd/dung_repo/raw/stars_03/galaxyproject_galaxy/galaxy | /home/hieuvd/dung_repo/raw/stars_03/galaxyproject_galaxy/galaxy/lib/galaxy/tools/cache.py | 287,289 | 265,292 | hash | ToolHash | 289,292 | 289,292 | class ToolHash:
def __init__(self, path: str, modtime: Optional[float] = None, lazy_hash: bool = False):
self.path = path
self._modtime = modtime or os.path.getmtime(path)
self._tool_hash = None
if not lazy_hash:
self.hash # noqa: B018
def modtime_less_than(self, ot... | class ToolHash:
def __init__(self, path: str, modtime: Optional[float] = None, lazy_hash: bool = False):
self.path = path
self._modtime = modtime or os.path.getmtime(path)
self._tool_hash = None
if not lazy_hash:
self.hash # noqa: B018
def modtime_less_than(self, ot... | if self._tool_hash is None:
self._tool_hash = md5_hash_file(self.path)
return self._tool_hash
| if self._tool_hash is None:
self._tool_hash = md5_hash_file(self.path)
return self._tool_hash
| 9 | 234 | 41 | 275 | import json
import logging
import os
import shutil
import sqlite3
import tempfile
import zlib
from threading import Lock
from typing import (
Dict,
Optional,
)
from sqlitedict import SqliteDict
from galaxy.util import unicodify
from galaxy.util.hash_util import md5_hash_file
log = logging.getLogger(__name__)... | import json
import logging
import os
import shutil
import sqlite3
import tempfile
import zlib
from threading import Lock
from typing import (
Dict,
Optional,
)
from sqlitedict import SqliteDict
from galaxy.util import unicodify
from galaxy.util.hash_util import md5_hash_file
log = logging.getLogger(__name__)... |
46,312 | /home/hieuvd/dung_repo/raw/stars_03/galaxyproject_galaxy/galaxy | /home/hieuvd/dung_repo/raw/stars_03/galaxyproject_galaxy/galaxy/lib/galaxy/tools/data_manager/manager.py | 204,206 | 140,273 | id | DataManager | 206,208 | 206,208 | class DataManager:
GUID_TYPE = "data_manager"
DEFAULT_VERSION = "0.0.1"
tool: Optional[Tool]
def __init__(self, data_managers: DataManagers, elem: Optional[Element] = None, tool_path: Optional[str] = None):
self.data_managers = data_managers
self.declared_id: Optional[str] = None
... | class DataManager:
GUID_TYPE = "data_manager"
DEFAULT_VERSION = "0.0.1"
tool: Optional[Tool]
def __init__(self, data_managers: DataManagers, elem: Optional[Element] = None, tool_path: Optional[str] = None):
self.data_managers = data_managers
self.declared_id: Optional[str] = None
... | return self.guid or self.declared_id # if we have a guid, we will use that as the data_manager id
| return self.guid or self.declared_id # if we have a guid, we will use that as the data_manager id
| 18 | 1,665 | 35 | 1,700 | import errno
import logging
import os
from typing import (
Dict,
List,
Optional,
Union,
)
from typing_extensions import Protocol
from galaxy import util
from galaxy.structured_app import StructuredApp
from galaxy.tool_shed.galaxy_install.client import DataManagersInterface
from galaxy.tool_util.data i... | import errno
import logging
import os
from typing import (
Dict,
List,
Optional,
Union,
)
from typing_extensions import Protocol
from galaxy import util
from galaxy.structured_app import StructuredApp
from galaxy.tool_shed.galaxy_install.client import DataManagersInterface
from galaxy.tool_util.data i... |
46,313 | /home/hieuvd/dung_repo/raw/stars_03/galaxyproject_galaxy/galaxy | /home/hieuvd/dung_repo/raw/stars_03/galaxyproject_galaxy/galaxy/lib/galaxy/tools/data_manager/manager.py | 56,57 | 29,134 | load_from_xml | DataManagers | 57,86 | 57,86 | class DataManagers(DataManagersInterface):
data_managers: Dict[str, "DataManager"]
managed_data_tables: Dict[str, "DataManager"]
__reload_count: int
def __init__(self, app: StructuredApp, xml_filename=None, reload_count: Optional[int] = None):
self.app = app
self.data_managers = {}
... | class DataManagers(DataManagersInterface):
data_managers: Dict[str, "DataManager"]
managed_data_tables: Dict[str, "DataManager"]
__reload_count: int
def __init__(self, app: StructuredApp, xml_filename=None, reload_count: Optional[int] = None):
self.app = app
self.data_managers = {}
... | try:
tree = util.parse_xml(xml_filename)
except OSError as e:
if e.errno != errno.ENOENT or self.app.config.is_set("data_manager_config_file"):
raise
return # default config option and it doesn't exist, which is fine
except Exception as e:
... | try:
tree = util.parse_xml(xml_filename)
except OSError as e:
if e.errno != errno.ENOENT or self.app.config.is_set("data_manager_config_file"):
raise
return # default config option and it doesn't exist, which is fine
except Exception as e:
... | 138 | 1,029 | 439 | 1,468 | import errno
import logging
import os
from typing import (
Dict,
List,
Optional,
Union,
)
from typing_extensions import Protocol
from galaxy import util
from galaxy.structured_app import StructuredApp
from galaxy.tool_shed.galaxy_install.client import DataManagersInterface
from galaxy.tool_util.data i... | import errno
import logging
import os
from typing import (
Dict,
List,
Optional,
Union,
)
from typing_extensions import Protocol
from galaxy import util
from galaxy.structured_app import StructuredApp
from galaxy.tool_shed.galaxy_install.client import DataManagersInterface
from galaxy.tool_util.data i... |
46,314 | /home/hieuvd/dung_repo/raw/stars_03/galaxyproject_galaxy/galaxy | /home/hieuvd/dung_repo/raw/stars_03/galaxyproject_galaxy/galaxy/lib/galaxy/tools/error_reports/plugins/email.py | 26,27 | 15,43 | submit_report | EmailPlugin | 28,43 | 27,43 | class EmailPlugin(ErrorPlugin):
"""Send error report as an email"""
plugin_type = "email"
def __init__(self, **kwargs):
self.app = kwargs["app"]
self.redact_user_details_in_bugreport = self.app.config.redact_user_details_in_bugreport
self.verbose = string_as_bool(kwargs.get("verbos... | class EmailPlugin(ErrorPlugin):
"""Send error report as an email"""
plugin_type = "email"
def __init__(self, **kwargs):
self.app = kwargs["app"]
self.redact_user_details_in_bugreport = self.app.config.redact_user_details_in_bugreport
self.verbose = string_as_bool(kwargs.get("verbos... | try:
error_reporter = EmailErrorReporter(dataset.id, self.app)
error_reporter.send_report(
user=job.get_user(),
email=kwargs.get("email", None),
message=kwargs.get("message", None),
redact_user_details_in_bugreport=self.reda... | """Send report as an email"""
try:
error_reporter = EmailErrorReporter(dataset.id, self.app)
error_reporter.send_report(
user=job.get_user(),
email=kwargs.get("email", None),
message=kwargs.get("message", None),
reda... | 40 | 171 | 178 | 349 | """The module describes the ``email`` error plugin."""
import logging
from galaxy.tools.errors import EmailErrorReporter
from galaxy.util import (
string_as_bool,
unicodify,
)
from . import ErrorPlugin
log = logging.getLogger(__name__)
class EmailPlugin(ErrorPlugin):
"""Send error report as an email"""... | """The module describes the ``email`` error plugin."""
import logging
from galaxy.tools.errors import EmailErrorReporter
from galaxy.util import (
string_as_bool,
unicodify,
)
from . import ErrorPlugin
log = logging.getLogger(__name__)
class EmailPlugin(ErrorPlugin):
"""Send error report as an email"""... |
46,315 | /home/hieuvd/dung_repo/raw/stars_03/galaxyproject_galaxy/galaxy | /home/hieuvd/dung_repo/raw/stars_03/galaxyproject_galaxy/galaxy/lib/galaxy/tools/error_reports/plugins/github.py | 137,138 | 15,149 | get_label | GithubPlugin | 138,149 | 138,149 | class GithubPlugin(BaseGitPlugin):
"""Send error report to GitHub."""
plugin_type = "github"
def __init__(self, **kwargs):
self.app = kwargs["app"]
self.redact_user_details_in_bugreport = self.app.config.redact_user_details_in_bugreport
self.verbose = string_as_bool(kwargs.get("ver... | class GithubPlugin(BaseGitPlugin):
"""Send error report to GitHub."""
plugin_type = "github"
def __init__(self, **kwargs):
self.app = kwargs["app"]
self.redact_user_details_in_bugreport = self.app.config.redact_user_details_in_bugreport
self.verbose = string_as_bool(kwargs.get("ver... | # If we don't have this label, then create it + cache it.
if issue_cache_key not in self.label_cache:
self.label_cache[issue_cache_key] = {}
self._fill_label_cache(git_project, issue_cache_key)
if label not in self.label_cache[issue_cache_key]:
self.label_cac... | # If we don't have this label, then create it + cache it.
if issue_cache_key not in self.label_cache:
self.label_cache[issue_cache_key] = {}
self._fill_label_cache(git_project, issue_cache_key)
if label not in self.label_cache[issue_cache_key]:
self.label_cac... | 34 | 1,723 | 155 | 1,878 | """The module describes the ``github`` error plugin plugin."""
import logging
from urllib.parse import urlparse
from galaxy.util import (
string_as_bool,
unicodify,
)
from .base_git import BaseGitPlugin
log = logging.getLogger(__name__)
class GithubPlugin(BaseGitPlugin):
"""Send error report to GitHub.... | """The module describes the ``github`` error plugin plugin."""
import logging
from urllib.parse import urlparse
from galaxy.util import (
string_as_bool,
unicodify,
)
from .base_git import BaseGitPlugin
log = logging.getLogger(__name__)
class GithubPlugin(BaseGitPlugin):
"""Send error report to GitHub.... |
46,316 | /home/hieuvd/dung_repo/raw/stars_03/galaxyproject_galaxy/galaxy | /home/hieuvd/dung_repo/raw/stars_03/galaxyproject_galaxy/galaxy/lib/galaxy/tools/error_reports/plugins/influxdb.py | 38,39 | 18,60 | submit_report | InfluxDBPlugin | 40,60 | 39,60 | class InfluxDBPlugin(ErrorPlugin):
"""Send error report to InfluxDB"""
plugin_type = "influxdb"
def __init__(self, **kwargs):
if not influxdb:
raise ImportError(
"Could not find InfluxDB Client, this error reporter will be disabled; please pip install influxdb"
... | class InfluxDBPlugin(ErrorPlugin):
"""Send error report to InfluxDB"""
plugin_type = "influxdb"
def __init__(self, **kwargs):
if not influxdb:
raise ImportError(
"Could not find InfluxDB Client, this error reporter will be disabled; please pip install influxdb"
... | self.client.write_points(
[
{
"measurement": "galaxy_tool_error",
"time": datetime.datetime.utcnow().strftime("%Y-%m-%dT%H:%M:%SZ"),
"fields": {"value": 1},
"tags": {
"exit_code": ... | """Submit the error report to sentry"""
self.client.write_points(
[
{
"measurement": "galaxy_tool_error",
"time": datetime.datetime.utcnow().strftime("%Y-%m-%dT%H:%M:%SZ"),
"fields": {"value": 1},
... | 37 | 261 | 237 | 498 | """The module describes the ``influxdb`` error plugin plugin."""
import datetime
import logging
try:
import influxdb
except ImportError:
# This middleware will never be used without influxdb.
influxdb = None
from galaxy.util import unicodify
from . import ErrorPlugin
log = logging.getLogger(__name__)
... | """The module describes the ``influxdb`` error plugin plugin."""
import datetime
import logging
try:
import influxdb
except ImportError:
# This middleware will never be used without influxdb.
influxdb = None
from galaxy.util import unicodify
from . import ErrorPlugin
log = logging.getLogger(__name__)
... |
46,317 | /home/hieuvd/dung_repo/raw/stars_03/galaxyproject_galaxy/galaxy | /home/hieuvd/dung_repo/raw/stars_03/galaxyproject_galaxy/galaxy/lib/galaxy/tools/error_reports/plugins/json.py | 28,29 | 14,59 | submit_report | JsonPlugin | 30,59 | 29,59 | class JsonPlugin(ErrorPlugin):
"""Write error report to a JSON file."""
plugin_type = "json"
def __init__(self, **kwargs):
self.app = kwargs["app"]
self.verbose = string_as_bool(kwargs.get("verbose", False))
self.redact_user_details_in_bugreport = self.app.config.redact_user_detail... | class JsonPlugin(ErrorPlugin):
"""Write error report to a JSON file."""
plugin_type = "json"
def __init__(self, **kwargs):
self.app = kwargs["app"]
self.verbose = string_as_bool(kwargs.get("verbose", False))
self.redact_user_details_in_bugreport = self.app.config.redact_user_detail... | path = os.path.join(self.report_directory, str(dataset.id))
with open(path, "w") as handle:
data = {
"info": job.info,
"id": job.id,
"command_line": job.command_line,
"destination_id": job.destination_id,
"stderr... | """Write the report to a json file."""
path = os.path.join(self.report_directory, str(dataset.id))
with open(path, "w") as handle:
data = {
"info": job.info,
"id": job.id,
"command_line": job.command_line,
"destination_i... | 73 | 227 | 347 | 574 | """The module describes the ``json`` error plugin."""
import json
import logging
import os
import tempfile
from galaxy.util import string_as_bool
from . import ErrorPlugin
log = logging.getLogger(__name__)
class JsonPlugin(ErrorPlugin):
"""Write error report to a JSON file."""
plugin_type = "json"
de... | """The module describes the ``json`` error plugin."""
import json
import logging
import os
import tempfile
from galaxy.util import string_as_bool
from . import ErrorPlugin
log = logging.getLogger(__name__)
class JsonPlugin(ErrorPlugin):
"""Write error report to a JSON file."""
plugin_type = "json"
de... |
46,318 | /home/hieuvd/dung_repo/raw/stars_03/galaxyproject_galaxy/galaxy | /home/hieuvd/dung_repo/raw/stars_03/galaxyproject_galaxy/galaxy/lib/galaxy/tools/error_reports/plugins/sentry.py | 32,33 | 20,110 | submit_report | SentryPlugin | 34,110 | 33,110 | class SentryPlugin(ErrorPlugin):
"""Send error report to Sentry."""
plugin_type = "sentry"
def __init__(self, **kwargs):
self.app = kwargs["app"]
self.redact_user_details_in_bugreport = self.app.config.redact_user_details_in_bugreport
self.verbose = string_as_bool(kwargs.get("verbo... | class SentryPlugin(ErrorPlugin):
"""Send error report to Sentry."""
plugin_type = "sentry"
def __init__(self, **kwargs):
self.app = kwargs["app"]
self.redact_user_details_in_bugreport = self.app.config.redact_user_details_in_bugreport
self.verbose = string_as_bool(kwargs.get("verbo... | tool_name = (
job.tool_id
if not job.tool_id.endswith(f"/{job.tool_version}")
else job.tool_id[: -len(job.tool_version) - 1]
) # strip the tool's version from its long id
# Add contexts to the report.
contexts: Dict[str, dict] = {}
# - "job"... | """Submit the error report to Sentry."""
tool_name = (
job.tool_id
if not job.tool_id.endswith(f"/{job.tool_version}")
else job.tool_id[: -len(job.tool_version) - 1]
) # strip the tool's version from its long id
# Add contexts to the report.
... | 227 | 197 | 810 | 1,007 | """The module describes the ``sentry`` error plugin."""
import logging
from typing import Dict
try:
import sentry_sdk
except ImportError:
sentry_sdk = None
from galaxy.util import string_as_bool
from . import ErrorPlugin
log = logging.getLogger(__name__)
SENTRY_SDK_IMPORT_MESSAGE = "The Python sentry-sdk p... | """The module describes the ``sentry`` error plugin."""
import logging
from typing import Dict
try:
import sentry_sdk
except ImportError:
sentry_sdk = None
from galaxy.util import string_as_bool
from . import ErrorPlugin
log = logging.getLogger(__name__)
SENTRY_SDK_IMPORT_MESSAGE = "The Python sentry-sdk p... |
46,319 | /home/hieuvd/dung_repo/raw/stars_03/galaxyproject_galaxy/galaxy | /home/hieuvd/dung_repo/raw/stars_03/galaxyproject_galaxy/galaxy/lib/galaxy/tools/error_reports/plugins/slack.py | 39,40 | 18,109 | submit_report | SlackPlugin | 40,109 | 40,109 | class SlackPlugin(BaseGitPlugin):
"""Send error report to Sentry."""
plugin_type = "slack"
def __init__(self, **kwargs):
self.app = kwargs["app"]
self.redact_user_details_in_bugreport = self.app.config.redact_user_details_in_bugreport
self.verbose = string_as_bool(kwargs.get("verbo... | class SlackPlugin(BaseGitPlugin):
"""Send error report to Sentry."""
plugin_type = "slack"
def __init__(self, **kwargs):
self.app = kwargs["app"]
self.redact_user_details_in_bugreport = self.app.config.redact_user_details_in_bugreport
self.verbose = string_as_bool(kwargs.get("verbo... | history_id_encoded = self.app.security.encode_id(dataset.history_id)
history_view_link = self.app.url_for("/histories/view", id=history_id_encoded, qualified=True)
error_report_id = str(uuid.uuid4())[0:13]
title = self._generate_error_title(job)
blocks: Dict[str, Any] = {
... | history_id_encoded = self.app.security.encode_id(dataset.history_id)
history_view_link = self.app.url_for("/histories/view", id=history_id_encoded, qualified=True)
error_report_id = str(uuid.uuid4())[0:13]
title = self._generate_error_title(job)
blocks: Dict[str, Any] = {
... | 161 | 254 | 886 | 1,140 | """The module describes the ``slack`` error plugin plugin."""
import logging
import uuid
from typing import (
Any,
Dict,
)
import requests
from galaxy.util import string_as_bool
from .base_git import BaseGitPlugin
log = logging.getLogger(__name__)
class SlackPlugin(BaseGitPlugin):
"""Send error report... | """The module describes the ``slack`` error plugin plugin."""
import logging
import uuid
from typing import (
Any,
Dict,
)
import requests
from galaxy.util import string_as_bool
from .base_git import BaseGitPlugin
log = logging.getLogger(__name__)
class SlackPlugin(BaseGitPlugin):
"""Send error report... |
46,320 | /home/hieuvd/dung_repo/raw/stars_03/galaxyproject_galaxy/galaxy | /home/hieuvd/dung_repo/raw/stars_03/galaxyproject_galaxy/galaxy/lib/galaxy/tools/errors.py | 240,241 | 239,265 | _send_report | EmailErrorReporter | 241,265 | 241,265 | class EmailErrorReporter(ErrorReporter):
def _send_report(self, user, email=None, message=None, **kwd):
FILL_FUNC_BODY | class EmailErrorReporter(ErrorReporter):
def _send_report(self, user, email=None, message=None, **kwd):
FILL_FUNC_BODY | smtp_server = self.app.config.smtp_server
assert smtp_server, ValueError("Mail is not configured for this Galaxy instance")
to = self.app.config.error_email_to
assert to, ValueError("Error reporting has been disabled for this Galaxy instance")
error_msg = validate_email_str(emai... | smtp_server = self.app.config.smtp_server
assert smtp_server, ValueError("Mail is not configured for this Galaxy instance")
to = self.app.config.error_email_to
assert to, ValueError("Error reporting has been disabled for this Galaxy instance")
error_msg = validate_email_str(emai... | 73 | 45 | 290 | 335 | """
Functionality for dealing with tool errors.
"""
import string
import markupsafe
from galaxy import (
model,
util,
)
from galaxy.security.validate_user_input import validate_email_str
from galaxy.util import unicodify
error_report_template = """
GALAXY TOOL ERROR REPORT
------------------------
This err... | """
Functionality for dealing with tool errors.
"""
import string
import markupsafe
from galaxy import (
model,
util,
)
from galaxy.security.validate_user_input import validate_email_str
from galaxy.util import unicodify
error_report_template = """
GALAXY TOOL ERROR REPORT
------------------------
This err... |
46,321 | /home/hieuvd/dung_repo/raw/stars_03/galaxyproject_galaxy/galaxy | /home/hieuvd/dung_repo/raw/stars_03/galaxyproject_galaxy/galaxy/lib/galaxy/tools/errors.py | 159,160 | 133,239 | create_report | ErrorReporter | 160,230 | 160,230 | class ErrorReporter:
def __init__(self, hda, app):
# Get the dataset
sa_session = app.model.context
if not isinstance(hda, model.HistoryDatasetAssociation):
hda_id = hda
try:
hda = sa_session.get(model.HistoryDatasetAssociation, hda_id)
... | class ErrorReporter:
def __init__(self, hda, app):
# Get the dataset
sa_session = app.model.context
if not isinstance(hda, model.HistoryDatasetAssociation):
hda_id = hda
try:
hda = sa_session.get(model.HistoryDatasetAssociation, hda_id)
... | hda = self.hda
job = self.job
host = self.app.url_for("/", qualified=True)
history_id_encoded = self.app.security.encode_id(hda.history_id)
history_view_link = self.app.url_for("/histories/view", id=history_id_encoded, qualified=True)
hda_id_encoded = self.app.security.en... | hda = self.hda
job = self.job
host = self.app.url_for("/", qualified=True)
history_id_encoded = self.app.security.encode_id(hda.history_id)
history_view_link = self.app.url_for("/histories/view", id=history_id_encoded, qualified=True)
hda_id_encoded = self.app.security.en... | 257 | 456 | 1,022 | 1,478 | """
Functionality for dealing with tool errors.
"""
import string
import markupsafe
from galaxy import (
model,
util,
)
from galaxy.security.validate_user_input import validate_email_str
from galaxy.util import unicodify
error_report_template = """
GALAXY TOOL ERROR REPORT
------------------------
This err... | """
Functionality for dealing with tool errors.
"""
import string
import markupsafe
from galaxy import (
model,
util,
)
from galaxy.security.validate_user_input import validate_email_str
from galaxy.util import unicodify
error_report_template = """
GALAXY TOOL ERROR REPORT
------------------------
This err... |
46,322 | /home/hieuvd/dung_repo/raw/stars_03/galaxyproject_galaxy/galaxy | /home/hieuvd/dung_repo/raw/stars_03/galaxyproject_galaxy/galaxy/lib/galaxy/tools/expressions/evaluation.py | 36,37 | 1,62 | evaluate | 37,62 | 37,62 | import json
import os
import subprocess
from typing import (
Optional,
TYPE_CHECKING,
)
from cwl_utils.expression import do_eval as _do_eval
from .util import find_engine
if TYPE_CHECKING:
from cwl_utils.types import (
CWLObjectType,
CWLOutputType,
)
FILE_DIRECTORY = os.path.normpath... | import json
import os
import subprocess
from typing import (
Optional,
TYPE_CHECKING,
)
from cwl_utils.expression import do_eval as _do_eval
from .util import find_engine
if TYPE_CHECKING:
from cwl_utils.types import (
CWLObjectType,
CWLOutputType,
)
FILE_DIRECTORY = os.path.normpath... | application = find_engine(config)
default_context = {
"engineConfig": [],
"job": {},
"context": None,
"outdir": None,
"tmpdir": None,
}
new_input = default_context
new_input.update(input)
sp = subprocess.Popen(
[application, NODE_ENGINE], shell=... | application = find_engine(config)
default_context = {
"engineConfig": [],
"job": {},
"context": None,
"outdir": None,
"tmpdir": None,
}
new_input = default_context
new_input.update(input)
sp = subprocess.Popen(
[application, NODE_ENGINE], shell=... | 64 | 275 | 306 | 581 | import json
import os
import subprocess
from typing import (
Optional,
TYPE_CHECKING,
)
from cwl_utils.expression import do_eval as _do_eval
from .util import find_engine
if TYPE_CHECKING:
from cwl_utils.types import (
CWLObjectType,
CWLOutputType,
)
FILE_DIRECTORY = os.path.normpath... | import json
import os
import subprocess
from typing import (
Optional,
TYPE_CHECKING,
)
from cwl_utils.expression import do_eval as _do_eval
from .util import find_engine
if TYPE_CHECKING:
from cwl_utils.types import (
CWLObjectType,
CWLOutputType,
)
FILE_DIRECTORY = os.path.normpath... | |
46,323 | /home/hieuvd/dung_repo/raw/stars_03/galaxyproject_galaxy/galaxy | /home/hieuvd/dung_repo/raw/stars_03/galaxyproject_galaxy/galaxy/lib/galaxy/tools/expressions/script.py | 7,8 | 1,16 | write_evalute_script | 11,16 | 8,16 | import os
EXPRESSION_SCRIPT_NAME = "_evaluate_expression_.py"
EXPRESSION_SCRIPT_CALL = f"python {EXPRESSION_SCRIPT_NAME}"
def write_evalute_script(in_directory):
FILL_FUNC_BODY | import os
EXPRESSION_SCRIPT_NAME = "_evaluate_expression_.py"
EXPRESSION_SCRIPT_CALL = f"python {EXPRESSION_SCRIPT_NAME}"
def write_evalute_script(in_directory):
"""Responsible for writing the script that evaluates expressions
in Galaxy jobs.
"""
FILL_FUNC_BODY | script = os.path.join(in_directory, EXPRESSION_SCRIPT_NAME)
with open(script, "w") as f:
f.write("from galaxy_ext.expressions.handle_job import run; run()")
return script
| """Responsible for writing the script that evaluates expressions
in Galaxy jobs.
"""
script = os.path.join(in_directory, EXPRESSION_SCRIPT_NAME)
with open(script, "w") as f:
f.write("from galaxy_ext.expressions.handle_job import run; run()")
return script
| 16 | 90 | 68 | 158 | import os
EXPRESSION_SCRIPT_NAME = "_evaluate_expression_.py"
EXPRESSION_SCRIPT_CALL = f"python {EXPRESSION_SCRIPT_NAME}"
def write_evalute_script(in_directory):
FILL_FUNC_BODY | import os
EXPRESSION_SCRIPT_NAME = "_evaluate_expression_.py"
EXPRESSION_SCRIPT_CALL = f"python {EXPRESSION_SCRIPT_NAME}"
def write_evalute_script(in_directory):
"""Responsible for writing the script that evaluates expressions
in Galaxy jobs.
"""
FILL_FUNC_BODY | |
46,324 | /home/hieuvd/dung_repo/raw/stars_03/galaxyproject_galaxy/galaxy | /home/hieuvd/dung_repo/raw/stars_03/galaxyproject_galaxy/galaxy/lib/galaxy/tools/expressions/util.py | 4,5 | 1,11 | find_engine | 5,11 | 5,11 | from galaxy.util.commands import which
def find_engine(config):
FILL_FUNC_BODY | from galaxy.util.commands import which
def find_engine(config):
FILL_FUNC_BODY | nodejs_path = getattr(config, "nodejs_path", None)
if nodejs_path is None:
nodejs_path = which("nodejs") or which("node") or None
if nodejs_path is None:
raise Exception("nodejs or node not found on PATH")
return nodejs_path
| nodejs_path = getattr(config, "nodejs_path", None)
if nodejs_path is None:
nodejs_path = which("nodejs") or which("node") or None
if nodejs_path is None:
raise Exception("nodejs or node not found on PATH")
return nodejs_path
| 30 | 30 | 86 | 116 | from galaxy.util.commands import which
def find_engine(config):
FILL_FUNC_BODY | from galaxy.util.commands import which
def find_engine(config):
FILL_FUNC_BODY | |
46,325 | /home/hieuvd/dung_repo/raw/stars_03/galaxyproject_galaxy/galaxy | /home/hieuvd/dung_repo/raw/stars_03/galaxyproject_galaxy/galaxy/lib/galaxy/tools/imp_exp/export_history.py | 34,35 | 1,81 | main | 35,63 | 35,63 | #!/usr/bin/env python
"""
Export a history to an archive file using attribute files.
usage: %prog history_attrs dataset_attrs job_attrs out_file
-G, --gzip: gzip archive file
"""
import json
import optparse
import os
import shutil
import sys
from galaxy.files import ConfiguredFileSources
from galaxy.model.store ... | #!/usr/bin/env python
"""
Export a history to an archive file using attribute files.
usage: %prog history_attrs dataset_attrs job_attrs out_file
-G, --gzip: gzip archive file
"""
import json
import optparse
import os
import shutil
import sys
from galaxy.files import ConfiguredFileSources
from galaxy.model.store ... | # Parse command line.
parser = optparse.OptionParser()
parser.add_option("-G", "--gzip", dest="gzip", action="store_true", help="Compress archive using gzip.")
parser.add_option(
"--galaxy-version", dest="galaxy_version", help="Galaxy version that initiated the command.", default=None
)
... | # Parse command line.
parser = optparse.OptionParser()
parser.add_option("-G", "--gzip", dest="gzip", action="store_true", help="Compress archive using gzip.")
parser.add_option(
"--galaxy-version", dest="galaxy_version", help="Galaxy version that initiated the command.", default=None
)
... | 98 | 536 | 360 | 896 | #!/usr/bin/env python
"""
Export a history to an archive file using attribute files.
usage: %prog history_attrs dataset_attrs job_attrs out_file
-G, --gzip: gzip archive file
"""
import json
import optparse
import os
import shutil
import sys
from galaxy.files import ConfiguredFileSources
from galaxy.model.store ... | #!/usr/bin/env python
"""
Export a history to an archive file using attribute files.
usage: %prog history_attrs dataset_attrs job_attrs out_file
-G, --gzip: gzip archive file
"""
import json
import optparse
import os
import shutil
import sys
from galaxy.files import ConfiguredFileSources
from galaxy.model.store ... | |
46,326 | /home/hieuvd/dung_repo/raw/stars_03/galaxyproject_galaxy/galaxy | /home/hieuvd/dung_repo/raw/stars_03/galaxyproject_galaxy/galaxy/lib/galaxy/tools/parameters/cancelable_request.py | 29,37 | 1,74 | async_request_with_timeout | 37,50 | 37,50 | import asyncio
import logging
from typing import (
Any,
Dict,
Optional,
)
import aiohttp
from typing_extensions import Literal
log = logging.getLogger()
REQUEST_METHOD = Literal["GET", "POST", "HEAD"]
async def fetch_url(
session: aiohttp.ClientSession,
url: str,
params: Optional[Dict[str, ... | import asyncio
import logging
from typing import (
Any,
Dict,
Optional,
)
import aiohttp
from typing_extensions import Literal
log = logging.getLogger()
REQUEST_METHOD = Literal["GET", "POST", "HEAD"]
async def fetch_url(
session: aiohttp.ClientSession,
url: str,
params: Optional[Dict[str, ... | async with aiohttp.ClientSession() as session:
try:
# Wait for the async request, with a user-defined timeout
result = await asyncio.wait_for(
fetch_url(session=session, url=url, params=params, data=data, headers=headers, method=method),
timeout=timeou... | async with aiohttp.ClientSession() as session:
try:
# Wait for the async request, with a user-defined timeout
result = await asyncio.wait_for(
fetch_url(session=session, url=url, params=params, data=data, headers=headers, method=method),
timeout=timeou... | 41 | 501 | 133 | 634 | import asyncio
import logging
from typing import (
Any,
Dict,
Optional,
)
import aiohttp
from typing_extensions import Literal
log = logging.getLogger()
REQUEST_METHOD = Literal["GET", "POST", "HEAD"]
async def fetch_url(
session: aiohttp.ClientSession,
url: str,
params: Optional[Dict[str, ... | import asyncio
import logging
from typing import (
Any,
Dict,
Optional,
)
import aiohttp
from typing_extensions import Literal
log = logging.getLogger()
REQUEST_METHOD = Literal["GET", "POST", "HEAD"]
async def fetch_url(
session: aiohttp.ClientSession,
url: str,
params: Optional[Dict[str, ... | |
46,327 | /home/hieuvd/dung_repo/raw/stars_03/galaxyproject_galaxy/galaxy | /home/hieuvd/dung_repo/raw/stars_03/galaxyproject_galaxy/galaxy/lib/galaxy/tools/parameters/history_query.py | 51,52 | 6,62 | can_map_over | HistoryQuery | 52,62 | 52,62 | class HistoryQuery:
"""An object for describing the collections to pull out of a history,
used by DataCollectionToolParameter.
"""
def __init__(self, **kwargs):
self.collection_type_descriptions = kwargs.get("collection_type_descriptions", None)
@staticmethod
def from_collection_type(c... | class HistoryQuery:
"""An object for describing the collections to pull out of a history,
used by DataCollectionToolParameter.
"""
def __init__(self, **kwargs):
self.collection_type_descriptions = kwargs.get("collection_type_descriptions", None)
@staticmethod
def from_collection_type(c... | collection_type_descriptions = self.collection_type_descriptions
if collection_type_descriptions is None:
return False
hdca_collection_type = hdca.collection.collection_type
for collection_type_description in collection_type_descriptions:
# See note about the way... | collection_type_descriptions = self.collection_type_descriptions
if collection_type_descriptions is None:
return False
hdca_collection_type = hdca.collection.collection_type
for collection_type_description in collection_type_descriptions:
# See note about the way... | 32 | 572 | 133 | 705 | import logging
log = logging.getLogger(__name__)
class HistoryQuery:
"""An object for describing the collections to pull out of a history,
used by DataCollectionToolParameter.
"""
def __init__(self, **kwargs):
self.collection_type_descriptions = kwargs.get("collection_type_descriptions", Non... | import logging
log = logging.getLogger(__name__)
class HistoryQuery:
"""An object for describing the collections to pull out of a history,
used by DataCollectionToolParameter.
"""
def __init__(self, **kwargs):
self.collection_type_descriptions = kwargs.get("collection_type_descriptions", Non... |
46,328 | /home/hieuvd/dung_repo/raw/stars_03/galaxyproject_galaxy/galaxy | /home/hieuvd/dung_repo/raw/stars_03/galaxyproject_galaxy/galaxy/lib/galaxy/tools/parameters/input_translation.py | 101,102 | 12,123 | translate | ToolInputTranslator | 105,123 | 102,123 | class ToolInputTranslator:
"""
Handles Tool input translation.
This is used for data source tools
>>> from galaxy.util import Params, XML
>>> translator = ToolInputTranslator.from_element(XML(
... '''
... <request_param_translation>
... <request_param galaxy_name="URL_method" remote_na... | class ToolInputTranslator:
"""
Handles Tool input translation.
This is used for data source tools
>>> from galaxy.util import Params, XML
>>> translator = ToolInputTranslator.from_element(XML(
... '''
... <request_param_translation>
... <request_param galaxy_name="URL_method" remote_na... | for remote_name, translator in self.param_trans_dict.items():
galaxy_name = (
translator.galaxy_name
) # NB: if a param by name galaxy_name is provided, it is always thrown away unless galaxy_name == remote_name
value = params.get(
remote_name... | """
update params in-place
"""
for remote_name, translator in self.param_trans_dict.items():
galaxy_name = (
translator.galaxy_name
) # NB: if a param by name galaxy_name is provided, it is always thrown away unless galaxy_name == remote_name
... | 88 | 1,367 | 312 | 1,679 | """
Tool Input Translation.
"""
import logging
from galaxy.util.bunch import Bunch
log = logging.getLogger(__name__)
class ToolInputTranslator:
"""
Handles Tool input translation.
This is used for data source tools
>>> from galaxy.util import Params, XML
>>> translator = ToolInputTranslator.fr... | """
Tool Input Translation.
"""
import logging
from galaxy.util.bunch import Bunch
log = logging.getLogger(__name__)
class ToolInputTranslator:
"""
Handles Tool input translation.
This is used for data source tools
>>> from galaxy.util import Params, XML
>>> translator = ToolInputTranslator.fr... |
46,330 | /home/hieuvd/dung_repo/raw/stars_03/galaxyproject_galaxy/galaxy | /home/hieuvd/dung_repo/raw/stars_03/galaxyproject_galaxy/galaxy/lib/galaxy/tools/parameters/sanitize.py | 51,53 | 13,166 | from_element | ToolParameterSanitizer | 54,93 | 53,93 | class ToolParameterSanitizer:
"""
Handles tool parameter specific sanitizing.
>>> from galaxy.util import XML
>>> sanitizer = ToolParameterSanitizer.from_element(XML(
... '''
... <sanitizer invalid_char="">
... <valid initial="string.ascii_letters"/>
... </sanitizer>
... '''))
... | class ToolParameterSanitizer:
"""
Handles tool parameter specific sanitizing.
>>> from galaxy.util import XML
>>> sanitizer = ToolParameterSanitizer.from_element(XML(
... '''
... <sanitizer invalid_char="">
... <valid initial="string.ascii_letters"/>
... </sanitizer>
... '''))
... | # TODO: Add ability to generically specify a method to use for sanitizing input via specification in tool XML
rval = ToolParameterSanitizer()
rval._invalid_char = elem.get("invalid_char", cls.DEFAULT_INVALID_CHAR)
rval.sanitize = galaxy.util.string_as_bool(elem.get("sanitize", "True"))
... | """Loads the proper filter by the type attribute of elem"""
# TODO: Add ability to generically specify a method to use for sanitizing input via specification in tool XML
rval = ToolParameterSanitizer()
rval._invalid_char = elem.get("invalid_char", cls.DEFAULT_INVALID_CHAR)
rval.s... | 160 | 1,361 | 687 | 2,048 | """
Tool Parameter specific sanitizing.
"""
import logging
import string
import galaxy.util
log = logging.getLogger(__name__)
class ToolParameterSanitizer:
"""
Handles tool parameter specific sanitizing.
>>> from galaxy.util import XML
>>> sanitizer = ToolParameterSanitizer.from_element(XML(
.... | """
Tool Parameter specific sanitizing.
"""
import logging
import string
import galaxy.util
log = logging.getLogger(__name__)
class ToolParameterSanitizer:
"""
Handles tool parameter specific sanitizing.
>>> from galaxy.util import XML
>>> sanitizer = ToolParameterSanitizer.from_element(XML(
.... |
46,331 | /home/hieuvd/dung_repo/raw/stars_03/galaxyproject_galaxy/galaxy | /home/hieuvd/dung_repo/raw/stars_03/galaxyproject_galaxy/galaxy/lib/galaxy/tools/parameters/validation.py | 220,222 | 215,233 | from_element | DatasetEmptyValidator | 222,228 | 222,228 | class DatasetEmptyValidator(Validator):
"""
Validator that checks if a dataset has a positive file size.
"""
@classmethod
def from_element(cls, param, elem):
FILL_FUNC_BODY def validate(self, value, trans=None):
if value:
super().validate(value.get_size() != 0)
| class DatasetEmptyValidator(Validator):
"""
Validator that checks if a dataset has a positive file size.
"""
@classmethod
def from_element(cls, param, elem):
FILL_FUNC_BODY def validate(self, value, trans=None):
if value:
super().validate(value.get_size() != 0)
| message = elem.get("message")
negate = elem.get("negate", "false")
if not message:
message = f"The selected dataset is {'non-' if negate == 'true' else ''}empty, this tool expects {'non-' if negate == 'false' else ''}empty files."
return cls(message, negate)
| message = elem.get("message")
negate = elem.get("negate", "false")
if not message:
message = f"The selected dataset is {'non-' if negate == 'true' else ''}empty, this tool expects {'non-' if negate == 'false' else ''}empty files."
return cls(message, negate)
| 37 | 95 | 95 | 190 | """
Classes related to parameter validation.
"""
import abc
import json
import logging
import os.path
import regex
from galaxy import (
model,
util,
)
log = logging.getLogger(__name__)
class Validator(abc.ABC):
"""
A validator checks that a value meets some conditions OR raises ValueError
"""
... | """
Classes related to parameter validation.
"""
import abc
import json
import logging
import os.path
import regex
from galaxy import (
model,
util,
)
log = logging.getLogger(__name__)
class Validator(abc.ABC):
"""
A validator checks that a value meets some conditions OR raises ValueError
"""
... |
46,332 | /home/hieuvd/dung_repo/raw/stars_03/galaxyproject_galaxy/galaxy | /home/hieuvd/dung_repo/raw/stars_03/galaxyproject_galaxy/galaxy/lib/galaxy/tools/parameters/validation.py | 238,240 | 233,251 | from_element | DatasetExtraFilesPathEmptyValidator | 240,246 | 240,246 | class DatasetExtraFilesPathEmptyValidator(Validator):
"""
Validator that checks if a dataset's extra_files_path exists and is not empty.
"""
@classmethod
def from_element(cls, param, elem):
FILL_FUNC_BODY def validate(self, value, trans=None):
if value:
super().validate(value... | class DatasetExtraFilesPathEmptyValidator(Validator):
"""
Validator that checks if a dataset's extra_files_path exists and is not empty.
"""
@classmethod
def from_element(cls, param, elem):
FILL_FUNC_BODY def validate(self, value, trans=None):
if value:
super().validate(value... | message = elem.get("message")
negate = elem.get("negate", "false")
if not message:
message = f"The selected dataset's extra_files_path directory is {'non-' if negate == 'true' else ''}empty or does {'not ' if negate == 'false' else ''}exist, this tool expects {'non-' if negate == 'fa... | message = elem.get("message")
negate = elem.get("negate", "false")
if not message:
message = f"The selected dataset's extra_files_path directory is {'non-' if negate == 'true' else ''}empty or does {'not ' if negate == 'false' else ''}exist, this tool expects {'non-' if negate == 'fa... | 55 | 111 | 129 | 240 | """
Classes related to parameter validation.
"""
import abc
import json
import logging
import os.path
import regex
from galaxy import (
model,
util,
)
log = logging.getLogger(__name__)
class Validator(abc.ABC):
"""
A validator checks that a value meets some conditions OR raises ValueError
"""
... | """
Classes related to parameter validation.
"""
import abc
import json
import logging
import os.path
import regex
from galaxy import (
model,
util,
)
log = logging.getLogger(__name__)
class Validator(abc.ABC):
"""
A validator checks that a value meets some conditions OR raises ValueError
"""
... |
46,333 | /home/hieuvd/dung_repo/raw/stars_03/galaxyproject_galaxy/galaxy | /home/hieuvd/dung_repo/raw/stars_03/galaxyproject_galaxy/galaxy/lib/galaxy/tools/parameters/validation.py | 199,201 | 194,215 | from_element | DatasetOkValidator | 201,210 | 201,210 | class DatasetOkValidator(Validator):
"""
Validator that checks if a dataset is in an 'ok' state
"""
@classmethod
def from_element(cls, param, elem):
FILL_FUNC_BODY def validate(self, value, trans=None):
if value:
super().validate(value.state == model.Dataset.states.OK)
| class DatasetOkValidator(Validator):
"""
Validator that checks if a dataset is in an 'ok' state
"""
@classmethod
def from_element(cls, param, elem):
FILL_FUNC_BODY def validate(self, value, trans=None):
if value:
super().validate(value.state == model.Dataset.states.OK)
| negate = elem.get("negate", "false")
message = elem.get("message")
if message is None:
if negate == "false":
message = "The selected dataset is still being generated, select another dataset or wait until it is completed"
else:
message = "Th... | negate = elem.get("negate", "false")
message = elem.get("message")
if message is None:
if negate == "false":
message = "The selected dataset is still being generated, select another dataset or wait until it is completed"
else:
message = "Th... | 48 | 99 | 104 | 203 | """
Classes related to parameter validation.
"""
import abc
import json
import logging
import os.path
import regex
from galaxy import (
model,
util,
)
log = logging.getLogger(__name__)
class Validator(abc.ABC):
"""
A validator checks that a value meets some conditions OR raises ValueError
"""
... | """
Classes related to parameter validation.
"""
import abc
import json
import logging
import os.path
import regex
from galaxy import (
model,
util,
)
log = logging.getLogger(__name__)
class Validator(abc.ABC):
"""
A validator checks that a value meets some conditions OR raises ValueError
"""
... |
46,334 | /home/hieuvd/dung_repo/raw/stars_03/galaxyproject_galaxy/galaxy | /home/hieuvd/dung_repo/raw/stars_03/galaxyproject_galaxy/galaxy/lib/galaxy/tools/parameters/validation.py | 368,370 | 363,383 | from_element | EmptyTextfieldValidator | 370,379 | 370,379 | class EmptyTextfieldValidator(Validator):
"""
Validator that checks for empty text field
"""
@classmethod
def from_element(cls, param, elem):
FILL_FUNC_BODY def validate(self, value, trans=None):
super().validate(value != "")
| class EmptyTextfieldValidator(Validator):
"""
Validator that checks for empty text field
"""
@classmethod
def from_element(cls, param, elem):
FILL_FUNC_BODY def validate(self, value, trans=None):
super().validate(value != "")
| message = elem.get("message")
negate = elem.get("negate", "false")
if not message:
if negate == "false":
message = elem.get("message", "Field requires a value")
else:
message = elem.get("message", "Field must not set a value")
retur... | message = elem.get("message")
negate = elem.get("negate", "false")
if not message:
if negate == "false":
message = elem.get("message", "Field requires a value")
else:
message = elem.get("message", "Field must not set a value")
retur... | 34 | 81 | 99 | 180 | """
Classes related to parameter validation.
"""
import abc
import json
import logging
import os.path
import regex
from galaxy import (
model,
util,
)
log = logging.getLogger(__name__)
class Validator(abc.ABC):
"""
A validator checks that a value meets some conditions OR raises ValueError
"""
... | """
Classes related to parameter validation.
"""
import abc
import json
import logging
import os.path
import regex
from galaxy import (
model,
util,
)
log = logging.getLogger(__name__)
class Validator(abc.ABC):
"""
A validator checks that a value meets some conditions OR raises ValueError
"""
... |
46,335 | /home/hieuvd/dung_repo/raw/stars_03/galaxyproject_galaxy/galaxy | /home/hieuvd/dung_repo/raw/stars_03/galaxyproject_galaxy/galaxy/lib/galaxy/tools/parameters/validation.py | 124,125 | 107,132 | validate | ExpressionValidator | 125,132 | 125,132 | class ExpressionValidator(Validator):
"""
Validator that evaluates a python expression using the value
"""
@classmethod
def from_element(cls, param, elem):
return cls(elem.get("message"), elem.text, elem.get("negate", "false"))
def __init__(self, message, expression, negate):
i... | class ExpressionValidator(Validator):
"""
Validator that evaluates a python expression using the value
"""
@classmethod
def from_element(cls, param, elem):
return cls(elem.get("message"), elem.text, elem.get("negate", "false"))
def __init__(self, message, expression, negate):
i... | try:
evalresult = eval(self.compiled_expression, dict(value=value))
except Exception:
super().validate(False, message=f"Validator '{self.expression}' could not be evaluated on '{value}'")
super().validate(bool(evalresult), value_to_show=value)
| try:
evalresult = eval(self.compiled_expression, dict(value=value))
except Exception:
super().validate(False, message=f"Validator '{self.expression}' could not be evaluated on '{value}'")
super().validate(bool(evalresult), value_to_show=value)
| 18 | 208 | 88 | 296 | """
Classes related to parameter validation.
"""
import abc
import json
import logging
import os.path
import regex
from galaxy import (
model,
util,
)
log = logging.getLogger(__name__)
class Validator(abc.ABC):
"""
A validator checks that a value meets some conditions OR raises ValueError
"""
... | """
Classes related to parameter validation.
"""
import abc
import json
import logging
import os.path
import regex
from galaxy import (
model,
util,
)
log = logging.getLogger(__name__)
class Validator(abc.ABC):
"""
A validator checks that a value meets some conditions OR raises ValueError
"""
... |
46,336 | /home/hieuvd/dung_repo/raw/stars_03/galaxyproject_galaxy/galaxy | /home/hieuvd/dung_repo/raw/stars_03/galaxyproject_galaxy/galaxy/lib/galaxy/tools/parameters/validation.py | 137,139 | 132,174 | from_element | InRangeValidator | 139,148 | 139,148 | class InRangeValidator(ExpressionValidator):
"""
Validator that ensures a number is in a specified range
"""
@classmethod
def from_element(cls, param, elem):
FILL_FUNC_BODY def __init__(self, message, range_min, range_max, exclude_min=False, exclude_max=False, negate=False):
"""
... | class InRangeValidator(ExpressionValidator):
"""
Validator that ensures a number is in a specified range
"""
@classmethod
def from_element(cls, param, elem):
FILL_FUNC_BODY def __init__(self, message, range_min, range_max, exclude_min=False, exclude_max=False, negate=False):
"""
... | return cls(
elem.get("message"),
elem.get("min"),
elem.get("max"),
elem.get("exclude_min", "false"),
elem.get("exclude_max", "false"),
elem.get("negate", "false"),
)
| return cls(
elem.get("message"),
elem.get("min"),
elem.get("max"),
elem.get("exclude_min", "false"),
elem.get("exclude_max", "false"),
elem.get("negate", "false"),
)
| 12 | 448 | 83 | 531 | """
Classes related to parameter validation.
"""
import abc
import json
import logging
import os.path
import regex
from galaxy import (
model,
util,
)
log = logging.getLogger(__name__)
class Validator(abc.ABC):
"""
A validator checks that a value meets some conditions OR raises ValueError
"""
... | """
Classes related to parameter validation.
"""
import abc
import json
import logging
import os.path
import regex
from galaxy import (
model,
util,
)
log = logging.getLogger(__name__)
class Validator(abc.ABC):
"""
A validator checks that a value meets some conditions OR raises ValueError
"""
... |
46,337 | /home/hieuvd/dung_repo/raw/stars_03/galaxyproject_galaxy/galaxy | /home/hieuvd/dung_repo/raw/stars_03/galaxyproject_galaxy/galaxy/lib/galaxy/tools/parameters/validation.py | 179,181 | 174,194 | from_element | LengthValidator | 181,183 | 181,183 | class LengthValidator(InRangeValidator):
"""
Validator that ensures the length of the provided string (value) is in a specific range
"""
@classmethod
def from_element(cls, param, elem):
FILL_FUNC_BODY def __init__(self, message, length_min, length_max, negate):
if message is None:
... | class LengthValidator(InRangeValidator):
"""
Validator that ensures the length of the provided string (value) is in a specific range
"""
@classmethod
def from_element(cls, param, elem):
FILL_FUNC_BODY def __init__(self, message, length_min, length_max, negate):
if message is None:
... | return cls(elem.get("message"), elem.get("min"), elem.get("max"), elem.get("negate", "false"))
| return cls(elem.get("message"), elem.get("min"), elem.get("max"), elem.get("negate", "false"))
| 6 | 213 | 37 | 250 | """
Classes related to parameter validation.
"""
import abc
import json
import logging
import os.path
import regex
from galaxy import (
model,
util,
)
log = logging.getLogger(__name__)
class Validator(abc.ABC):
"""
A validator checks that a value meets some conditions OR raises ValueError
"""
... | """
Classes related to parameter validation.
"""
import abc
import json
import logging
import os.path
import regex
from galaxy import (
model,
util,
)
log = logging.getLogger(__name__)
class Validator(abc.ABC):
"""
A validator checks that a value meets some conditions OR raises ValueError
"""
... |
46,338 | /home/hieuvd/dung_repo/raw/stars_03/galaxyproject_galaxy/galaxy | /home/hieuvd/dung_repo/raw/stars_03/galaxyproject_galaxy/galaxy/lib/galaxy/tools/parameters/validation.py | 305,307 | 285,321 | from_element | MetadataEqualValidator | 307,315 | 307,315 | class MetadataEqualValidator(Validator):
"""
Validator that checks for a metadata value for equality
metadata values that are lists are converted as comma separated string
everything else is converted to the string representation
"""
requires_dataset_metadata = True
def __init__(self, met... | class MetadataEqualValidator(Validator):
"""
Validator that checks for a metadata value for equality
metadata values that are lists are converted as comma separated string
everything else is converted to the string representation
"""
requires_dataset_metadata = True
def __init__(self, met... | value = elem.get("value", None) or json.loads(elem.get("value_json", "null"))
return cls(
metadata_name=elem.get("metadata_name", None),
value=value,
message=elem.get("message", None),
negate=elem.get("negate", "false"),
)
| value = elem.get("value", None) or json.loads(elem.get("value_json", "null"))
return cls(
metadata_name=elem.get("metadata_name", None),
value=value,
message=elem.get("message", None),
negate=elem.get("negate", "false"),
)
| 17 | 290 | 96 | 386 | """
Classes related to parameter validation.
"""
import abc
import json
import logging
import os.path
import regex
from galaxy import (
model,
util,
)
log = logging.getLogger(__name__)
class Validator(abc.ABC):
"""
A validator checks that a value meets some conditions OR raises ValueError
"""
... | """
Classes related to parameter validation.
"""
import abc
import json
import logging
import os.path
import regex
from galaxy import (
model,
util,
)
log = logging.getLogger(__name__)
class Validator(abc.ABC):
"""
A validator checks that a value meets some conditions OR raises ValueError
"""
... |
46,339 | /home/hieuvd/dung_repo/raw/stars_03/galaxyproject_galaxy/galaxy | /home/hieuvd/dung_repo/raw/stars_03/galaxyproject_galaxy/galaxy/lib/galaxy/tools/parameters/validation.py | 520,522 | 511,550 | from_element | MetadataInDataTableColumnValidator | 522,538 | 522,538 | class MetadataInDataTableColumnValidator(ValueInDataTableColumnValidator):
"""
Validator that checks if the value for a dataset's metadata item exists in a file.
note: this is covered in a framework test (validation_metadata_in_datatable)
"""
requires_dataset_metadata = True
@classmethod
... | class MetadataInDataTableColumnValidator(ValueInDataTableColumnValidator):
"""
Validator that checks if the value for a dataset's metadata item exists in a file.
note: this is covered in a framework test (validation_metadata_in_datatable)
"""
requires_dataset_metadata = True
@classmethod
... | table_name = elem.get("table_name")
assert table_name, f"Required 'table_name' attribute missing from {elem.get('type')} validator."
tool_data_table = param.tool.app.tool_data_tables[table_name]
metadata_name = elem.get("metadata_name")
assert metadata_name, f"Required 'metadata_... | table_name = elem.get("table_name")
assert table_name, f"Required 'table_name' attribute missing from {elem.get('type')} validator."
tool_data_table = param.tool.app.tool_data_tables[table_name]
metadata_name = elem.get("metadata_name")
assert metadata_name, f"Required 'metadata_... | 68 | 239 | 260 | 499 | """
Classes related to parameter validation.
"""
import abc
import json
import logging
import os.path
import regex
from galaxy import (
model,
util,
)
log = logging.getLogger(__name__)
class Validator(abc.ABC):
"""
A validator checks that a value meets some conditions OR raises ValueError
"""
... | """
Classes related to parameter validation.
"""
import abc
import json
import logging
import os.path
import regex
from galaxy import (
model,
util,
)
log = logging.getLogger(__name__)
class Validator(abc.ABC):
"""
A validator checks that a value meets some conditions OR raises ValueError
"""
... |
46,340 | /home/hieuvd/dung_repo/raw/stars_03/galaxyproject_galaxy/galaxy | /home/hieuvd/dung_repo/raw/stars_03/galaxyproject_galaxy/galaxy/lib/galaxy/tools/parameters/validation.py | 394,396 | 383,441 | from_element | MetadataInFileColumnValidator | 396,412 | 396,412 | class MetadataInFileColumnValidator(Validator):
"""
Validator that checks if the value for a dataset's metadata item exists in a file.
Deprecated: DataTables are now the preferred way.
note: this is covered in a framework test (validation_dataset_metadata_in_file)
"""
requires_dataset_metadat... | class MetadataInFileColumnValidator(Validator):
"""
Validator that checks if the value for a dataset's metadata item exists in a file.
Deprecated: DataTables are now the preferred way.
note: this is covered in a framework test (validation_dataset_metadata_in_file)
"""
requires_dataset_metadat... | filename = elem.get("filename")
assert filename, f"Required 'filename' attribute missing from {elem.get('type')} validator."
filename = f"{param.tool.app.config.tool_data_path}/{filename.strip()}"
assert os.path.exists(filename), f"File {filename} specified by the 'filename' attribute no... | filename = elem.get("filename")
assert filename, f"Required 'filename' attribute missing from {elem.get('type')} validator."
filename = f"{param.tool.app.config.tool_data_path}/{filename.strip()}"
assert os.path.exists(filename), f"File {filename} specified by the 'filename' attribute no... | 81 | 370 | 308 | 678 | """
Classes related to parameter validation.
"""
import abc
import json
import logging
import os.path
import regex
from galaxy import (
model,
util,
)
log = logging.getLogger(__name__)
class Validator(abc.ABC):
"""
A validator checks that a value meets some conditions OR raises ValueError
"""
... | """
Classes related to parameter validation.
"""
import abc
import json
import logging
import os.path
import regex
from galaxy import (
model,
util,
)
log = logging.getLogger(__name__)
class Validator(abc.ABC):
"""
A validator checks that a value meets some conditions OR raises ValueError
"""
... |
46,341 | /home/hieuvd/dung_repo/raw/stars_03/galaxyproject_galaxy/galaxy | /home/hieuvd/dung_repo/raw/stars_03/galaxyproject_galaxy/galaxy/lib/galaxy/tools/parameters/validation.py | 604,605 | 574,619 | validate | MetadataInRangeValidator | 605,619 | 605,619 | class MetadataInRangeValidator(InRangeValidator):
"""
validator that ensures metadata is in a specified range
note: this is covered in a framework test (validation_metadata_in_range)
"""
requires_dataset_metadata = True
@classmethod
def from_element(cls, param, elem):
metadata_nam... | class MetadataInRangeValidator(InRangeValidator):
"""
validator that ensures metadata is in a specified range
note: this is covered in a framework test (validation_metadata_in_range)
"""
requires_dataset_metadata = True
@classmethod
def from_element(cls, param, elem):
metadata_nam... | if value:
if not isinstance(value, model.DatasetInstance):
raise ValueError("A non-dataset value was provided.")
try:
value_to_check = float(
value.metadata.spec[self.metadata_name].param.to_string(value.metadata.get(self.metadata_name)... | if value:
if not isinstance(value, model.DatasetInstance):
raise ValueError("A non-dataset value was provided.")
try:
value_to_check = float(
value.metadata.spec[self.metadata_name].param.to_string(value.metadata.get(self.metadata_name)... | 37 | 330 | 167 | 497 | """
Classes related to parameter validation.
"""
import abc
import json
import logging
import os.path
import regex
from galaxy import (
model,
util,
)
log = logging.getLogger(__name__)
class Validator(abc.ABC):
"""
A validator checks that a value meets some conditions OR raises ValueError
"""
... | """
Classes related to parameter validation.
"""
import abc
import json
import logging
import os.path
import regex
from galaxy import (
model,
util,
)
log = logging.getLogger(__name__)
class Validator(abc.ABC):
"""
A validator checks that a value meets some conditions OR raises ValueError
"""
... |
46,342 | /home/hieuvd/dung_repo/raw/stars_03/galaxyproject_galaxy/galaxy | /home/hieuvd/dung_repo/raw/stars_03/galaxyproject_galaxy/galaxy/lib/galaxy/tools/parameters/validation.py | 565,566 | 550,574 | validate | MetadataNotInDataTableColumnValidator | 566,574 | 566,574 | class MetadataNotInDataTableColumnValidator(MetadataInDataTableColumnValidator):
"""
Validator that checks if the value for a dataset's metadata item doesn't exists in a file.
Equivalent to MetadataInDataTableColumnValidator with `negate="true"`.
note: this is covered in a framework test (validation_me... | class MetadataNotInDataTableColumnValidator(MetadataInDataTableColumnValidator):
"""
Validator that checks if the value for a dataset's metadata item doesn't exists in a file.
Equivalent to MetadataInDataTableColumnValidator with `negate="true"`.
note: this is covered in a framework test (validation_me... | try:
super().validate(value, trans)
except ValueError:
return
else:
raise ValueError(self.message)
| try:
super().validate(value, trans)
except ValueError:
return
else:
raise ValueError(self.message)
| 9 | 196 | 47 | 243 | """
Classes related to parameter validation.
"""
import abc
import json
import logging
import os.path
import regex
from galaxy import (
model,
util,
)
log = logging.getLogger(__name__)
class Validator(abc.ABC):
"""
A validator checks that a value meets some conditions OR raises ValueError
"""
... | """
Classes related to parameter validation.
"""
import abc
import json
import logging
import os.path
import regex
from galaxy import (
model,
util,
)
log = logging.getLogger(__name__)
class Validator(abc.ABC):
"""
A validator checks that a value meets some conditions OR raises ValueError
"""
... |
46,343 | /home/hieuvd/dung_repo/raw/stars_03/galaxyproject_galaxy/galaxy | /home/hieuvd/dung_repo/raw/stars_03/galaxyproject_galaxy/galaxy/lib/galaxy/tools/parameters/validation.py | 278,279 | 251,285 | validate | MetadataValidator | 279,285 | 279,285 | class MetadataValidator(Validator):
"""
Validator that checks for missing metadata
"""
requires_dataset_metadata = True
@classmethod
def from_element(cls, param, elem):
message = elem.get("message")
return cls(
message=message, check=elem.get("check", ""), skip=elem... | class MetadataValidator(Validator):
"""
Validator that checks for missing metadata
"""
requires_dataset_metadata = True
@classmethod
def from_element(cls, param, elem):
message = elem.get("message")
return cls(
message=message, check=elem.get("check", ""), skip=elem... | if value:
# TODO why this validator checks for isinstance(value, model.DatasetInstance)
missing = value.missing_meta(check=self.check, skip=self.skip)
super().validate(isinstance(value, model.DatasetInstance) and not missing, value_to_show=missing)
| if value:
# TODO why this validator checks for isinstance(value, model.DatasetInstance)
missing = value.missing_meta(check=self.check, skip=self.skip)
super().validate(isinstance(value, model.DatasetInstance) and not missing, value_to_show=missing)
| 21 | 345 | 87 | 432 | """
Classes related to parameter validation.
"""
import abc
import json
import logging
import os.path
import regex
from galaxy import (
model,
util,
)
log = logging.getLogger(__name__)
class Validator(abc.ABC):
"""
A validator checks that a value meets some conditions OR raises ValueError
"""
... | """
Classes related to parameter validation.
"""
import abc
import json
import logging
import os.path
import regex
from galaxy import (
model,
util,
)
log = logging.getLogger(__name__)
class Validator(abc.ABC):
"""
A validator checks that a value meets some conditions OR raises ValueError
"""
... |
46,344 | /home/hieuvd/dung_repo/raw/stars_03/galaxyproject_galaxy/galaxy | /home/hieuvd/dung_repo/raw/stars_03/galaxyproject_galaxy/galaxy/lib/galaxy/tools/parameters/validation.py | 351,353 | 346,363 | from_element | NoOptionsValidator | 353,359 | 353,359 | class NoOptionsValidator(Validator):
"""
Validator that checks for empty select list
"""
@classmethod
def from_element(cls, param, elem):
FILL_FUNC_BODY def validate(self, value, trans=None):
super().validate(value is not None)
| class NoOptionsValidator(Validator):
"""
Validator that checks for empty select list
"""
@classmethod
def from_element(cls, param, elem):
FILL_FUNC_BODY def validate(self, value, trans=None):
super().validate(value is not None)
| message = elem.get("message")
negate = elem.get("negate", "false")
if not message:
message = f"{'No options' if negate == 'false' else 'Options'} available for selection"
return cls(message, negate)
| message = elem.get("message")
negate = elem.get("negate", "false")
if not message:
message = f"{'No options' if negate == 'false' else 'Options'} available for selection"
return cls(message, negate)
| 26 | 79 | 74 | 153 | """
Classes related to parameter validation.
"""
import abc
import json
import logging
import os.path
import regex
from galaxy import (
model,
util,
)
log = logging.getLogger(__name__)
class Validator(abc.ABC):
"""
A validator checks that a value meets some conditions OR raises ValueError
"""
... | """
Classes related to parameter validation.
"""
import abc
import json
import logging
import os.path
import regex
from galaxy import (
model,
util,
)
log = logging.getLogger(__name__)
class Validator(abc.ABC):
"""
A validator checks that a value meets some conditions OR raises ValueError
"""
... |
46,345 | /home/hieuvd/dung_repo/raw/stars_03/galaxyproject_galaxy/galaxy | /home/hieuvd/dung_repo/raw/stars_03/galaxyproject_galaxy/galaxy/lib/galaxy/tools/parameters/validation.py | 99,100 | 82,107 | validate | RegexValidator | 100,107 | 100,107 | class RegexValidator(Validator):
"""
Validator that evaluates a regular expression
"""
@classmethod
def from_element(cls, param, elem):
return cls(elem.get("message"), elem.text, elem.get("negate", "false"))
def __init__(self, message, expression, negate):
if message is None:
... | class RegexValidator(Validator):
"""
Validator that evaluates a regular expression
"""
@classmethod
def from_element(cls, param, elem):
return cls(elem.get("message"), elem.text, elem.get("negate", "false"))
def __init__(self, message, expression, negate):
if message is None:
... | if not isinstance(value, list):
value = [value]
for val in value:
match = regex.match(self.expression, val or "")
super().validate(match is not None, value_to_show=val)
| if not isinstance(value, list):
value = [value]
for val in value:
match = regex.match(self.expression, val or "")
super().validate(match is not None, value_to_show=val)
| 22 | 202 | 69 | 271 | """
Classes related to parameter validation.
"""
import abc
import json
import logging
import os.path
import regex
from galaxy import (
model,
util,
)
log = logging.getLogger(__name__)
class Validator(abc.ABC):
"""
A validator checks that a value meets some conditions OR raises ValueError
"""
... | """
Classes related to parameter validation.
"""
import abc
import json
import logging
import os.path
import regex
from galaxy import (
model,
util,
)
log = logging.getLogger(__name__)
class Validator(abc.ABC):
"""
A validator checks that a value meets some conditions OR raises ValueError
"""
... |
46,346 | /home/hieuvd/dung_repo/raw/stars_03/galaxyproject_galaxy/galaxy | /home/hieuvd/dung_repo/raw/stars_03/galaxyproject_galaxy/galaxy/lib/galaxy/tools/parameters/validation.py | 328,330 | 321,346 | from_element | UnspecifiedBuildValidator | 330,336 | 330,336 | class UnspecifiedBuildValidator(Validator):
"""
Validator that checks for dbkey not equal to '?'
"""
requires_dataset_metadata = True
@classmethod
def from_element(cls, param, elem):
FILL_FUNC_BODY def validate(self, value, trans=None):
# if value is None, we cannot validate
... | class UnspecifiedBuildValidator(Validator):
"""
Validator that checks for dbkey not equal to '?'
"""
requires_dataset_metadata = True
@classmethod
def from_element(cls, param, elem):
FILL_FUNC_BODY def validate(self, value, trans=None):
# if value is None, we cannot validate
... | message = elem.get("message")
negate = elem.get("negate", "false")
if not message:
message = f"{'Unspecified' if negate == 'false' else 'Specified'} genome build, click the pencil icon in the history item to {'set' if negate == 'false' else 'remove'} the genome build"
return ... | message = elem.get("message")
negate = elem.get("negate", "false")
if not message:
message = f"{'Unspecified' if negate == 'false' else 'Specified'} genome build, click the pencil icon in the history item to {'set' if negate == 'false' else 'remove'} the genome build"
return ... | 43 | 157 | 104 | 261 | """
Classes related to parameter validation.
"""
import abc
import json
import logging
import os.path
import regex
from galaxy import (
model,
util,
)
log = logging.getLogger(__name__)
class Validator(abc.ABC):
"""
A validator checks that a value meets some conditions OR raises ValueError
"""
... | """
Classes related to parameter validation.
"""
import abc
import json
import logging
import os.path
import regex
from galaxy import (
model,
util,
)
log = logging.getLogger(__name__)
class Validator(abc.ABC):
"""
A validator checks that a value meets some conditions OR raises ValueError
"""
... |
46,347 | /home/hieuvd/dung_repo/raw/stars_03/galaxyproject_galaxy/galaxy | /home/hieuvd/dung_repo/raw/stars_03/galaxyproject_galaxy/galaxy/lib/galaxy/tools/parameters/validation.py | 52,54 | 20,82 | validate | Validator | 71,82 | 54,82 | class Validator(abc.ABC):
"""
A validator checks that a value meets some conditions OR raises ValueError
"""
requires_dataset_metadata = False
@classmethod
def from_element(cls, param, elem):
"""
Initialize the appropriate Validator class
example call `validation.Valid... | class Validator(abc.ABC):
"""
A validator checks that a value meets some conditions OR raises ValueError
"""
requires_dataset_metadata = False
@classmethod
def from_element(cls, param, elem):
"""
Initialize the appropriate Validator class
example call `validation.Valid... | assert isinstance(value, bool), "value must be boolean"
if message is None:
message = self.message
if value_to_show and "%s" in message:
message = message % value_to_show
if (not self.negate and value) or (self.negate and not value):
return
els... | """
validate a value
needs to be implemented in classes derived from validator.
the implementation needs to call `super().validate()`
giving result as a bool (which should be true if the
validation is positive and false otherwise) and the value
that is validated.... | 39 | 490 | 106 | 596 | """
Classes related to parameter validation.
"""
import abc
import json
import logging
import os.path
import regex
from galaxy import (
model,
util,
)
log = logging.getLogger(__name__)
class Validator(abc.ABC):
"""
A validator checks that a value meets some conditions OR raises ValueError
"""
... | """
Classes related to parameter validation.
"""
import abc
import json
import logging
import os.path
import regex
from galaxy import (
model,
util,
)
log = logging.getLogger(__name__)
class Validator(abc.ABC):
"""
A validator checks that a value meets some conditions OR raises ValueError
"""
... |
46,348 | /home/hieuvd/dung_repo/raw/stars_03/galaxyproject_galaxy/galaxy | /home/hieuvd/dung_repo/raw/stars_03/galaxyproject_galaxy/galaxy/lib/galaxy/tools/parameters/validation.py | 479,480 | 441,491 | validate | ValueInDataTableColumnValidator | 480,491 | 480,491 | class ValueInDataTableColumnValidator(Validator):
"""
Validator that checks if a value is in a tool data table column.
note: this is covered in a framework test (validation_value_in_datatable)
"""
@classmethod
def from_element(cls, param, elem):
table_name = elem.get("table_name")
... | class ValueInDataTableColumnValidator(Validator):
"""
Validator that checks if a value is in a tool data table column.
note: this is covered in a framework test (validation_value_in_datatable)
"""
@classmethod
def from_element(cls, param, elem):
table_name = elem.get("table_name")
... | if not value:
return
if not self._tool_data_table.is_current_version(self._data_table_content_version):
log.debug(
"ValueInDataTableColumnValidator: values are out of sync with data table (%s), updating validator.",
self._tool_data_table.name,
... | if not value:
return
if not self._tool_data_table.is_current_version(self._data_table_content_version):
log.debug(
"ValueInDataTableColumnValidator: values are out of sync with data table (%s), updating validator.",
self._tool_data_table.name,
... | 26 | 464 | 119 | 583 | """
Classes related to parameter validation.
"""
import abc
import json
import logging
import os.path
import regex
from galaxy import (
model,
util,
)
log = logging.getLogger(__name__)
class Validator(abc.ABC):
"""
A validator checks that a value meets some conditions OR raises ValueError
"""
... | """
Classes related to parameter validation.
"""
import abc
import json
import logging
import os.path
import regex
from galaxy import (
model,
util,
)
log = logging.getLogger(__name__)
class Validator(abc.ABC):
"""
A validator checks that a value meets some conditions OR raises ValueError
"""
... |
46,349 | /home/hieuvd/dung_repo/raw/stars_03/galaxyproject_galaxy/galaxy | /home/hieuvd/dung_repo/raw/stars_03/galaxyproject_galaxy/galaxy/lib/galaxy/tools/parameters/validation.py | 502,503 | 491,511 | validate | ValueNotInDataTableColumnValidator | 503,511 | 503,511 | class ValueNotInDataTableColumnValidator(ValueInDataTableColumnValidator):
"""
Validator that checks if a value is NOT in a tool data table column.
Equivalent to ValueInDataTableColumnValidator with `negate="true"`.
note: this is covered in a framework test (validation_value_in_datatable)
"""
... | class ValueNotInDataTableColumnValidator(ValueInDataTableColumnValidator):
"""
Validator that checks if a value is NOT in a tool data table column.
Equivalent to ValueInDataTableColumnValidator with `negate="true"`.
note: this is covered in a framework test (validation_value_in_datatable)
"""
... | try:
super().validate(value)
except ValueError:
return
else:
raise ValueError(self.message)
| try:
super().validate(value)
except ValueError:
return
else:
raise ValueError(self.message)
| 8 | 163 | 45 | 208 | """
Classes related to parameter validation.
"""
import abc
import json
import logging
import os.path
import regex
from galaxy import (
model,
util,
)
log = logging.getLogger(__name__)
class Validator(abc.ABC):
"""
A validator checks that a value meets some conditions OR raises ValueError
"""
... | """
Classes related to parameter validation.
"""
import abc
import json
import logging
import os.path
import regex
from galaxy import (
model,
util,
)
log = logging.getLogger(__name__)
class Validator(abc.ABC):
"""
A validator checks that a value meets some conditions OR raises ValueError
"""
... |
46,350 | /home/hieuvd/dung_repo/raw/stars_03/galaxyproject_galaxy/galaxy | /home/hieuvd/dung_repo/raw/stars_03/galaxyproject_galaxy/galaxy/lib/galaxy/tools/parameters/workflow_utils.py | 10,11 | 1,44 | runtime_to_json | 11,19 | 11,19 | from collections.abc import MutableMapping
class workflow_building_modes:
DISABLED = False
ENABLED = True
USE_HISTORY = 1
def runtime_to_json(runtime_value):
FILL_FUNC_BODYdef runtime_to_object(runtime_value):
if isinstance(runtime_value, ConnectedValue) or (
isinstance(runtime_value, Mutabl... | from collections.abc import MutableMapping
class workflow_building_modes:
DISABLED = False
ENABLED = True
USE_HISTORY = 1
def runtime_to_json(runtime_value):
FILL_FUNC_BODYdef runtime_to_object(runtime_value):
if isinstance(runtime_value, ConnectedValue) or (
isinstance(runtime_value, Mutabl... | if isinstance(runtime_value, ConnectedValue) or (
isinstance(runtime_value, MutableMapping) and runtime_value["__class__"] == "ConnectedValue"
):
return {"__class__": "ConnectedValue"}
else:
return {"__class__": "RuntimeValue"}
| if isinstance(runtime_value, ConnectedValue) or (
isinstance(runtime_value, MutableMapping) and runtime_value["__class__"] == "ConnectedValue"
):
return {"__class__": "ConnectedValue"}
else:
return {"__class__": "RuntimeValue"}
| 19 | 278 | 87 | 365 | from collections.abc import MutableMapping
class workflow_building_modes:
DISABLED = False
ENABLED = True
USE_HISTORY = 1
def runtime_to_json(runtime_value):
FILL_FUNC_BODYdef runtime_to_object(runtime_value):
if isinstance(runtime_value, ConnectedValue) or (
isinstance(runtime_value, Mutabl... | from collections.abc import MutableMapping
class workflow_building_modes:
DISABLED = False
ENABLED = True
USE_HISTORY = 1
def runtime_to_json(runtime_value):
FILL_FUNC_BODYdef runtime_to_object(runtime_value):
if isinstance(runtime_value, ConnectedValue) or (
isinstance(runtime_value, Mutabl... | |
46,352 | /home/hieuvd/dung_repo/raw/stars_03/galaxyproject_galaxy/galaxy | /home/hieuvd/dung_repo/raw/stars_03/galaxyproject_galaxy/galaxy/lib/galaxy/tools/parameters/wrapped.py | 40,41 | 30,54 | set_legacy_alias | LegacyUnprefixedDict | 41,43 | 41,43 | class LegacyUnprefixedDict(UserDict):
"""Track and provide access to prefixed and unprefixed tool parameter values."""
# It used to be valid to access members of conditionals without specifying the conditional.
# This dict provides a fallback when dict lookup fails using those old rules
def __init__(s... | class LegacyUnprefixedDict(UserDict):
"""Track and provide access to prefixed and unprefixed tool parameter values."""
# It used to be valid to access members of conditionals without specifying the conditional.
# This dict provides a fallback when dict lookup fails using those old rules
def __init__(s... | self._legacy_mapping[old_key] = new_key
| self._legacy_mapping[old_key] = new_key
| 3 | 254 | 20 | 274 | from collections import UserDict
from typing import (
Any,
Dict,
List,
)
from galaxy.tools.parameters.basic import (
DataCollectionToolParameter,
DataToolParameter,
SelectToolParameter,
)
from galaxy.tools.parameters.grouping import (
Conditional,
Repeat,
Section,
)
from galaxy.tool... | from collections import UserDict
from typing import (
Any,
Dict,
List,
)
from galaxy.tools.parameters.basic import (
DataCollectionToolParameter,
DataToolParameter,
SelectToolParameter,
)
from galaxy.tools.parameters.grouping import (
Conditional,
Repeat,
Section,
)
from galaxy.tool... |
46,353 | /home/hieuvd/dung_repo/raw/stars_03/galaxyproject_galaxy/galaxy | /home/hieuvd/dung_repo/raw/stars_03/galaxyproject_galaxy/galaxy/lib/galaxy/tools/parameters/wrapped.py | 78,79 | 62,135 | wrap_values | WrappedParameters | 79,135 | 79,135 | class WrappedParameters:
def __init__(self, trans, tool, incoming, input_datasets=None):
self.trans = trans
self.tool = tool
self.incoming = incoming
self._params = PARAMS_UNWRAPPED
self._input_datasets = input_datasets
@property
def params(self):
if self._pa... | class WrappedParameters:
def __init__(self, trans, tool, incoming, input_datasets=None):
self.trans = trans
self.tool = tool
self.incoming = incoming
self._params = PARAMS_UNWRAPPED
self._input_datasets = input_datasets
@property
def params(self):
if self._pa... | trans = self.trans
tool = self.tool
incoming = self.incoming
element_identifier_mapper = ElementIdentifierMapper(self._input_datasets)
# Wrap tool inputs as necessary
for input in inputs.values():
if input.name not in input_values and skip_missing_values:
... | trans = self.trans
tool = self.tool
incoming = self.incoming
element_identifier_mapper = ElementIdentifierMapper(self._input_datasets)
# Wrap tool inputs as necessary
for input in inputs.values():
if input.name not in input_values and skip_missing_values:
... | 137 | 203 | 722 | 925 | from collections import UserDict
from typing import (
Any,
Dict,
List,
)
from galaxy.tools.parameters.basic import (
DataCollectionToolParameter,
DataToolParameter,
SelectToolParameter,
)
from galaxy.tools.parameters.grouping import (
Conditional,
Repeat,
Section,
)
from galaxy.tool... | from collections import UserDict
from typing import (
Any,
Dict,
List,
)
from galaxy.tools.parameters.basic import (
DataCollectionToolParameter,
DataToolParameter,
SelectToolParameter,
)
from galaxy.tools.parameters.grouping import (
Conditional,
Repeat,
Section,
)
from galaxy.tool... |
46,355 | /home/hieuvd/dung_repo/raw/stars_03/galaxyproject_galaxy/galaxy | /home/hieuvd/dung_repo/raw/stars_03/galaxyproject_galaxy/galaxy/lib/galaxy/tools/remote_tool_eval.py | 75,76 | 1,140 | main | 76,121 | 76,121 | import json
import os
import shutil
import tempfile
import traceback
from typing import (
Callable,
NamedTuple,
)
from galaxy.datatypes.registry import Registry
from galaxy.files import ConfiguredFileSources
from galaxy.job_execution.compute_environment import SharedComputeEnvironment
from galaxy.job_execution... | import json
import os
import shutil
import tempfile
import traceback
from typing import (
Callable,
NamedTuple,
)
from galaxy.datatypes.registry import Registry
from galaxy.files import ConfiguredFileSources
from galaxy.job_execution.compute_environment import SharedComputeEnvironment
from galaxy.job_execution... | metadata_params = get_metadata_params(WORKING_DIRECTORY)
datatypes_config = metadata_params["datatypes_config"]
if not os.path.exists(datatypes_config):
datatypes_config = os.path.join(WORKING_DIRECTORY, "configs", datatypes_config)
datatypes_registry = validate_and_load_datatypes_config(datatyp... | metadata_params = get_metadata_params(WORKING_DIRECTORY)
datatypes_config = metadata_params["datatypes_config"]
if not os.path.exists(datatypes_config):
datatypes_config = os.path.join(WORKING_DIRECTORY, "configs", datatypes_config)
datatypes_registry = validate_and_load_datatypes_config(datatyp... | 126 | 1,030 | 840 | 1,870 | import json
import os
import shutil
import tempfile
import traceback
from typing import (
Callable,
NamedTuple,
)
from galaxy.datatypes.registry import Registry
from galaxy.files import ConfiguredFileSources
from galaxy.job_execution.compute_environment import SharedComputeEnvironment
from galaxy.job_execution... | import json
import os
import shutil
import tempfile
import traceback
from typing import (
Callable,
NamedTuple,
)
from galaxy.datatypes.registry import Registry
from galaxy.files import ConfiguredFileSources
from galaxy.job_execution.compute_environment import SharedComputeEnvironment
from galaxy.job_execution... | |
46,356 | /home/hieuvd/dung_repo/raw/stars_03/galaxyproject_galaxy/galaxy | /home/hieuvd/dung_repo/raw/stars_03/galaxyproject_galaxy/galaxy/lib/galaxy/tools/repositories.py | 71,74 | 24,95 | from_app | ValidationContext | 74,95 | 74,95 | class ValidationContext:
"""Minimal App object for tool validation."""
is_webapp = True
config: ValidationContextConfig
def __init__(
self,
app_name: str,
model,
security,
tool_data_path,
shed_tool_data_path,
tool_data_tables=None,
regist... | class ValidationContext:
"""Minimal App object for tool validation."""
is_webapp = True
config: ValidationContextConfig
def __init__(
self,
app_name: str,
model,
security,
tool_data_path,
shed_tool_data_path,
tool_data_tables=None,
regist... | cleanup = False
if not work_dir:
work_dir = tempfile.mkdtemp()
cleanup = True
tool_data_tables = ToolDataTableManager(work_dir)
try:
with ValidationContext(
app_name=app.name,
security=app.security,
model... | cleanup = False
if not work_dir:
work_dir = tempfile.mkdtemp()
cleanup = True
tool_data_tables = ToolDataTableManager(work_dir)
try:
with ValidationContext(
app_name=app.name,
security=app.security,
model... | 45 | 626 | 263 | 889 | """Provides a subset of app for verifying tools."""
import os
import shutil
import tempfile
from contextlib import contextmanager
from typing import Optional
from galaxy.managers.dbkeys import GenomeBuilds
from galaxy.tools.data import ToolDataTableManager
from galaxy.util.bunch import Bunch
class ValidationContext... | """Provides a subset of app for verifying tools."""
import os
import shutil
import tempfile
from contextlib import contextmanager
from typing import Optional
from galaxy.managers.dbkeys import GenomeBuilds
from galaxy.tools.data import ToolDataTableManager
from galaxy.util.bunch import Bunch
class ValidationContext... |
46,357 | /home/hieuvd/dung_repo/raw/stars_03/galaxyproject_galaxy/galaxy | /home/hieuvd/dung_repo/raw/stars_03/galaxyproject_galaxy/galaxy/lib/galaxy/tools/special_tools.py | 14,15 | 1,18 | load_lib_tools | 15,18 | 15,18 | import logging
import os
log = logging.getLogger(__name__)
SPECIAL_TOOLS = {
"history export": "imp_exp/exp_history_to_archive.xml",
"history export to uri": "imp_exp/exp_history_to_uri.xml",
"history import": "imp_exp/imp_history_from_archive.xml",
"data fetch": "data_fetch.xml",
}
def load_lib_too... | import logging
import os
log = logging.getLogger(__name__)
SPECIAL_TOOLS = {
"history export": "imp_exp/exp_history_to_archive.xml",
"history export to uri": "imp_exp/exp_history_to_uri.xml",
"history import": "imp_exp/imp_history_from_archive.xml",
"data fetch": "data_fetch.xml",
}
def load_lib_too... | for name, path in SPECIAL_TOOLS.items():
tool = toolbox.load_hidden_lib_tool(os.path.abspath(os.path.join(os.path.dirname(__file__), path)))
log.debug("Loaded %s tool: %s", name, tool.id)
| for name, path in SPECIAL_TOOLS.items():
tool = toolbox.load_hidden_lib_tool(os.path.abspath(os.path.join(os.path.dirname(__file__), path)))
log.debug("Loaded %s tool: %s", name, tool.id)
| 15 | 132 | 83 | 215 | import logging
import os
log = logging.getLogger(__name__)
SPECIAL_TOOLS = {
"history export": "imp_exp/exp_history_to_archive.xml",
"history export to uri": "imp_exp/exp_history_to_uri.xml",
"history import": "imp_exp/imp_history_from_archive.xml",
"data fetch": "data_fetch.xml",
}
def load_lib_too... | import logging
import os
log = logging.getLogger(__name__)
SPECIAL_TOOLS = {
"history export": "imp_exp/exp_history_to_archive.xml",
"history export to uri": "imp_exp/exp_history_to_uri.xml",
"history import": "imp_exp/imp_history_from_archive.xml",
"data fetch": "data_fetch.xml",
}
def load_lib_too... | |
46,358 | /home/hieuvd/dung_repo/raw/stars_03/galaxyproject_galaxy/galaxy | /home/hieuvd/dung_repo/raw/stars_03/galaxyproject_galaxy/galaxy/lib/galaxy/tours/_impl.py | 36,37 | 1,163 | load_tour_steps | 37,64 | 37,64 | """
This module manages loading/etc of Galaxy interactive tours.
"""
import logging
import os
from typing import (
List,
Union,
)
import yaml
from pydantic import parse_obj_as
from galaxy.exceptions import ObjectNotFound
from galaxy.navigation.data import load_root_component
from galaxy.util import config_di... | """
This module manages loading/etc of Galaxy interactive tours.
"""
import logging
import os
from typing import (
List,
Union,
)
import yaml
from pydantic import parse_obj_as
from galaxy.exceptions import ObjectNotFound
from galaxy.navigation.data import load_root_component
from galaxy.util import config_di... | warn = warn or noop_warn
# Some of this can be done on the clientside. Maybe even should?
title_default = contents_dict.get("title_default")
if "requirements" not in contents_dict:
contents_dict["requirements"] = []
for step in contents_dict["steps"]:
# Remove attributes no longer... | warn = warn or noop_warn
# Some of this can be done on the clientside. Maybe even should?
title_default = contents_dict.get("title_default")
if "requirements" not in contents_dict:
contents_dict["requirements"] = []
for step in contents_dict["steps"]:
# Remove attributes no longer... | 105 | 1,409 | 309 | 1,718 | """
This module manages loading/etc of Galaxy interactive tours.
"""
import logging
import os
from typing import (
List,
Union,
)
import yaml
from pydantic import parse_obj_as
from galaxy.exceptions import ObjectNotFound
from galaxy.navigation.data import load_root_component
from galaxy.util import config_di... | """
This module manages loading/etc of Galaxy interactive tours.
"""
import logging
import os
from typing import (
List,
Union,
)
import yaml
from pydantic import parse_obj_as
from galaxy.exceptions import ObjectNotFound
from galaxy.navigation.data import load_root_component
from galaxy.util import config_di... | |
46,359 | /home/hieuvd/dung_repo/raw/stars_03/galaxyproject_galaxy/galaxy | /home/hieuvd/dung_repo/raw/stars_03/galaxyproject_galaxy/galaxy/lib/galaxy/tours/_impl.py | 141,142 | 94,163 | _load_tour_from_path | ToursRegistryImpl | 142,157 | 142,157 | @ToursRegistry.register
class ToursRegistryImpl:
def __init__(self, tour_directories):
self.tour_directories = config_directories_from_setting(tour_directories)
self._load_tours()
def get_tours(self):
"""Return list of tours."""
tours = []
for k in self.tours.keys():
... | @ToursRegistry.register
class ToursRegistryImpl:
def __init__(self, tour_directories):
self.tour_directories = config_directories_from_setting(tour_directories)
self._load_tours()
def get_tours(self):
"""Return list of tours."""
tours = []
for k in self.tours.keys():
... | tour_id = get_tour_id_from_path(tour_path)
try:
tour = load_tour_from_path(tour_path)
except OSError:
log.exception(f"Tour '{tour_id}' could not be loaded, error reading file.")
except yaml.error.YAMLError:
log.exception(f"Tour '{tour_id}' could not be... | tour_id = get_tour_id_from_path(tour_path)
try:
tour = load_tour_from_path(tour_path)
except OSError:
log.exception(f"Tour '{tour_id}' could not be loaded, error reading file.")
except yaml.error.YAMLError:
log.exception(f"Tour '{tour_id}' could not be... | 62 | 651 | 228 | 879 | """
This module manages loading/etc of Galaxy interactive tours.
"""
import logging
import os
from typing import (
List,
Union,
)
import yaml
from pydantic import parse_obj_as
from galaxy.exceptions import ObjectNotFound
from galaxy.navigation.data import load_root_component
from galaxy.util import config_di... | """
This module manages loading/etc of Galaxy interactive tours.
"""
import logging
import os
from typing import (
List,
Union,
)
import yaml
from pydantic import parse_obj_as
from galaxy.exceptions import ObjectNotFound
from galaxy.navigation.data import load_root_component
from galaxy.util import config_di... |
46,360 | /home/hieuvd/dung_repo/raw/stars_03/galaxyproject_galaxy/galaxy | /home/hieuvd/dung_repo/raw/stars_03/galaxyproject_galaxy/galaxy/lib/galaxy/tours/validate.py | 67,68 | 1,81 | _arg_parser | 68,79 | 68,79 | import argparse
import sys
import yaml
from pydantic import ValidationError
from galaxy.navigation.data import load_root_component
from ._impl import (
get_tour_id_from_path,
load_tour_from_path,
tour_paths,
)
from ._schema import TourDetails
DESCRIPTION = "Perform static validation of a tour."
def mai... | import argparse
import sys
import yaml
from pydantic import ValidationError
from galaxy.navigation.data import load_root_component
from ._impl import (
get_tour_id_from_path,
load_tour_from_path,
tour_paths,
)
from ._schema import TourDetails
DESCRIPTION = "Perform static validation of a tour."
def mai... | parser = argparse.ArgumentParser(description=DESCRIPTION)
parser.add_argument(
"target",
metavar="TARGET",
nargs="?",
help="tour or directories of tours to validate",
default="config/plugins/tours",
)
return parser
| parser = argparse.ArgumentParser(description=DESCRIPTION)
parser.add_argument(
"target",
metavar="TARGET",
nargs="?",
help="tour or directories of tours to validate",
default="config/plugins/tours",
)
return parser
| 18 | 653 | 93 | 746 | import argparse
import sys
import yaml
from pydantic import ValidationError
from galaxy.navigation.data import load_root_component
from ._impl import (
get_tour_id_from_path,
load_tour_from_path,
tour_paths,
)
from ._schema import TourDetails
DESCRIPTION = "Perform static validation of a tour."
def mai... | import argparse
import sys
import yaml
from pydantic import ValidationError
from galaxy.navigation.data import load_root_component
from ._impl import (
get_tour_id_from_path,
load_tour_from_path,
tour_paths,
)
from ._schema import TourDetails
DESCRIPTION = "Perform static validation of a tour."
def mai... | |
46,361 | /home/hieuvd/dung_repo/raw/stars_03/galaxyproject_galaxy/galaxy | /home/hieuvd/dung_repo/raw/stars_03/galaxyproject_galaxy/galaxy/lib/galaxy/util/aliaspickler.py | 28,29 | 15,31 | loads | AliasPickleModule | 29,31 | 29,31 | class AliasPickleModule:
def __init__(self, aliases):
self.aliases = aliases
def dump(self, obj, fileobj, protocol=0):
return pickle.dump(obj, fileobj, protocol)
def dumps(self, obj, protocol=0):
return pickle.dumps(obj, protocol)
def load(self, fileobj):
return AliasU... | class AliasPickleModule:
def __init__(self, aliases):
self.aliases = aliases
def dump(self, obj, fileobj, protocol=0):
return pickle.dump(obj, fileobj, protocol)
def dumps(self, obj, protocol=0):
return pickle.dumps(obj, protocol)
def load(self, fileobj):
return AliasU... | fileobj = StringIO(string)
return AliasUnpickler(self.aliases, fileobj).load()
| fileobj = StringIO(string)
return AliasUnpickler(self.aliases, fileobj).load()
| 6 | 140 | 32 | 172 | import pickle
from io import StringIO
class AliasUnpickler(pickle.Unpickler):
def __init__(self, aliases, *args, **kw):
pickle.Unpickler.__init__(self, *args, **kw)
self.aliases = aliases
def find_class(self, module, name):
module, name = self.aliases.get((module, name), (module, name... | import pickle
from io import StringIO
class AliasUnpickler(pickle.Unpickler):
def __init__(self, aliases, *args, **kw):
pickle.Unpickler.__init__(self, *args, **kw)
self.aliases = aliases
def find_class(self, module, name):
module, name = self.aliases.get((module, name), (module, name... |
46,362 | /home/hieuvd/dung_repo/raw/stars_03/galaxyproject_galaxy/galaxy | /home/hieuvd/dung_repo/raw/stars_03/galaxyproject_galaxy/galaxy/lib/galaxy/util/aliaspickler.py | 10,11 | 5,15 | find_class | AliasUnpickler | 11,15 | 11,15 | class AliasUnpickler(pickle.Unpickler):
def __init__(self, aliases, *args, **kw):
pickle.Unpickler.__init__(self, *args, **kw)
self.aliases = aliases
def find_class(self, module, name):
FILL_FUNC_BODY | class AliasUnpickler(pickle.Unpickler):
def __init__(self, aliases, *args, **kw):
pickle.Unpickler.__init__(self, *args, **kw)
self.aliases = aliases
def find_class(self, module, name):
FILL_FUNC_BODY | module, name = self.aliases.get((module, name), (module, name))
return pickle.Unpickler.find_class(self, module, name)
| module, name = self.aliases.get((module, name), (module, name))
return pickle.Unpickler.find_class(self, module, name)
| 11 | 88 | 49 | 137 | import pickle
from io import StringIO
class AliasUnpickler(pickle.Unpickler):
def __init__(self, aliases, *args, **kw):
pickle.Unpickler.__init__(self, *args, **kw)
self.aliases = aliases
def find_class(self, module, name):
FILL_FUNC_BODYclass AliasPickleModule:
def __init__(self, aliases... | import pickle
from io import StringIO
class AliasUnpickler(pickle.Unpickler):
def __init__(self, aliases, *args, **kw):
pickle.Unpickler.__init__(self, *args, **kw)
self.aliases = aliases
def find_class(self, module, name):
FILL_FUNC_BODYclass AliasPickleModule:
def __init__(self, aliases... |
46,363 | /home/hieuvd/dung_repo/raw/stars_03/galaxyproject_galaxy/galaxy | /home/hieuvd/dung_repo/raw/stars_03/galaxyproject_galaxy/galaxy/lib/galaxy/util/bunch.py | 24,25 | 4,46 | items | Bunch | 25,27 | 25,27 | class Bunch(HasDynamicProperties):
"""
http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/52308
Often we want to just collect a bunch of stuff together, naming each item of
the bunch; a dictionary's OK for that, but a small do-nothing class is even handier, and prettier to use.
"""
def __... | class Bunch(HasDynamicProperties):
"""
http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/52308
Often we want to just collect a bunch of stuff together, naming each item of
the bunch; a dictionary's OK for that, but a small do-nothing class is even handier, and prettier to use.
"""
def __... | return self.__dict__.items()
| return self.__dict__.items()
| 2 | 332 | 13 | 345 | from .dynamic import HasDynamicProperties
class Bunch(HasDynamicProperties):
"""
http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/52308
Often we want to just collect a bunch of stuff together, naming each item of
the bunch; a dictionary's OK for that, but a small do-nothing class is even handi... | from .dynamic import HasDynamicProperties
class Bunch(HasDynamicProperties):
"""
http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/52308
Often we want to just collect a bunch of stuff together, naming each item of
the bunch; a dictionary's OK for that, but a small do-nothing class is even handi... |
46,364 | /home/hieuvd/dung_repo/raw/stars_03/galaxyproject_galaxy/galaxy | /home/hieuvd/dung_repo/raw/stars_03/galaxyproject_galaxy/galaxy/lib/galaxy/util/bytesize.py | 47,48 | 1,69 | parse_bytesize | 48,69 | 48,69 | SUFFIX_TO_BYTES = {
"KI": 1024,
"MI": 1024**2,
"GI": 1024**3,
"TI": 1024**4,
"PI": 1024**5,
"EI": 1024**6,
"K": 1000,
"M": 1000**2,
"G": 1000**3,
"T": 1000**4,
"P": 1000**5,
"E": 1000**6,
}
class ByteSize:
"""Convert multiples of bytes to various units."""
def ... | SUFFIX_TO_BYTES = {
"KI": 1024,
"MI": 1024**2,
"GI": 1024**3,
"TI": 1024**4,
"PI": 1024**5,
"EI": 1024**6,
"K": 1000,
"M": 1000**2,
"G": 1000**3,
"T": 1000**4,
"P": 1000**5,
"E": 1000**6,
}
class ByteSize:
"""Convert multiples of bytes to various units."""
def ... | if isinstance(value, int) or isinstance(value, float):
# Assume bytes
return value
value = value.upper()
found_suffix = None
for suffix in SUFFIX_TO_BYTES:
if value.endswith(suffix):
found_suffix = suffix
break
if found_suffix:
value = value[: ... | if isinstance(value, int) or isinstance(value, float):
# Assume bytes
return value
value = value.upper()
found_suffix = None
for suffix in SUFFIX_TO_BYTES:
if value.endswith(suffix):
found_suffix = suffix
break
if found_suffix:
value = value[: ... | 64 | 527 | 213 | 740 | SUFFIX_TO_BYTES = {
"KI": 1024,
"MI": 1024**2,
"GI": 1024**3,
"TI": 1024**4,
"PI": 1024**5,
"EI": 1024**6,
"K": 1000,
"M": 1000**2,
"G": 1000**3,
"T": 1000**4,
"P": 1000**5,
"E": 1000**6,
}
class ByteSize:
"""Convert multiples of bytes to various units."""
def ... | SUFFIX_TO_BYTES = {
"KI": 1024,
"MI": 1024**2,
"GI": 1024**3,
"TI": 1024**4,
"PI": 1024**5,
"EI": 1024**6,
"K": 1000,
"M": 1000**2,
"G": 1000**3,
"T": 1000**4,
"P": 1000**5,
"E": 1000**6,
}
class ByteSize:
"""Convert multiples of bytes to various units."""
def ... | |
46,365 | /home/hieuvd/dung_repo/raw/stars_03/galaxyproject_galaxy/galaxy | /home/hieuvd/dung_repo/raw/stars_03/galaxyproject_galaxy/galaxy/lib/galaxy/util/bytesize.py | 34,35 | 17,47 | to_unit | ByteSize | 36,47 | 35,47 | class ByteSize:
"""Convert multiples of bytes to various units."""
def __init__(self, value):
"""
Represents a quantity of bytes.
`value` may be an integer, in which case it is assumed to be bytes.
If value is a string, it is parsed as bytes if no suffix (Mi, M, Gi, G ...)
... | class ByteSize:
"""Convert multiples of bytes to various units."""
def __init__(self, value):
"""
Represents a quantity of bytes.
`value` may be an integer, in which case it is assumed to be bytes.
If value is a string, it is parsed as bytes if no suffix (Mi, M, Gi, G ...)
... | if unit is None:
if as_string:
return str(self.value)
return self.value
unit = unit.upper()
new_value = int(self.value / SUFFIX_TO_BYTES[unit])
if not as_string:
return new_value
return f"{new_value}{unit}"
| """unit must be `None` or one of Ki,Mi,Gi,Ti,Pi,Ei,K,M,G,T,P."""
if unit is None:
if as_string:
return str(self.value)
return self.value
unit = unit.upper()
new_value = int(self.value / SUFFIX_TO_BYTES[unit])
if not as_string:
r... | 25 | 258 | 100 | 358 | SUFFIX_TO_BYTES = {
"KI": 1024,
"MI": 1024**2,
"GI": 1024**3,
"TI": 1024**4,
"PI": 1024**5,
"EI": 1024**6,
"K": 1000,
"M": 1000**2,
"G": 1000**3,
"T": 1000**4,
"P": 1000**5,
"E": 1000**6,
}
class ByteSize:
"""Convert multiples of bytes to various units."""
def ... | SUFFIX_TO_BYTES = {
"KI": 1024,
"MI": 1024**2,
"GI": 1024**3,
"TI": 1024**4,
"PI": 1024**5,
"EI": 1024**6,
"K": 1000,
"M": 1000**2,
"G": 1000**3,
"T": 1000**4,
"P": 1000**5,
"E": 1000**6,
}
class ByteSize:
"""Convert multiples of bytes to various units."""
def ... |
46,367 | /home/hieuvd/dung_repo/raw/stars_03/galaxyproject_galaxy/galaxy | /home/hieuvd/dung_repo/raw/stars_03/galaxyproject_galaxy/galaxy/lib/galaxy/util/commands.py | 27,28 | 1,202 | redirecting_io | 29,41 | 28,41 | """Generic I/O and shell processing code used by Galaxy tool dependencies."""
import logging
import os
import shlex
import subprocess
import sys as _sys
import tempfile
from typing import (
Any,
Dict,
List,
Optional,
Union,
)
from galaxy.util import (
unicodify,
which,
)
log = logging.get... | """Generic I/O and shell processing code used by Galaxy tool dependencies."""
import logging
import os
import shlex
import subprocess
import sys as _sys
import tempfile
from typing import (
Any,
Dict,
List,
Optional,
Union,
)
from galaxy.util import (
unicodify,
which,
)
log = logging.get... | assert sys is not None
try:
# Need to explicitly call fileno() because sys.stdout could be a
# io.StringIO object, which has a fileno() method but only raises an
# io.UnsupportedOperation exception
sys.stdout.fileno()
except Exception:
return True
else:
re... | """Predicate to determine if we are redicting stdout in process."""
assert sys is not None
try:
# Need to explicitly call fileno() because sys.stdout could be a
# io.StringIO object, which has a fileno() method but only raises an
# io.UnsupportedOperation exception
sys.stdout... | 40 | 1,943 | 99 | 2,042 | """Generic I/O and shell processing code used by Galaxy tool dependencies."""
import logging
import os
import shlex
import subprocess
import sys as _sys
import tempfile
from typing import (
Any,
Dict,
List,
Optional,
Union,
)
from galaxy.util import (
unicodify,
which,
)
log = logging.get... | """Generic I/O and shell processing code used by Galaxy tool dependencies."""
import logging
import os
import shlex
import subprocess
import sys as _sys
import tempfile
from typing import (
Any,
Dict,
List,
Optional,
Union,
)
from galaxy.util import (
unicodify,
which,
)
log = logging.get... | |
46,370 | /home/hieuvd/dung_repo/raw/stars_03/galaxyproject_galaxy/galaxy | /home/hieuvd/dung_repo/raw/stars_03/galaxyproject_galaxy/galaxy/lib/galaxy/util/compression_utils.py | 366,367 | 359,374 | _open_to_write | FastZipFile | 367,374 | 367,374 | class FastZipFile(zipfile.ZipFile):
"""
Simple wrapper around ZipFile that uses the default compression strategy of ISA-L
to write zip files. Ignores compresslevel and compresstype arguments, and is
3 to 4 times faster than the zlib implementation at the default compression level.
"""
def _open... | class FastZipFile(zipfile.ZipFile):
"""
Simple wrapper around ZipFile that uses the default compression strategy of ISA-L
to write zip files. Ignores compresslevel and compresstype arguments, and is
3 to 4 times faster than the zlib implementation at the default compression level.
"""
def _open... | zwf = super()._open_to_write(*args, **kwargs) # type: ignore[misc]
if isal_zlib and self.compression == zipfile.ZIP_DEFLATED:
zwf._compressor = isal_zlib.compressobj(isal_zlib.ISAL_DEFAULT_COMPRESSION, isal_zlib.DEFLATED, -15, 9)
return zwf
# modified from shutil._make_zipfile
| zwf = super()._open_to_write(*args, **kwargs) # type: ignore[misc]
if isal_zlib and self.compression == zipfile.ZIP_DEFLATED:
zwf._compressor = isal_zlib.compressobj(isal_zlib.ISAL_DEFAULT_COMPRESSION, isal_zlib.DEFLATED, -15, 9)
return zwf
# modified from shutil._make_zipfile
| 25 | 121 | 131 | 252 | import bz2
import gzip
import io
import logging
import lzma
import os
import shutil
import tarfile
import tempfile
import zipfile
from typing import (
Any,
cast,
Generator,
IO,
Iterable,
List,
Optional,
overload,
Tuple,
Union,
)
from typing_extensions import Literal
from galaxy... | import bz2
import gzip
import io
import logging
import lzma
import os
import shutil
import tarfile
import tempfile
import zipfile
from typing import (
Any,
cast,
Generator,
IO,
Iterable,
List,
Optional,
overload,
Tuple,
Union,
)
from typing_extensions import Literal
from galaxy... |
46,371 | /home/hieuvd/dung_repo/raw/stars_03/galaxyproject_galaxy/galaxy | /home/hieuvd/dung_repo/raw/stars_03/galaxyproject_galaxy/galaxy/lib/galaxy/util/config_parsers.py | 14,15 | 1,24 | parse_allowlist_ips | 15,24 | 15,24 | import ipaddress
from typing import (
List,
Union,
)
from galaxy.util import unicodify
IpAddressT = Union[ipaddress.IPv4Address, ipaddress.IPv6Address]
IpNetworkT = Union[ipaddress.IPv4Network, ipaddress.IPv6Network]
IpAllowedListEntryT = Union[IpAddressT, IpNetworkT]
def parse_allowlist_ips(fetch_url_allow... | import ipaddress
from typing import (
List,
Union,
)
from galaxy.util import unicodify
IpAddressT = Union[ipaddress.IPv4Address, ipaddress.IPv6Address]
IpNetworkT = Union[ipaddress.IPv4Network, ipaddress.IPv6Network]
IpAllowedListEntryT = Union[IpAddressT, IpNetworkT]
def parse_allowlist_ips(fetch_url_allow... | return [
(
ipaddress.ip_network(unicodify(ip.strip())) # If it has a slash, assume 127.0.0.1/24 notation
if "/" in ip
else ipaddress.ip_address(unicodify(ip.strip()))
) # Otherwise interpret it as an ip address.
for ip in fetch_url_allowlist
if l... | return [
(
ipaddress.ip_network(unicodify(ip.strip())) # If it has a slash, assume 127.0.0.1/24 notation
if "/" in ip
else ipaddress.ip_address(unicodify(ip.strip()))
) # Otherwise interpret it as an ip address.
for ip in fetch_url_allowlist
if l... | 37 | 144 | 120 | 264 | import ipaddress
from typing import (
List,
Union,
)
from galaxy.util import unicodify
IpAddressT = Union[ipaddress.IPv4Address, ipaddress.IPv6Address]
IpNetworkT = Union[ipaddress.IPv4Network, ipaddress.IPv6Network]
IpAllowedListEntryT = Union[IpAddressT, IpNetworkT]
def parse_allowlist_ips(fetch_url_allow... | import ipaddress
from typing import (
List,
Union,
)
from galaxy.util import unicodify
IpAddressT = Union[ipaddress.IPv4Address, ipaddress.IPv6Address]
IpNetworkT = Union[ipaddress.IPv4Network, ipaddress.IPv6Network]
IpAllowedListEntryT = Union[IpAddressT, IpNetworkT]
def parse_allowlist_ips(fetch_url_allow... | |
46,372 | /home/hieuvd/dung_repo/raw/stars_03/galaxyproject_galaxy/galaxy | /home/hieuvd/dung_repo/raw/stars_03/galaxyproject_galaxy/galaxy/lib/galaxy/util/custom_logging/fluent_log.py | 38,39 | 18,45 | log | FluentTraceLogger | 39,45 | 39,45 | class FluentTraceLogger:
def __init__(self, name, host="localhost", port=24224):
assert FluentSender is not None, FLUENT_IMPORT_MESSAGE
self.lock = threading.Lock()
self.thread_local = threading.local()
self.name = name
self.sender = FluentSender(self.name, host=host, port=po... | class FluentTraceLogger:
def __init__(self, name, host="localhost", port=24224):
assert FluentSender is not None, FLUENT_IMPORT_MESSAGE
self.lock = threading.Lock()
self.thread_local = threading.local()
self.name = name
self.sender = FluentSender(self.name, host=host, port=po... | self.lock.acquire()
if hasattr(self.thread_local, "context"):
kwargs.update(self.thread_local.context)
self.lock.release()
event_time = event_time or time.time()
self.sender.emit_with_time(label, int(event_time), json.dumps(kwargs, default=str))
| self.lock.acquire()
if hasattr(self.thread_local, "context"):
kwargs.update(self.thread_local.context)
self.lock.release()
event_time = event_time or time.time()
self.sender.emit_with_time(label, int(event_time), json.dumps(kwargs, default=str))
| 15 | 253 | 101 | 354 | """
Provides a `TraceLogger` implementation that logs to a fluentd collector
"""
import json
import threading
import time
try:
from fluent.sender import FluentSender
except ImportError:
FluentSender = None
FLUENT_IMPORT_MESSAGE = "The Python fluent package is required to use this feature, please install it"... | """
Provides a `TraceLogger` implementation that logs to a fluentd collector
"""
import json
import threading
import time
try:
from fluent.sender import FluentSender
except ImportError:
FluentSender = None
FLUENT_IMPORT_MESSAGE = "The Python fluent package is required to use this feature, please install it"... |
46,373 | /home/hieuvd/dung_repo/raw/stars_03/galaxyproject_galaxy/galaxy | /home/hieuvd/dung_repo/raw/stars_03/galaxyproject_galaxy/galaxy/lib/galaxy/util/dictifiable.py | 11,12 | 1,73 | dict_for | 12,16 | 12,16 | import datetime
import uuid
from typing import (
Any,
Callable,
Dict,
Optional,
)
def dict_for(obj, **kwds):
FILL_FUNC_BODYclass Dictifiable:
"""Mixin that enables objects to be converted to dictionaries. This is useful
when for sharing objects across boundaries, such as the API, tool scripts,... | import datetime
import uuid
from typing import (
Any,
Callable,
Dict,
Optional,
)
def dict_for(obj, **kwds):
FILL_FUNC_BODYclass Dictifiable:
"""Mixin that enables objects to be converted to dictionaries. This is useful
when for sharing objects across boundaries, such as the API, tool scripts,... | # Create dict to represent item.
return dict(model_class=obj.__class__.__name__, **kwds)
| # Create dict to represent item.
return dict(model_class=obj.__class__.__name__, **kwds)
| 9 | 616 | 36 | 652 | import datetime
import uuid
from typing import (
Any,
Callable,
Dict,
Optional,
)
def dict_for(obj, **kwds):
FILL_FUNC_BODYclass Dictifiable:
"""Mixin that enables objects to be converted to dictionaries. This is useful
when for sharing objects across boundaries, such as the API, tool scripts,... | import datetime
import uuid
from typing import (
Any,
Callable,
Dict,
Optional,
)
def dict_for(obj, **kwds):
FILL_FUNC_BODYclass Dictifiable:
"""Mixin that enables objects to be converted to dictionaries. This is useful
when for sharing objects across boundaries, such as the API, tool scripts,... | |
46,374 | /home/hieuvd/dung_repo/raw/stars_03/galaxyproject_galaxy/galaxy | /home/hieuvd/dung_repo/raw/stars_03/galaxyproject_galaxy/galaxy/lib/galaxy/util/dictifiable.py | 21,22 | 16,73 | to_dict | Dictifiable | 25,73 | 22,73 | class Dictifiable:
"""Mixin that enables objects to be converted to dictionaries. This is useful
when for sharing objects across boundaries, such as the API, tool scripts,
and JavaScript code."""
def to_dict(self, view: str = "collection", value_mapper: Optional[Dict[str, Callable]] = None) -> Dict[str... | class Dictifiable:
"""Mixin that enables objects to be converted to dictionaries. This is useful
when for sharing objects across boundaries, such as the API, tool scripts,
and JavaScript code."""
def to_dict(self, view: str = "collection", value_mapper: Optional[Dict[str, Callable]] = None) -> Dict[str... |
if not value_mapper:
value_mapper = {}
def get_value(key, item):
"""
Recursive helper function to get item values.
"""
# FIXME: why use exception here? Why not look for key in value_mapper
# first and then default to to_dict?
... | """
Return item dictionary.
"""
if not value_mapper:
value_mapper = {}
def get_value(key, item):
"""
Recursive helper function to get item values.
"""
# FIXME: why use exception here? Why not look for key in value_mapp... | 177 | 113 | 505 | 618 | import datetime
import uuid
from typing import (
Any,
Callable,
Dict,
Optional,
)
def dict_for(obj, **kwds):
# Create dict to represent item.
return dict(model_class=obj.__class__.__name__, **kwds)
class Dictifiable:
"""Mixin that enables objects to be converted to dictionaries. This is ... | import datetime
import uuid
from typing import (
Any,
Callable,
Dict,
Optional,
)
def dict_for(obj, **kwds):
# Create dict to represent item.
return dict(model_class=obj.__class__.__name__, **kwds)
class Dictifiable:
"""Mixin that enables objects to be converted to dictionaries. This is ... |
46,375 | /home/hieuvd/dung_repo/raw/stars_03/galaxyproject_galaxy/galaxy | /home/hieuvd/dung_repo/raw/stars_03/galaxyproject_galaxy/galaxy/lib/galaxy/util/facts.py | 64,65 | 1,66 | get_facts | 65,66 | 65,66 | """Return various facts for string formatting.
"""
import socket
from collections.abc import MutableMapping
class Facts(MutableMapping):
"""A dict-like object that evaluates values at access time."""
def __init__(self, config=None, **kwargs):
config = config or {}
self.__dict__ = {}
... | """Return various facts for string formatting.
"""
import socket
from collections.abc import MutableMapping
class Facts(MutableMapping):
"""A dict-like object that evaluates values at access time."""
def __init__(self, config=None, **kwargs):
config = config or {}
self.__dict__ = {}
... | return Facts(config=config, **kwargs)
| return Facts(config=config, **kwargs)
| 3 | 563 | 14 | 577 | """Return various facts for string formatting.
"""
import socket
from collections.abc import MutableMapping
class Facts(MutableMapping):
"""A dict-like object that evaluates values at access time."""
def __init__(self, config=None, **kwargs):
config = config or {}
self.__dict__ = {}
... | """Return various facts for string formatting.
"""
import socket
from collections.abc import MutableMapping
class Facts(MutableMapping):
"""A dict-like object that evaluates values at access time."""
def __init__(self, config=None, **kwargs):
config = config or {}
self.__dict__ = {}
... | |
46,376 | /home/hieuvd/dung_repo/raw/stars_03/galaxyproject_galaxy/galaxy | /home/hieuvd/dung_repo/raw/stars_03/galaxyproject_galaxy/galaxy/lib/galaxy/util/facts.py | 30,31 | 8,64 | __set_config | Facts | 31,36 | 31,36 | class Facts(MutableMapping):
"""A dict-like object that evaluates values at access time."""
def __init__(self, config=None, **kwargs):
config = config or {}
self.__dict__ = {}
self.__set_defaults(config)
self.__set_config(config)
self.__dict__.update(dict(**kwargs))
... | class Facts(MutableMapping):
"""A dict-like object that evaluates values at access time."""
def __init__(self, config=None, **kwargs):
config = config or {}
self.__dict__ = {}
self.__set_defaults(config)
self.__set_config(config)
self.__dict__.update(dict(**kwargs))
... | if config is not None:
for name in dir(config):
if not name.startswith("_") and isinstance(getattr(config, name), str):
self.__dict__[f"config_{name}"] = lambda name=name: getattr(config, name)
| if config is not None:
for name in dir(config):
if not name.startswith("_") and isinstance(getattr(config, name), str):
self.__dict__[f"config_{name}"] = lambda name=name: getattr(config, name)
| 22 | 451 | 76 | 527 | """Return various facts for string formatting.
"""
import socket
from collections.abc import MutableMapping
class Facts(MutableMapping):
"""A dict-like object that evaluates values at access time."""
def __init__(self, config=None, **kwargs):
config = config or {}
self.__dict__ = {}
... | """Return various facts for string formatting.
"""
import socket
from collections.abc import MutableMapping
class Facts(MutableMapping):
"""A dict-like object that evaluates values at access time."""
def __init__(self, config=None, **kwargs):
config = config or {}
self.__dict__ = {}
... |
46,377 | /home/hieuvd/dung_repo/raw/stars_03/galaxyproject_galaxy/galaxy | /home/hieuvd/dung_repo/raw/stars_03/galaxyproject_galaxy/galaxy/lib/galaxy/util/filelock.py | 35,36 | 18,84 | acquire | FileLock | 41,54 | 36,54 | class FileLock:
"""A file locking mechanism that has context-manager support so
you can use it in a with statement. This should be relatively cross
compatible as it doesn't rely on msvcrt or fcntl for the locking.
"""
def __init__(self, file_name, timeout=10, delay=0.05):
"""Prepare the fil... | class FileLock:
"""A file locking mechanism that has context-manager support so
you can use it in a with statement. This should be relatively cross
compatible as it doesn't rely on msvcrt or fcntl for the locking.
"""
def __init__(self, file_name, timeout=10, delay=0.05):
"""Prepare the fil... | start_time = time.time()
while True:
try:
self.fd = os.open(self.lockfile, os.O_CREAT | os.O_EXCL | os.O_RDWR)
break
except OSError as e:
if e.errno != errno.EEXIST:
raise
if (time.time() - start_... | """Acquire the lock, if possible. If the lock is in use, it check again
every `wait` seconds. It does this until it either gets the lock or
exceeds `timeout` number of seconds, in which case it throws
an exception.
"""
start_time = time.time()
while True:
... | 37 | 524 | 149 | 673 | """Code obtained from https://github.com/dmfrey/FileLock.
See full license at:
https://github.com/dmfrey/FileLock/blob/master/LICENSE.txt
"""
import errno
import os
import time
class FileLockException(Exception):
pass
class FileLock:
"""A file locking mechanism that has context-manager support so
yo... | """Code obtained from https://github.com/dmfrey/FileLock.
See full license at:
https://github.com/dmfrey/FileLock/blob/master/LICENSE.txt
"""
import errno
import os
import time
class FileLockException(Exception):
pass
class FileLock:
"""A file locking mechanism that has context-manager support so
yo... |
46,378 | /home/hieuvd/dung_repo/raw/stars_03/galaxyproject_galaxy/galaxy | /home/hieuvd/dung_repo/raw/stars_03/galaxyproject_galaxy/galaxy/lib/galaxy/util/form_builder.py | 132,134 | 131,162 | fields | AddressField | 134,146 | 134,146 | class AddressField(BaseField):
@staticmethod
def fields():
FILL_FUNC_BODY def __init__(self, name, user=None, value=None, security=None, **kwds):
super().__init__(name, value, **kwds)
self.user = user
self.security = security
def to_dict(self):
d = super().to_dict()
... | class AddressField(BaseField):
@staticmethod
def fields():
FILL_FUNC_BODY def __init__(self, name, user=None, value=None, security=None, **kwds):
super().__init__(name, value, **kwds)
self.user = user
self.security = security
def to_dict(self):
d = super().to_dict()
... | return [
("desc", "Short address description", "Required"),
("name", "Name", ""),
("institution", "Institution", ""),
("address", "Address", ""),
("city", "City", ""),
("state", "State/Province/Region", ""),
("postal_code", "Pos... | return [
("desc", "Short address description", "Required"),
("name", "Name", ""),
("institution", "Institution", ""),
("address", "Address", ""),
("city", "City", ""),
("state", "State/Province/Region", ""),
("postal_code", "Pos... | 33 | 189 | 125 | 314 | """
Classes for generating HTML forms
"""
import logging
from galaxy.util import asbool
log = logging.getLogger(__name__)
class BaseField:
def __init__(self, name, value=None, label=None, **kwds):
self.name = name
self.label = label
self.value = value
self.disabled = kwds.get("d... | """
Classes for generating HTML forms
"""
import logging
from galaxy.util import asbool
log = logging.getLogger(__name__)
class BaseField:
def __init__(self, name, value=None, label=None, **kwds):
self.name = name
self.label = label
self.value = value
self.disabled = kwds.get("d... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.