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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
45,803 | /home/hieuvd/dung_repo/raw/stars_03/galaxyproject_galaxy/galaxy | /home/hieuvd/dung_repo/raw/stars_03/galaxyproject_galaxy/galaxy/lib/galaxy/managers/export_tracker.py | 51,52 | 21,80 | get_export_association | StoreExportTracker | 52,59 | 52,59 | class StoreExportTracker:
"""
Manages export-related metadata association of different types of exportable objects
to remote file sources or repositories.
"""
def __init__(self, app: MinimalManagerApp):
self.app = app
@property
def session(self) -> scoped_session:
return se... | class StoreExportTracker:
"""
Manages export-related metadata association of different types of exportable objects
to remote file sources or repositories.
"""
def __init__(self, app: MinimalManagerApp):
self.app = app
@property
def session(self) -> scoped_session:
return se... | try:
stmt = select(StoreExportAssociation).where(StoreExportAssociation.id == export_association_id)
export_association: StoreExportAssociation = self.session.execute(stmt).scalars().one()
except NoResultFound:
raise ObjectNotFound("Cannot get export association. Reas... | try:
stmt = select(StoreExportAssociation).where(StoreExportAssociation.id == export_association_id)
export_association: StoreExportAssociation = self.session.execute(stmt).scalars().one()
except NoResultFound:
raise ObjectNotFound("Cannot get export association. Reas... | 24 | 610 | 99 | 709 | from typing import (
List,
Optional,
)
from pydantic import BaseModel
from sqlalchemy import (
and_,
select,
)
from sqlalchemy.exc import NoResultFound
from sqlalchemy.orm.scoping import scoped_session
from galaxy.exceptions import ObjectNotFound
from galaxy.model import StoreExportAssociation
from ga... | from typing import (
List,
Optional,
)
from pydantic import BaseModel
from sqlalchemy import (
and_,
select,
)
from sqlalchemy.exc import NoResultFound
from sqlalchemy.orm.scoping import scoped_session
from galaxy.exceptions import ObjectNotFound
from galaxy.model import StoreExportAssociation
from ga... |
45,804 | /home/hieuvd/dung_repo/raw/stars_03/galaxyproject_galaxy/galaxy | /home/hieuvd/dung_repo/raw/stars_03/galaxyproject_galaxy/galaxy/lib/galaxy/managers/forms.py | 22,23 | 1,86 | get_form_definitions | 23,27 | 23,27 | from sqlalchemy import select
from sqlalchemy.exc import (
MultipleResultsFound,
NoResultFound,
)
from galaxy.exceptions import (
InconsistentDatabase,
InternalServerError,
RequestParameterInvalidException,
)
from galaxy.managers import base
from galaxy.managers.context import ProvidesUserContext
f... | from sqlalchemy import select
from sqlalchemy.exc import (
MultipleResultsFound,
NoResultFound,
)
from galaxy.exceptions import (
InconsistentDatabase,
InternalServerError,
RequestParameterInvalidException,
)
from galaxy.managers import base
from galaxy.managers.context import ProvidesUserContext
f... | stmt = select(FormDefinition)
return session.scalars(stmt)
| stmt = select(FormDefinition)
return session.scalars(stmt)
| 5 | 747 | 26 | 773 | from sqlalchemy import select
from sqlalchemy.exc import (
MultipleResultsFound,
NoResultFound,
)
from galaxy.exceptions import (
InconsistentDatabase,
InternalServerError,
RequestParameterInvalidException,
)
from galaxy.managers import base
from galaxy.managers.context import ProvidesUserContext
f... | from sqlalchemy import select
from sqlalchemy.exc import (
MultipleResultsFound,
NoResultFound,
)
from galaxy.exceptions import (
InconsistentDatabase,
InternalServerError,
RequestParameterInvalidException,
)
from galaxy.managers import base
from galaxy.managers.context import ProvidesUserContext
f... | |
45,805 | /home/hieuvd/dung_repo/raw/stars_03/galaxyproject_galaxy/galaxy | /home/hieuvd/dung_repo/raw/stars_03/galaxyproject_galaxy/galaxy/lib/galaxy/managers/forms.py | 50,51 | 45,86 | get | FormManager | 62,73 | 51,73 | class FormManager(base.ModelManager[FormDefinitionCurrent]):
"""
Business logic for forms.
"""
def get(self, trans: ProvidesUserContext, form_id: int) -> FormDefinitionCurrent:
FILL_FUNC_BODY def delete(self, trans: ProvidesUserContext, form: FormDefinitionCurrent) -> FormDefinitionCurrent:
... | class FormManager(base.ModelManager[FormDefinitionCurrent]):
"""
Business logic for forms.
"""
def get(self, trans: ProvidesUserContext, form_id: int) -> FormDefinitionCurrent:
"""
Method loads the form from the DB based on the given form id.
:param form_id: id of the for... | try:
stmt = select(FormDefinitionCurrent).where(FormDefinitionCurrent.id == form_id)
form = self.session().execute(stmt).scalar_one()
except MultipleResultsFound:
raise InconsistentDatabase("Multiple forms found with the same id.")
except NoResultFound:
... | """
Method loads the form from the DB based on the given form id.
:param form_id: id of the form to load from the DB
:type form_id: int
:returns: the loaded Form object
:rtype: galaxy.model.FormDefinitionCurrent
:raises: InconsistentDatabase,... | 42 | 306 | 138 | 444 | from sqlalchemy import select
from sqlalchemy.exc import (
MultipleResultsFound,
NoResultFound,
)
from galaxy.exceptions import (
InconsistentDatabase,
InternalServerError,
RequestParameterInvalidException,
)
from galaxy.managers import base
from galaxy.managers.context import ProvidesUserContext
f... | from sqlalchemy import select
from sqlalchemy.exc import (
MultipleResultsFound,
NoResultFound,
)
from galaxy.exceptions import (
InconsistentDatabase,
InternalServerError,
RequestParameterInvalidException,
)
from galaxy.managers import base
from galaxy.managers.context import ProvidesUserContext
f... |
45,806 | /home/hieuvd/dung_repo/raw/stars_03/galaxyproject_galaxy/galaxy | /home/hieuvd/dung_repo/raw/stars_03/galaxyproject_galaxy/galaxy/lib/galaxy/managers/genomes.py | 86,87 | 80,112 | _create_genome_filter | GenomeFilterMixin | 87,107 | 87,107 | class GenomeFilterMixin:
orm_filter_parsers: "OrmFilterParsersType"
database_connection: str
valid_ops = ("eq", "contains", "has")
def create_genome_filter(self, attr, op, val):
def _create_genome_filter(model_class=None):
FILL_FUNC_BODY return _create_genome_filter
def _add_parsers... | class GenomeFilterMixin:
orm_filter_parsers: "OrmFilterParsersType"
database_connection: str
valid_ops = ("eq", "contains", "has")
def create_genome_filter(self, attr, op, val):
def _create_genome_filter(model_class=None):
FILL_FUNC_BODY return _create_genome_filter
def _add_parsers... | if op not in GenomeFilterMixin.valid_ops:
raise_filter_err(attr, op, val, "bad op in filter")
if model_class is None:
return True
# Doesn't filter genome_build for collections
if model_class.__name__ == "HistoryDatasetCollectionAssociation"... | if op not in GenomeFilterMixin.valid_ops:
raise_filter_err(attr, op, val, "bad op in filter")
if model_class is None:
return True
# Doesn't filter genome_build for collections
if model_class.__name__ == "HistoryDatasetCollectionAssociation"... | 92 | 165 | 325 | 490 | from typing import (
Any,
List,
Optional,
TYPE_CHECKING,
)
from sqlalchemy import (
func,
text,
)
from galaxy import model as m
from galaxy.exceptions import (
ReferenceDataError,
RequestParameterInvalidException,
)
from galaxy.managers.context import ProvidesUserContext
from galaxy.st... | from typing import (
Any,
List,
Optional,
TYPE_CHECKING,
)
from sqlalchemy import (
func,
text,
)
from galaxy import model as m
from galaxy.exceptions import (
ReferenceDataError,
RequestParameterInvalidException,
)
from galaxy.managers.context import ProvidesUserContext
from galaxy.st... |
45,807 | /home/hieuvd/dung_repo/raw/stars_03/galaxyproject_galaxy/galaxy | /home/hieuvd/dung_repo/raw/stars_03/galaxyproject_galaxy/galaxy/lib/galaxy/managers/genomes.py | 68,69 | 26,80 | _get_index_filename | GenomesManager | 69,80 | 69,80 | class GenomesManager:
def __init__(self, app: StructuredApp):
self._app = app
self.genomes = app.genomes
def get_dbkeys(self, user: Optional[m.User], chrom_info: bool) -> List[List[str]]:
return self.genomes.get_dbkeys(user, chrom_info)
def is_registered_dbkey(self, dbkey: str, use... | class GenomesManager:
def __init__(self, app: StructuredApp):
self._app = app
self.genomes = app.genomes
def get_dbkeys(self, user: Optional[m.User], chrom_info: bool) -> List[List[str]]:
return self.genomes.get_dbkeys(user, chrom_info)
def is_registered_dbkey(self, dbkey: str, use... | try:
paths = [x[-1] for x in tbl_entries if id in x]
file_name = paths.pop()
except TypeError:
raise ReferenceDataError(f"Data tables not found for {index_type}")
except IndexError:
raise ReferenceDataError(f"Data tables not found for {index_type} ... | try:
paths = [x[-1] for x in tbl_entries if id in x]
file_name = paths.pop()
except TypeError:
raise ReferenceDataError(f"Data tables not found for {index_type}")
except IndexError:
raise ReferenceDataError(f"Data tables not found for {index_type} ... | 38 | 610 | 121 | 731 | from typing import (
Any,
List,
Optional,
TYPE_CHECKING,
)
from sqlalchemy import (
func,
text,
)
from galaxy import model as m
from galaxy.exceptions import (
ReferenceDataError,
RequestParameterInvalidException,
)
from galaxy.managers.context import ProvidesUserContext
from galaxy.st... | from typing import (
Any,
List,
Optional,
TYPE_CHECKING,
)
from sqlalchemy import (
func,
text,
)
from galaxy import model as m
from galaxy.exceptions import (
ReferenceDataError,
RequestParameterInvalidException,
)
from galaxy.managers.context import ProvidesUserContext
from galaxy.st... |
45,808 | /home/hieuvd/dung_repo/raw/stars_03/galaxyproject_galaxy/galaxy | /home/hieuvd/dung_repo/raw/stars_03/galaxyproject_galaxy/galaxy/lib/galaxy/managers/group_roles.py | 96,97 | 1,101 | get_group_role | 97,101 | 97,101 | import logging
from typing import (
List,
Optional,
)
from sqlalchemy import select
from galaxy import model
from galaxy.exceptions import ObjectNotFound
from galaxy.managers.context import ProvidesAppContext
from galaxy.model import GroupRoleAssociation
from galaxy.model.base import transaction
from galaxy.m... | import logging
from typing import (
List,
Optional,
)
from sqlalchemy import select
from galaxy import model
from galaxy.exceptions import ObjectNotFound
from galaxy.managers.context import ProvidesAppContext
from galaxy.model import GroupRoleAssociation
from galaxy.model.base import transaction
from galaxy.m... | stmt = (
select(GroupRoleAssociation).where(GroupRoleAssociation.group == group).where(GroupRoleAssociation.role == role)
)
return session.execute(stmt).scalar_one_or_none()
| stmt = (
select(GroupRoleAssociation).where(GroupRoleAssociation.group == group).where(GroupRoleAssociation.role == role)
)
return session.execute(stmt).scalar_one_or_none()
| 11 | 1,075 | 62 | 1,137 | import logging
from typing import (
List,
Optional,
)
from sqlalchemy import select
from galaxy import model
from galaxy.exceptions import ObjectNotFound
from galaxy.managers.context import ProvidesAppContext
from galaxy.model import GroupRoleAssociation
from galaxy.model.base import transaction
from galaxy.m... | import logging
from typing import (
List,
Optional,
)
from sqlalchemy import select
from galaxy import model
from galaxy.exceptions import ObjectNotFound
from galaxy.managers.context import ProvidesAppContext
from galaxy.model import GroupRoleAssociation
from galaxy.model.base import transaction
from galaxy.m... | |
45,809 | /home/hieuvd/dung_repo/raw/stars_03/galaxyproject_galaxy/galaxy | /home/hieuvd/dung_repo/raw/stars_03/galaxyproject_galaxy/galaxy/lib/galaxy/managers/group_roles.py | 67,68 | 20,96 | _get_group | GroupRolesManager | 68,73 | 68,73 | class GroupRolesManager:
"""Interface/service object shared by controllers for interacting with group roles."""
def __init__(self, app: MinimalManagerApp) -> None:
self._app = app
def index(self, trans: ProvidesAppContext, group_id: int) -> List[model.GroupRoleAssociation]:
"""
Ret... | class GroupRolesManager:
"""Interface/service object shared by controllers for interacting with group roles."""
def __init__(self, app: MinimalManagerApp) -> None:
self._app = app
def index(self, trans: ProvidesAppContext, group_id: int) -> List[model.GroupRoleAssociation]:
"""
Ret... | group = trans.sa_session.get(model.Group, group_id)
if not group:
raise ObjectNotFound("Group with the id provided was not found.")
return group
| group = trans.sa_session.get(model.Group, group_id)
if not group:
raise ObjectNotFound("Group with the id provided was not found.")
return group
| 18 | 882 | 51 | 933 | import logging
from typing import (
List,
Optional,
)
from sqlalchemy import select
from galaxy import model
from galaxy.exceptions import ObjectNotFound
from galaxy.managers.context import ProvidesAppContext
from galaxy.model import GroupRoleAssociation
from galaxy.model.base import transaction
from galaxy.m... | import logging
from typing import (
List,
Optional,
)
from sqlalchemy import select
from galaxy import model
from galaxy.exceptions import ObjectNotFound
from galaxy.managers.context import ProvidesAppContext
from galaxy.model import GroupRoleAssociation
from galaxy.model.base import transaction
from galaxy.m... |
45,810 | /home/hieuvd/dung_repo/raw/stars_03/galaxyproject_galaxy/galaxy | /home/hieuvd/dung_repo/raw/stars_03/galaxyproject_galaxy/galaxy/lib/galaxy/managers/group_users.py | 99,100 | 1,104 | get_group_user | 100,104 | 100,104 | import logging
from typing import (
List,
Optional,
)
from sqlalchemy import select
from galaxy import model
from galaxy.exceptions import ObjectNotFound
from galaxy.managers.context import ProvidesAppContext
from galaxy.model import (
User,
UserGroupAssociation,
)
from galaxy.model.base import transa... | import logging
from typing import (
List,
Optional,
)
from sqlalchemy import select
from galaxy import model
from galaxy.exceptions import ObjectNotFound
from galaxy.managers.context import ProvidesAppContext
from galaxy.model import (
User,
UserGroupAssociation,
)
from galaxy.model.base import transa... | stmt = (
select(UserGroupAssociation).where(UserGroupAssociation.user == user).where(UserGroupAssociation.group == group)
)
return session.execute(stmt).scalar_one_or_none()
| stmt = (
select(UserGroupAssociation).where(UserGroupAssociation.user == user).where(UserGroupAssociation.group == group)
)
return session.execute(stmt).scalar_one_or_none()
| 11 | 1,094 | 62 | 1,156 | import logging
from typing import (
List,
Optional,
)
from sqlalchemy import select
from galaxy import model
from galaxy.exceptions import ObjectNotFound
from galaxy.managers.context import ProvidesAppContext
from galaxy.model import (
User,
UserGroupAssociation,
)
from galaxy.model.base import transa... | import logging
from typing import (
List,
Optional,
)
from sqlalchemy import select
from galaxy import model
from galaxy.exceptions import ObjectNotFound
from galaxy.managers.context import ProvidesAppContext
from galaxy.model import (
User,
UserGroupAssociation,
)
from galaxy.model.base import transa... | |
45,811 | /home/hieuvd/dung_repo/raw/stars_03/galaxyproject_galaxy/galaxy | /home/hieuvd/dung_repo/raw/stars_03/galaxyproject_galaxy/galaxy/lib/galaxy/managers/group_users.py | 36,37 | 23,99 | show | GroupUsersManager | 40,47 | 37,47 | class GroupUsersManager:
"""Interface/service object shared by controllers for interacting with group users."""
def __init__(self, app: MinimalManagerApp) -> None:
self._app = app
def index(self, trans: ProvidesAppContext, group_id: int) -> List[model.User]:
"""
Returns a collectio... | class GroupUsersManager:
"""Interface/service object shared by controllers for interacting with group users."""
def __init__(self, app: MinimalManagerApp) -> None:
self._app = app
def index(self, trans: ProvidesAppContext, group_id: int) -> List[model.User]:
"""
Returns a collectio... | group = self._get_group(trans, group_id)
user = self._get_user(trans, user_id)
group_user = self._get_group_user(trans, group, user)
if group_user is None:
raise ObjectNotFound(f"User {user.email} not in group {group.name}")
return user
| """
Returns information about a group user.
"""
group = self._get_group(trans, group_id)
user = self._get_user(trans, user_id)
group_user = self._get_group_user(trans, group, user)
if group_user is None:
raise ObjectNotFound(f"User {user.email} not in ... | 26 | 848 | 96 | 944 | import logging
from typing import (
List,
Optional,
)
from sqlalchemy import select
from galaxy import model
from galaxy.exceptions import ObjectNotFound
from galaxy.managers.context import ProvidesAppContext
from galaxy.model import (
User,
UserGroupAssociation,
)
from galaxy.model.base import transa... | import logging
from typing import (
List,
Optional,
)
from sqlalchemy import select
from galaxy import model
from galaxy.exceptions import ObjectNotFound
from galaxy.managers.context import ProvidesAppContext
from galaxy.model import (
User,
UserGroupAssociation,
)
from galaxy.model.base import transa... |
45,813 | /home/hieuvd/dung_repo/raw/stars_03/galaxyproject_galaxy/galaxy | /home/hieuvd/dung_repo/raw/stars_03/galaxyproject_galaxy/galaxy/lib/galaxy/managers/hdcas.py | 236,237 | 185,247 | _proxy_to_dataset_collection | DCASerializer | 237,247 | 237,247 | class DCASerializer(base.ModelSerializer):
"""
Base (abstract) Serializer class for HDCAs and LDCAs.
"""
app: StructuredApp
def __init__(self, app: StructuredApp, dce_serializer=None):
super().__init__(app)
self.dce_serializer = dce_serializer or DCESerializer(app)
self.de... | class DCASerializer(base.ModelSerializer):
"""
Base (abstract) Serializer class for HDCAs and LDCAs.
"""
app: StructuredApp
def __init__(self, app: StructuredApp, dce_serializer=None):
super().__init__(app)
self.dce_serializer = dce_serializer or DCESerializer(app)
self.de... | # dataset_collection associations are (rough) proxies to datasets - access their serializer using this remapping fn
# remapping done by either kwarg key: IOW dataset attr key (e.g. populated_state)
# or by kwarg serializer: a function that's passed in (e.g. elements)
if key:
... | # dataset_collection associations are (rough) proxies to datasets - access their serializer using this remapping fn
# remapping done by either kwarg key: IOW dataset attr key (e.g. populated_state)
# or by kwarg serializer: a function that's passed in (e.g. elements)
if key:
... | 69 | 441 | 176 | 617 | """
Manager and Serializer for HDCAs.
HistoryDatasetCollectionAssociations (HDCAs) are datasets contained or created in a
history.
"""
import logging
from typing import Dict
from galaxy import model
from galaxy.managers import (
annotatable,
base,
deletable,
hdas,
secured,
taggable,
)
from ga... | """
Manager and Serializer for HDCAs.
HistoryDatasetCollectionAssociations (HDCAs) are datasets contained or created in a
history.
"""
import logging
from typing import Dict
from galaxy import model
from galaxy.managers import (
annotatable,
base,
deletable,
hdas,
secured,
taggable,
)
from ga... |
45,814 | /home/hieuvd/dung_repo/raw/stars_03/galaxyproject_galaxy/galaxy | /home/hieuvd/dung_repo/raw/stars_03/galaxyproject_galaxy/galaxy/lib/galaxy/managers/hdcas.py | 129,130 | 110,137 | serialize_object | DCESerializer | 130,137 | 130,137 | class DCESerializer(base.ModelSerializer):
"""
Serializer for DatasetCollectionElements.
"""
def __init__(self, app: StructuredApp):
super().__init__(app)
self.hda_serializer = hdas.HDASerializer(app)
self.dc_serializer = DCSerializer(app, dce_serializer=self)
self.defa... | class DCESerializer(base.ModelSerializer):
"""
Serializer for DatasetCollectionElements.
"""
def __init__(self, app: StructuredApp):
super().__init__(app)
self.hda_serializer = hdas.HDASerializer(app)
self.dc_serializer = DCSerializer(app, dce_serializer=self)
self.defa... | if item.hda:
return self.hda_serializer.serialize_to_view(item.hda, view="summary", **context)
if item.child_collection:
return self.dc_serializer.serialize_to_view(item.child_collection, view="detailed", **context)
return "object"
| if item.hda:
return self.hda_serializer.serialize_to_view(item.hda, view="summary", **context)
if item.child_collection:
return self.dc_serializer.serialize_to_view(item.child_collection, view="detailed", **context)
return "object"
| 14 | 234 | 92 | 326 | """
Manager and Serializer for HDCAs.
HistoryDatasetCollectionAssociations (HDCAs) are datasets contained or created in a
history.
"""
import logging
from typing import Dict
from galaxy import model
from galaxy.managers import (
annotatable,
base,
deletable,
hdas,
secured,
taggable,
)
from ga... | """
Manager and Serializer for HDCAs.
HistoryDatasetCollectionAssociations (HDCAs) are datasets contained or created in a
history.
"""
import logging
from typing import Dict
from galaxy import model
from galaxy.managers import (
annotatable,
base,
deletable,
hdas,
secured,
taggable,
)
from ga... |
45,815 | /home/hieuvd/dung_repo/raw/stars_03/galaxyproject_galaxy/galaxy | /home/hieuvd/dung_repo/raw/stars_03/galaxyproject_galaxy/galaxy/lib/galaxy/managers/hdcas.py | 168,169 | 137,185 | add_serializers | DCSerializer | 169,177 | 169,177 | class DCSerializer(base.ModelSerializer):
"""
Serializer for DatasetCollections.
"""
def __init__(self, app: StructuredApp, dce_serializer=None):
super().__init__(app)
self.dce_serializer = dce_serializer or DCESerializer(app)
self.default_view = "summary"
self.add_view... | class DCSerializer(base.ModelSerializer):
"""
Serializer for DatasetCollections.
"""
def __init__(self, app: StructuredApp, dce_serializer=None):
super().__init__(app)
self.dce_serializer = dce_serializer or DCESerializer(app)
self.default_view = "summary"
self.add_view... | super().add_serializers()
self.serializers.update(
{
"model_class": lambda *a, **c: "DatasetCollection",
"elements": self.serialize_elements,
}
)
| super().add_serializers()
self.serializers.update(
{
"model_class": lambda *a, **c: "DatasetCollection",
"elements": self.serialize_elements,
}
)
| 12 | 307 | 68 | 375 | """
Manager and Serializer for HDCAs.
HistoryDatasetCollectionAssociations (HDCAs) are datasets contained or created in a
history.
"""
import logging
from typing import Dict
from galaxy import model
from galaxy.managers import (
annotatable,
base,
deletable,
hdas,
secured,
taggable,
)
from ga... | """
Manager and Serializer for HDCAs.
HistoryDatasetCollectionAssociations (HDCAs) are datasets contained or created in a
history.
"""
import logging
from typing import Dict
from galaxy import model
from galaxy.managers import (
annotatable,
base,
deletable,
hdas,
secured,
taggable,
)
from ga... |
45,816 | /home/hieuvd/dung_repo/raw/stars_03/galaxyproject_galaxy/galaxy | /home/hieuvd/dung_repo/raw/stars_03/galaxyproject_galaxy/galaxy/lib/galaxy/managers/hdcas.py | 103,104 | 58,110 | update_attributes | HDCAManager | 104,110 | 104,110 | class HDCAManager(
base.ModelManager,
secured.AccessibleManagerMixin,
secured.OwnableManagerMixin,
deletable.PurgableManagerMixin,
annotatable.AnnotatableManagerMixin,
):
"""
Interface/service object for interacting with HDCAs.
"""
model_class = model.HistoryDatasetCollectionAssocia... | class HDCAManager(
base.ModelManager,
secured.AccessibleManagerMixin,
secured.OwnableManagerMixin,
deletable.PurgableManagerMixin,
annotatable.AnnotatableManagerMixin,
):
"""
Interface/service object for interacting with HDCAs.
"""
model_class = model.HistoryDatasetCollectionAssocia... | # pre-requisite checked that attributes are valid
self.map_datasets(content, fn=lambda item, *args: set_collection_attributes(item, payload.items()))
# serializers
# -----------------------------------------------------------------------------
| # pre-requisite checked that attributes are valid
self.map_datasets(content, fn=lambda item, *args: set_collection_attributes(item, payload.items()))
# serializers
# -----------------------------------------------------------------------------
| 17 | 452 | 61 | 513 | """
Manager and Serializer for HDCAs.
HistoryDatasetCollectionAssociations (HDCAs) are datasets contained or created in a
history.
"""
import logging
from typing import Dict
from galaxy import model
from galaxy.managers import (
annotatable,
base,
deletable,
hdas,
secured,
taggable,
)
from ga... | """
Manager and Serializer for HDCAs.
HistoryDatasetCollectionAssociations (HDCAs) are datasets contained or created in a
history.
"""
import logging
from typing import Dict
from galaxy import model
from galaxy.managers import (
annotatable,
base,
deletable,
hdas,
secured,
taggable,
)
from ga... |
45,817 | /home/hieuvd/dung_repo/raw/stars_03/galaxyproject_galaxy/galaxy | /home/hieuvd/dung_repo/raw/stars_03/galaxyproject_galaxy/galaxy/lib/galaxy/managers/hdcas.py | 295,296 | 247,337 | add_serializers | HDCASerializer | 296,322 | 296,322 | class HDCASerializer(DCASerializer, taggable.TaggableSerializerMixin, annotatable.AnnotatableSerializerMixin):
"""
Serializer for HistoryDatasetCollectionAssociations.
"""
def __init__(self, app: StructuredApp):
super().__init__(app)
self.hdca_manager = HDCAManager(app)
self.de... | class HDCASerializer(DCASerializer, taggable.TaggableSerializerMixin, annotatable.AnnotatableSerializerMixin):
"""
Serializer for HistoryDatasetCollectionAssociations.
"""
def __init__(self, app: StructuredApp):
super().__init__(app)
self.hdca_manager = HDCAManager(app)
self.de... | super().add_serializers()
taggable.TaggableSerializerMixin.add_serializers(self)
annotatable.AnnotatableSerializerMixin.add_serializers(self)
serializers: Dict[str, base.Serializer] = {
"model_class": lambda item, key, **context: self.hdca_manager.model_class.__class__.__name... | super().add_serializers()
taggable.TaggableSerializerMixin.add_serializers(self)
annotatable.AnnotatableSerializerMixin.add_serializers(self)
serializers: Dict[str, base.Serializer] = {
"model_class": lambda item, key, **context: self.hdca_manager.model_class.__class__.__name... | 64 | 568 | 416 | 984 | """
Manager and Serializer for HDCAs.
HistoryDatasetCollectionAssociations (HDCAs) are datasets contained or created in a
history.
"""
import logging
from typing import Dict
from galaxy import model
from galaxy.managers import (
annotatable,
base,
deletable,
hdas,
secured,
taggable,
)
from ga... | """
Manager and Serializer for HDCAs.
HistoryDatasetCollectionAssociations (HDCAs) are datasets contained or created in a
history.
"""
import logging
from typing import Dict
from galaxy import model
from galaxy.managers import (
annotatable,
base,
deletable,
hdas,
secured,
taggable,
)
from ga... |
45,818 | /home/hieuvd/dung_repo/raw/stars_03/galaxyproject_galaxy/galaxy | /home/hieuvd/dung_repo/raw/stars_03/galaxyproject_galaxy/galaxy/lib/galaxy/managers/item_tags.py | 67,68 | 13,90 | _remove_items_tag | ItemTagsManager | 68,75 | 68,75 | class ItemTagsManager:
"""Interface/service object shared by controllers for interacting with item-tags."""
def __init__(self, app: MinimalManagerApp) -> None:
self._app = app
self._tag_handler = app.tag_handler
def index(self, trans: ProvidesAppContext, tagged_item_class: str, tagged_item... | class ItemTagsManager:
"""Interface/service object shared by controllers for interacting with item-tags."""
def __init__(self, app: MinimalManagerApp) -> None:
self._app = app
self._tag_handler = app.tag_handler
def index(self, trans: ProvidesAppContext, tagged_item_class: str, tagged_item... | user = trans.user
tagged_item = self._get_tagged_item(trans, item_class_name, id)
deleted = tagged_item and self._tag_handler.remove_item_tag(user, tagged_item, tag_name)
with transaction(trans.sa_session):
trans.sa_session.commit()
return deleted
| user = trans.user
tagged_item = self._get_tagged_item(trans, item_class_name, id)
deleted = tagged_item and self._tag_handler.remove_item_tag(user, tagged_item, tag_name)
with transaction(trans.sa_session):
trans.sa_session.commit()
return deleted
| 20 | 988 | 95 | 1,083 | from galaxy.exceptions import (
NoContentException,
ObjectNotFound,
)
from galaxy.managers import base
from galaxy.managers.context import ProvidesAppContext
from galaxy.model.base import transaction
from galaxy.schema.fields import DecodedDatabaseIdField
from galaxy.schema.item_tags import ItemTagsCreatePayloa... | from galaxy.exceptions import (
NoContentException,
ObjectNotFound,
)
from galaxy.managers import base
from galaxy.managers.context import ProvidesAppContext
from galaxy.model.base import transaction
from galaxy.schema.fields import DecodedDatabaseIdField
from galaxy.schema.item_tags import ItemTagsCreatePayloa... |
45,820 | /home/hieuvd/dung_repo/raw/stars_03/galaxyproject_galaxy/galaxy | /home/hieuvd/dung_repo/raw/stars_03/galaxyproject_galaxy/galaxy/lib/galaxy/managers/lddas.py | 29,30 | 11,33 | _set_permissions | LDDAManager | 30,33 | 30,33 | class LDDAManager(DatasetAssociationManager):
"""
A fairly sparse manager for LDDAs.
"""
model_class = model.LibraryDatasetDatasetAssociation
def __init__(self, app: MinimalManagerApp):
"""
Set up and initialize other managers needed by lddas.
"""
super().__init__(a... | class LDDAManager(DatasetAssociationManager):
"""
A fairly sparse manager for LDDAs.
"""
model_class = model.LibraryDatasetDatasetAssociation
def __init__(self, app: MinimalManagerApp):
"""
Set up and initialize other managers needed by lddas.
"""
super().__init__(a... | # Check Git history for an older broken implementation, but it was broken
# and security related and had not test coverage so it was deleted.
raise NotImplementedError()
| # Check Git history for an older broken implementation, but it was broken
# and security related and had not test coverage so it was deleted.
raise NotImplementedError()
| 28 | 204 | 44 | 248 | import logging
from galaxy import model
from galaxy.managers import base as manager_base
from galaxy.managers.datasets import DatasetAssociationManager
from galaxy.structured_app import MinimalManagerApp
log = logging.getLogger(__name__)
class LDDAManager(DatasetAssociationManager):
"""
A fairly sparse mana... | import logging
from galaxy import model
from galaxy.managers import base as manager_base
from galaxy.managers.datasets import DatasetAssociationManager
from galaxy.structured_app import MinimalManagerApp
log = logging.getLogger(__name__)
class LDDAManager(DatasetAssociationManager):
"""
A fairly sparse mana... |
45,823 | /home/hieuvd/dung_repo/raw/stars_03/galaxyproject_galaxy/galaxy | /home/hieuvd/dung_repo/raw/stars_03/galaxyproject_galaxy/galaxy/lib/galaxy/managers/licenses.py | 104,105 | 81,109 | get_license_by_id | LicensesManager | 105,109 | 105,109 | class LicensesManager:
def __init__(self):
by_index = {}
for spdx_license in self.index():
by_index[spdx_license["licenseId"]] = spdx_license
by_index[spdx_license["detailsUrl"]] = spdx_license
for seeAlso in spdx_license.get("seeAlso", []):
by_ind... | class LicensesManager:
def __init__(self):
by_index = {}
for spdx_license in self.index():
by_index[spdx_license["licenseId"]] = spdx_license
by_index[spdx_license["detailsUrl"]] = spdx_license
for seeAlso in spdx_license.get("seeAlso", []):
by_ind... | license = self.get(id)
if license.get("licenseId", None) is None:
raise exceptions.ObjectNotFound(f"License '{id}' not found")
return LicenseMetadataModel(**license)
| license = self.get(id)
if license.get("licenseId", None) is None:
raise exceptions.ObjectNotFound(f"License '{id}' not found")
return LicenseMetadataModel(**license)
| 15 | 266 | 57 | 323 | import json
import logging
from typing import List
from pydantic import (
BaseModel,
Field,
HttpUrl,
)
from galaxy import exceptions
from galaxy.util.resources import resource_string
log = logging.getLogger(__name__)
# https://github.com/spdx/license-list-data/blob/master/accessingLicenses.md#license-l... | import json
import logging
from typing import List
from pydantic import (
BaseModel,
Field,
HttpUrl,
)
from galaxy import exceptions
from galaxy.util.resources import resource_string
log = logging.getLogger(__name__)
# https://github.com/spdx/license-list-data/blob/master/accessingLicenses.md#license-l... |
45,825 | /home/hieuvd/dung_repo/raw/stars_03/galaxyproject_galaxy/galaxy | /home/hieuvd/dung_repo/raw/stars_03/galaxyproject_galaxy/galaxy/lib/galaxy/managers/metrics.py | 70,71 | 62,142 | create | MetricsManager | 88,95 | 71,95 | class MetricsManager:
"""Interface/service object shared by controllers for interacting with metrics."""
def __init__(self, app: MinimalManagerApp) -> None:
self._app = app
#: set to true to send additional debugging info to the log
self.debugging = True
def create(self, trans, pay... | class MetricsManager:
"""Interface/service object shared by controllers for interacting with metrics."""
def __init__(self, app: MinimalManagerApp) -> None:
self._app = app
#: set to true to send additional debugging info to the log
self.debugging = True
def create(self, trans, pay... | user_id = trans.user.id if trans.user else None
session_id = trans.galaxy_session.id if trans.galaxy_session else None
parsed_gen = self._parse_metrics(payload.metrics, user_id, session_id)
self._send_metrics(trans, parsed_gen)
response = self._get_server_pong(trans)
retu... | """
Record any metrics sent and return some status object.
.. note:: Anonymous users can post metrics
:type payload: dict
:param payload: (optional) dictionary structure containing:
* metrics: a list containing dictionaries of the form
n... | 26 | 771 | 109 | 880 | import logging
from datetime import datetime
from typing import (
Any,
Generator,
List,
Optional,
Tuple,
)
from pydantic import (
BaseModel,
Field,
)
from galaxy.structured_app import MinimalManagerApp
log = logging.getLogger(__name__)
SOME_EXAMPLE_DATE = "2021-01-23T18:25:43.511Z"
cl... | import logging
from datetime import datetime
from typing import (
Any,
Generator,
List,
Optional,
Tuple,
)
from pydantic import (
BaseModel,
Field,
)
from galaxy.structured_app import MinimalManagerApp
log = logging.getLogger(__name__)
SOME_EXAMPLE_DATE = "2021-01-23T18:25:43.511Z"
cl... |
45,827 | /home/hieuvd/dung_repo/raw/stars_03/galaxyproject_galaxy/galaxy | /home/hieuvd/dung_repo/raw/stars_03/galaxyproject_galaxy/galaxy/lib/galaxy/managers/remote_files.py | 45,54 | 37,181 | index | RemoteFilesManager | 55,135 | 54,135 | class RemoteFilesManager:
"""
Interface/service object for interacting with remote files.
"""
def __init__(self, app: MinimalManagerApp):
self._app = app
def index(
self,
user_ctx: ProvidesUserContext,
target: str,
format: Optional[RemoteFilesFormat],
... | class RemoteFilesManager:
"""
Interface/service object for interacting with remote files.
"""
def __init__(self, app: MinimalManagerApp):
self._app = app
def index(
self,
user_ctx: ProvidesUserContext,
target: str,
format: Optional[RemoteFilesFormat],
... |
user_file_source_context = ProvidesFileSourcesUserContext(user_ctx)
default_recursive = False
default_format = RemoteFilesFormat.uri
if "://" in target:
uri = target
elif target == RemoteFilesTarget.userdir:
uri = "gxuserimport://"
default_fo... | """Returns a list of remote files available to the user."""
user_file_source_context = ProvidesFileSourcesUserContext(user_ctx)
default_recursive = False
default_format = RemoteFilesFormat.uri
if "://" in target:
uri = target
elif target == RemoteFilesTarget... | 222 | 792 | 879 | 1,671 | import hashlib
import logging
from operator import itemgetter
from typing import (
Optional,
Set,
)
from galaxy import exceptions
from galaxy.files import (
ConfiguredFileSources,
FileSourcePath,
ProvidesFileSourcesUserContext,
)
from galaxy.files.sources import (
FilesSourceOptions,
Plugin... | import hashlib
import logging
from operator import itemgetter
from typing import (
Optional,
Set,
)
from galaxy import exceptions
from galaxy.files import (
ConfiguredFileSources,
FileSourcePath,
ProvidesFileSourcesUserContext,
)
from galaxy.files.sources import (
FilesSourceOptions,
Plugin... |
45,828 | /home/hieuvd/dung_repo/raw/stars_03/galaxyproject_galaxy/galaxy | /home/hieuvd/dung_repo/raw/stars_03/galaxyproject_galaxy/galaxy/lib/galaxy/managers/roles.py | 167,168 | 1,170 | get_roles_by_ids | 168,170 | 168,170 | """
Manager and Serializer for Roles.
"""
import logging
from typing import List
from sqlalchemy import (
false,
select,
)
from sqlalchemy.exc import (
MultipleResultsFound,
NoResultFound,
)
from galaxy import model
from galaxy.exceptions import (
Conflict,
InconsistentDatabase,
InternalS... | """
Manager and Serializer for Roles.
"""
import logging
from typing import List
from sqlalchemy import (
false,
select,
)
from sqlalchemy.exc import (
MultipleResultsFound,
NoResultFound,
)
from galaxy import model
from galaxy.exceptions import (
Conflict,
InconsistentDatabase,
InternalS... | stmt = select(Role).where(Role.id.in_(role_ids))
return session.scalars(stmt).all()
| stmt = select(Role).where(Role.id.in_(role_ids))
return session.scalars(stmt).all()
| 5 | 1,729 | 35 | 1,764 | """
Manager and Serializer for Roles.
"""
import logging
from typing import List
from sqlalchemy import (
false,
select,
)
from sqlalchemy.exc import (
MultipleResultsFound,
NoResultFound,
)
from galaxy import model
from galaxy.exceptions import (
Conflict,
InconsistentDatabase,
InternalS... | """
Manager and Serializer for Roles.
"""
import logging
from typing import List
from sqlalchemy import (
false,
select,
)
from sqlalchemy.exc import (
MultipleResultsFound,
NoResultFound,
)
from galaxy import model
from galaxy.exceptions import (
Conflict,
InconsistentDatabase,
InternalS... | |
45,829 | /home/hieuvd/dung_repo/raw/stars_03/galaxyproject_galaxy/galaxy | /home/hieuvd/dung_repo/raw/stars_03/galaxyproject_galaxy/galaxy/lib/galaxy/managers/roles.py | 74,75 | 36,167 | list_displayable_roles | RoleManager | 75,82 | 75,82 | class RoleManager(base.ModelManager[model.Role]):
"""
Business logic for roles.
"""
model_class = model.Role
foreign_key_name = "role"
user_assoc = model.UserRoleAssociation
group_assoc = model.GroupRoleAssociation
def get(self, trans: ProvidesUserContext, role_id: int) -> model.Role:... | class RoleManager(base.ModelManager[model.Role]):
"""
Business logic for roles.
"""
model_class = model.Role
foreign_key_name = "role"
user_assoc = model.UserRoleAssociation
group_assoc = model.GroupRoleAssociation
def get(self, trans: ProvidesUserContext, role_id: int) -> model.Role:... | roles = []
stmt = select(Role).where(Role.deleted == false())
for role in trans.sa_session.scalars(stmt):
if trans.user_is_admin or trans.app.security_agent.ok_to_display(trans.user, role):
roles.append(role)
return roles
| roles = []
stmt = select(Role).where(Role.deleted == false())
for role in trans.sa_session.scalars(stmt):
if trans.user_is_admin or trans.app.security_agent.ok_to_display(trans.user, role):
roles.append(role)
return roles
| 20 | 1,421 | 90 | 1,511 | """
Manager and Serializer for Roles.
"""
import logging
from typing import List
from sqlalchemy import (
false,
select,
)
from sqlalchemy.exc import (
MultipleResultsFound,
NoResultFound,
)
from galaxy import model
from galaxy.exceptions import (
Conflict,
InconsistentDatabase,
InternalS... | """
Manager and Serializer for Roles.
"""
import logging
from typing import List
from sqlalchemy import (
false,
select,
)
from sqlalchemy.exc import (
MultipleResultsFound,
NoResultFound,
)
from galaxy import model
from galaxy.exceptions import (
Conflict,
InconsistentDatabase,
InternalS... |
45,830 | /home/hieuvd/dung_repo/raw/stars_03/galaxyproject_galaxy/galaxy | /home/hieuvd/dung_repo/raw/stars_03/galaxyproject_galaxy/galaxy/lib/galaxy/managers/session.py | 21,22 | 14,33 | get_session_from_session_key | GalaxySessionManager | 23,33 | 22,33 | class GalaxySessionManager:
"""Manages GalaxySession."""
def __init__(self, model: SharedModelMapping):
self.model = model
self.sa_session = model.context
def get_session_from_session_key(self, session_key: str):
FILL_FUNC_BODY | class GalaxySessionManager:
"""Manages GalaxySession."""
def __init__(self, model: SharedModelMapping):
self.model = model
self.sa_session = model.context
def get_session_from_session_key(self, session_key: str):
"""Returns GalaxySession if session_key is valid."""
FILL_FUNC_BODY | # going through self.model since this can be used by Galaxy or Toolshed despite
# type annotations
stmt = (
select(self.model.GalaxySession)
.where(self.model.GalaxySession.session_key == session_key)
.where(self.model.GalaxySession.is_valid == true())
... | """Returns GalaxySession if session_key is valid."""
# going through self.model since this can be used by Galaxy or Toolshed despite
# type annotations
stmt = (
select(self.model.GalaxySession)
.where(self.model.GalaxySession.session_key == session_key)
... | 32 | 93 | 138 | 231 | import logging
from sqlalchemy import (
select,
true,
)
from sqlalchemy.orm import joinedload
from galaxy.model.base import SharedModelMapping
log = logging.getLogger(__name__)
class GalaxySessionManager:
"""Manages GalaxySession."""
def __init__(self, model: SharedModelMapping):
self.mode... | import logging
from sqlalchemy import (
select,
true,
)
from sqlalchemy.orm import joinedload
from galaxy.model.base import SharedModelMapping
log = logging.getLogger(__name__)
class GalaxySessionManager:
"""Manages GalaxySession."""
def __init__(self, model: SharedModelMapping):
self.mode... |
45,832 | /home/hieuvd/dung_repo/raw/stars_03/galaxyproject_galaxy/galaxy | /home/hieuvd/dung_repo/raw/stars_03/galaxyproject_galaxy/galaxy/lib/galaxy/managers/sharable.py | 466,467 | 456,519 | add_deserializers | SharableModelDeserializer | 467,480 | 467,480 | class SharableModelDeserializer(
base.ModelDeserializer,
taggable.TaggableDeserializerMixin,
annotatable.AnnotatableDeserializerMixin,
ratable.RatableDeserializerMixin,
):
def __init__(self, app: MinimalManagerApp, **kwargs):
super().__init__(app, **kwargs)
self.tag_handler = app.tag... | class SharableModelDeserializer(
base.ModelDeserializer,
taggable.TaggableDeserializerMixin,
annotatable.AnnotatableDeserializerMixin,
ratable.RatableDeserializerMixin,
):
def __init__(self, app: MinimalManagerApp, **kwargs):
super().__init__(app, **kwargs)
self.tag_handler = app.tag... | super().add_deserializers()
taggable.TaggableDeserializerMixin.add_deserializers(self)
annotatable.AnnotatableDeserializerMixin.add_deserializers(self)
ratable.RatableDeserializerMixin.add_deserializers(self)
self.deserializers.update(
{
"published": ... | super().add_deserializers()
taggable.TaggableDeserializerMixin.add_deserializers(self)
annotatable.AnnotatableDeserializerMixin.add_deserializers(self)
ratable.RatableDeserializerMixin.add_deserializers(self)
self.deserializers.update(
{
"published": ... | 14 | 555 | 159 | 714 | """
Superclass Manager and Serializers for Sharable objects.
A sharable Galaxy object:
has an owner/creator User
is sharable with other, specific Users
is importable (copyable) by users that have access
has a slug which can be used as a link to view the resource
can be published effectively making ... | """
Superclass Manager and Serializers for Sharable objects.
A sharable Galaxy object:
has an owner/creator User
is sharable with other, specific Users
is importable (copyable) by users that have access
has a slug which can be used as a link to view the resource
can be published effectively making ... |
45,833 | /home/hieuvd/dung_repo/raw/stars_03/galaxyproject_galaxy/galaxy | /home/hieuvd/dung_repo/raw/stars_03/galaxyproject_galaxy/galaxy/lib/galaxy/managers/sharable.py | 522,523 | 519,539 | _add_parsers | SharableModelFilters | 523,539 | 523,539 | class SharableModelFilters(
base.ModelFilterParser, taggable.TaggableFilterMixin, annotatable.AnnotatableFilterMixin, ratable.RatableFilterMixin
):
def _add_parsers(self):
FILL_FUNC_BODY | class SharableModelFilters(
base.ModelFilterParser, taggable.TaggableFilterMixin, annotatable.AnnotatableFilterMixin, ratable.RatableFilterMixin
):
def _add_parsers(self):
FILL_FUNC_BODY | super()._add_parsers()
taggable.TaggableFilterMixin._add_parsers(self)
annotatable.AnnotatableFilterMixin._add_parsers(self)
ratable.RatableFilterMixin._add_parsers(self)
self.orm_filter_parsers.update(
{
"importable": {"op": ("eq"), "val": base.parse... | super()._add_parsers()
taggable.TaggableFilterMixin._add_parsers(self)
annotatable.AnnotatableFilterMixin._add_parsers(self)
ratable.RatableFilterMixin._add_parsers(self)
self.orm_filter_parsers.update(
{
"importable": {"op": ("eq"), "val": base.parse... | 51 | 70 | 228 | 298 | """
Superclass Manager and Serializers for Sharable objects.
A sharable Galaxy object:
has an owner/creator User
is sharable with other, specific Users
is importable (copyable) by users that have access
has a slug which can be used as a link to view the resource
can be published effectively making ... | """
Superclass Manager and Serializers for Sharable objects.
A sharable Galaxy object:
has an owner/creator User
is sharable with other, specific Users
is importable (copyable) by users that have access
has a slug which can be used as a link to view the resource
can be published effectively making ... |
45,835 | /home/hieuvd/dung_repo/raw/stars_03/galaxyproject_galaxy/galaxy | /home/hieuvd/dung_repo/raw/stars_03/galaxyproject_galaxy/galaxy/lib/galaxy/managers/sharable.py | 441,442 | 375,456 | serialize_users_shared_with | SharableModelSerializer | 447,456 | 442,456 | class SharableModelSerializer(
base.ModelSerializer,
taggable.TaggableSerializerMixin,
annotatable.AnnotatableSerializerMixin,
ratable.RatableSerializerMixin,
):
# TODO: stub
SINGLE_CHAR_ABBR: Optional[str] = None
def __init__(self, app, **kwargs):
super().__init__(app, **kwargs)
... | class SharableModelSerializer(
base.ModelSerializer,
taggable.TaggableSerializerMixin,
annotatable.AnnotatableSerializerMixin,
ratable.RatableSerializerMixin,
):
# TODO: stub
SINGLE_CHAR_ABBR: Optional[str] = None
def __init__(self, app, **kwargs):
super().__init__(app, **kwargs)
... | # TODO: still an open question as to whether key removal based on user
# should be handled here or at a higher level (even if we didn't have to pass user (via thread context, etc.))
if not self.manager.is_owner(item, user):
self.skip()
share_assocs = self.manager.get_share_a... | """
Returns a list of encoded ids for users the item has been shared.
Skipped if the requesting user is not the owner.
"""
# TODO: still an open question as to whether key removal based on user
# should be handled here or at a higher level (even if we didn't have to pass... | 51 | 743 | 128 | 871 | """
Superclass Manager and Serializers for Sharable objects.
A sharable Galaxy object:
has an owner/creator User
is sharable with other, specific Users
is importable (copyable) by users that have access
has a slug which can be used as a link to view the resource
can be published effectively making ... | """
Superclass Manager and Serializers for Sharable objects.
A sharable Galaxy object:
has an owner/creator User
is sharable with other, specific Users
is importable (copyable) by users that have access
has a slug which can be used as a link to view the resource
can be published effectively making ... |
45,836 | /home/hieuvd/dung_repo/raw/stars_03/galaxyproject_galaxy/galaxy | /home/hieuvd/dung_repo/raw/stars_03/galaxyproject_galaxy/galaxy/lib/galaxy/managers/sharable.py | 542,543 | 539,584 | create_item_slug | SlugBuilder | 553,584 | 543,584 | class SlugBuilder:
"""Builder for creating slugs out of items."""
def create_item_slug(self, sa_session, item) -> bool:
FILL_FUNC_BODY | class SlugBuilder:
"""Builder for creating slugs out of items."""
def create_item_slug(self, sa_session, item) -> bool:
"""Create/set item slug.
Slug is unique among user's importable items for item's class.
:param sa_session: Database session context.
:param item: The item to... | cur_slug = item.slug
# Setup slug base.
if cur_slug is None or cur_slug == "":
# Item can have either a name or a title.
item_name = ""
if hasattr(item, "name"):
item_name = item.name
elif hasattr(item, "title"):
it... | """Create/set item slug.
Slug is unique among user's importable items for item's class.
:param sa_session: Database session context.
:param item: The item to create/update its slug.
:type item: [type]
:return: Returns true if item's slug was set/changed; false otherwise... | 146 | 150 | 373 | 523 | """
Superclass Manager and Serializers for Sharable objects.
A sharable Galaxy object:
has an owner/creator User
is sharable with other, specific Users
is importable (copyable) by users that have access
has a slug which can be used as a link to view the resource
can be published effectively making ... | """
Superclass Manager and Serializers for Sharable objects.
A sharable Galaxy object:
has an owner/creator User
is sharable with other, specific Users
is importable (copyable) by users that have access
has a slug which can be used as a link to view the resource
can be published effectively making ... |
45,837 | /home/hieuvd/dung_repo/raw/stars_03/galaxyproject_galaxy/galaxy | /home/hieuvd/dung_repo/raw/stars_03/galaxyproject_galaxy/galaxy/lib/galaxy/managers/taggable.py | 28,29 | 1,108 | _tag_str_gen | 29,37 | 29,37 | """
Mixins for Taggable model managers and serializers.
"""
# from galaxy import exceptions as galaxy_exceptions
import logging
import re
from typing import Optional
from sqlalchemy import (
func,
sql,
)
from galaxy import model
from galaxy.managers.context import ProvidesUserContext
from galaxy.model.tags ... | """
Mixins for Taggable model managers and serializers.
"""
# from galaxy import exceptions as galaxy_exceptions
import logging
import re
from typing import Optional
from sqlalchemy import (
func,
sql,
)
from galaxy import model
from galaxy.managers.context import ProvidesUserContext
from galaxy.model.tags ... | # TODO: which user is this? all?
for tag in item.tags:
tag_str = tag.user_tname
if tag.value is not None:
tag_str += f":{tag.user_value}"
yield tag_str
| # TODO: which user is this? all?
for tag in item.tags:
tag_str = tag.user_tname
if tag.value is not None:
tag_str += f":{tag.user_value}"
yield tag_str
| 24 | 1,013 | 74 | 1,087 | """
Mixins for Taggable model managers and serializers.
"""
# from galaxy import exceptions as galaxy_exceptions
import logging
import re
from typing import Optional
from sqlalchemy import (
func,
sql,
)
from galaxy import model
from galaxy.managers.context import ProvidesUserContext
from galaxy.model.tags ... | """
Mixins for Taggable model managers and serializers.
"""
# from galaxy import exceptions as galaxy_exceptions
import logging
import re
from typing import Optional
from sqlalchemy import (
func,
sql,
)
from galaxy import model
from galaxy.managers.context import ProvidesUserContext
from galaxy.model.tags ... | |
45,838 | /home/hieuvd/dung_repo/raw/stars_03/galaxyproject_galaxy/galaxy | /home/hieuvd/dung_repo/raw/stars_03/galaxyproject_galaxy/galaxy/lib/galaxy/managers/taggable.py | 63,66 | 56,76 | deserialize_tags | TaggableDeserializerMixin | 71,76 | 66,76 | class TaggableDeserializerMixin:
tag_handler: GalaxyTagHandler
validate: ModelValidator
def add_deserializers(self):
self.deserializers["tags"] = self.deserialize_tags
def deserialize_tags(
self, item, key, val, *, user: Optional[model.User] = None, trans: ProvidesUserContext, **contex... | class TaggableDeserializerMixin:
tag_handler: GalaxyTagHandler
validate: ModelValidator
def add_deserializers(self):
self.deserializers["tags"] = self.deserialize_tags
def deserialize_tags(
self, item, key, val, *, user: Optional[model.User] = None, trans: ProvidesUserContext, **contex... | new_tags_list = self.validate.basestring_list(key, val)
trans.tag_handler.set_tags_from_list(user=user, item=item, new_tags_list=new_tags_list)
return item.tags
| """
Make sure `val` is a valid list of tag strings and assign them.
Note: this will erase any previous tags.
"""
new_tags_list = self.validate.basestring_list(key, val)
trans.tag_handler.set_tags_from_list(user=user, item=item, new_tags_list=new_tags_list)
return... | 9 | 149 | 71 | 220 | """
Mixins for Taggable model managers and serializers.
"""
# from galaxy import exceptions as galaxy_exceptions
import logging
import re
from typing import Optional
from sqlalchemy import (
func,
sql,
)
from galaxy import model
from galaxy.managers.context import ProvidesUserContext
from galaxy.model.tags ... | """
Mixins for Taggable model managers and serializers.
"""
# from galaxy import exceptions as galaxy_exceptions
import logging
import re
from typing import Optional
from sqlalchemy import (
func,
sql,
)
from galaxy import model
from galaxy.managers.context import ProvidesUserContext
from galaxy.model.tags ... |
45,839 | /home/hieuvd/dung_repo/raw/stars_03/galaxyproject_galaxy/galaxy | /home/hieuvd/dung_repo/raw/stars_03/galaxyproject_galaxy/galaxy/lib/galaxy/managers/taggable.py | 80,81 | 76,108 | _create_tag_filter | TaggableFilterMixin | 81,104 | 81,104 | class TaggableFilterMixin:
valid_ops = ("eq", "contains", "has")
def create_tag_filter(self, attr, op, val):
def _create_tag_filter(model_class=None):
FILL_FUNC_BODY return _create_tag_filter
def _add_parsers(self):
self.orm_filter_parsers.update({"tag": self.create_tag_filter})
| class TaggableFilterMixin:
valid_ops = ("eq", "contains", "has")
def create_tag_filter(self, attr, op, val):
def _create_tag_filter(model_class=None):
FILL_FUNC_BODY return _create_tag_filter
def _add_parsers(self):
self.orm_filter_parsers.update({"tag": self.create_tag_filter})
| if op not in TaggableFilterMixin.valid_ops:
raise_filter_err(attr, op, val, "bad op in filter")
if model_class is None:
return True
class_name = model_class.__name__
if class_name == "HistoryDatasetCollectionAssociation":
# ... | if op not in TaggableFilterMixin.valid_ops:
raise_filter_err(attr, op, val, "bad op in filter")
if model_class is None:
return True
class_name = model_class.__name__
if class_name == "HistoryDatasetCollectionAssociation":
# ... | 115 | 115 | 394 | 509 | """
Mixins for Taggable model managers and serializers.
"""
# from galaxy import exceptions as galaxy_exceptions
import logging
import re
from typing import Optional
from sqlalchemy import (
func,
sql,
)
from galaxy import model
from galaxy.managers.context import ProvidesUserContext
from galaxy.model.tags ... | """
Mixins for Taggable model managers and serializers.
"""
# from galaxy import exceptions as galaxy_exceptions
import logging
import re
from typing import Optional
from sqlalchemy import (
func,
sql,
)
from galaxy import model
from galaxy.managers.context import ProvidesUserContext
from galaxy.model.tags ... |
45,840 | /home/hieuvd/dung_repo/raw/stars_03/galaxyproject_galaxy/galaxy | /home/hieuvd/dung_repo/raw/stars_03/galaxyproject_galaxy/galaxy/lib/galaxy/managers/taggable.py | 46,47 | 45,56 | add_serializers | TaggableSerializerMixin | 47,49 | 47,49 | class TaggableSerializerMixin:
def add_serializers(self):
FILL_FUNC_BODY def serialize_tags(self, item, key, **context):
"""
Return tags as a list of strings.
"""
return _tags_to_strings(item)
| class TaggableSerializerMixin:
def add_serializers(self):
FILL_FUNC_BODY def serialize_tags(self, item, key, **context):
"""
Return tags as a list of strings.
"""
return _tags_to_strings(item)
| self.serializers["tags"] = self.serialize_tags
| self.serializers["tags"] = self.serialize_tags
| 3 | 76 | 19 | 95 | """
Mixins for Taggable model managers and serializers.
"""
# from galaxy import exceptions as galaxy_exceptions
import logging
import re
from typing import Optional
from sqlalchemy import (
func,
sql,
)
from galaxy import model
from galaxy.managers.context import ProvidesUserContext
from galaxy.model.tags ... | """
Mixins for Taggable model managers and serializers.
"""
# from galaxy import exceptions as galaxy_exceptions
import logging
import re
from typing import Optional
from sqlalchemy import (
func,
sql,
)
from galaxy import model
from galaxy.managers.context import ProvidesUserContext
from galaxy.model.tags ... |
45,841 | /home/hieuvd/dung_repo/raw/stars_03/galaxyproject_galaxy/galaxy | /home/hieuvd/dung_repo/raw/stars_03/galaxyproject_galaxy/galaxy/lib/galaxy/managers/tags.py | 47,48 | 44,66 | update | TagsManager | 49,59 | 48,59 | class TagsManager:
"""Interface/service object shared by controllers for interacting with tags."""
def update(self, trans: ProvidesUserContext, payload: ItemTagsPayload) -> None:
FILL_FUNC_BODY def _get_item(self, tag_handler: GalaxyTagHandlerSession, payload: ItemTagsPayload):
"""
Get an it... | class TagsManager:
"""Interface/service object shared by controllers for interacting with tags."""
def update(self, trans: ProvidesUserContext, payload: ItemTagsPayload) -> None:
"""Apply a new set of tags to an item; previous tags are deleted."""
FILL_FUNC_BODY def _get_item(self, tag_handler: Gala... | user = trans.user
new_tags: Optional[str] = None
if payload.item_tags and len(payload.item_tags.root) > 0:
new_tags = ",".join(payload.item_tags.root)
item = self._get_item(trans.tag_handler, payload)
trans.tag_handler.delete_item_tags(user, item)
trans.tag_ha... | """Apply a new set of tags to an item; previous tags are deleted."""
user = trans.user
new_tags: Optional[str] = None
if payload.item_tags and len(payload.item_tags.root) > 0:
new_tags = ",".join(payload.item_tags.root)
item = self._get_item(trans.tag_handler, payload... | 28 | 187 | 152 | 339 | from enum import Enum
from typing import Optional
from pydantic import Field
from galaxy.managers.context import ProvidesUserContext
from galaxy.model.base import transaction
from galaxy.model.tags import GalaxyTagHandlerSession
from galaxy.schema.fields import DecodedDatabaseIdField
from galaxy.schema.schema import ... | from enum import Enum
from typing import Optional
from pydantic import Field
from galaxy.managers.context import ProvidesUserContext
from galaxy.model.base import transaction
from galaxy.model.tags import GalaxyTagHandlerSession
from galaxy.schema.fields import DecodedDatabaseIdField
from galaxy.schema.schema import ... |
45,842 | /home/hieuvd/dung_repo/raw/stars_03/galaxyproject_galaxy/galaxy | /home/hieuvd/dung_repo/raw/stars_03/galaxyproject_galaxy/galaxy/lib/galaxy/managers/tasks.py | 39,40 | 31,56 | is_pending | AsyncTasksManager | 41,43 | 40,43 | class AsyncTasksManager(metaclass=ABCMeta):
@abstractmethod
def is_ready(self, task_uuid: UUID) -> bool:
"""Return `True` if the task has executed.
If the task is still running, pending, or is waiting for retry then `False` is returned.
"""
def is_pending(self, task_uuid: UUID) -> ... | class AsyncTasksManager(metaclass=ABCMeta):
@abstractmethod
def is_ready(self, task_uuid: UUID) -> bool:
"""Return `True` if the task has executed.
If the task is still running, pending, or is waiting for retry then `False` is returned.
"""
def is_pending(self, task_uuid: UUID) -> ... | return not self.is_ready(task_uuid)
| """Return `True` if the task is not done yet."""
return not self.is_ready(task_uuid)
| 3 | 246 | 17 | 263 | from abc import (
ABCMeta,
abstractmethod,
)
from enum import Enum
from typing import cast
from uuid import UUID
from celery.result import AsyncResult
class TaskState(str, Enum):
"""Enum representing the possible states of a task."""
PENDING = "PENDING"
"""The task is waiting for execution."""
... | from abc import (
ABCMeta,
abstractmethod,
)
from enum import Enum
from typing import cast
from uuid import UUID
from celery.result import AsyncResult
class TaskState(str, Enum):
"""Enum representing the possible states of a task."""
PENDING = "PENDING"
"""The task is waiting for execution."""
... |
45,843 | /home/hieuvd/dung_repo/raw/stars_03/galaxyproject_galaxy/galaxy | /home/hieuvd/dung_repo/raw/stars_03/galaxyproject_galaxy/galaxy/lib/galaxy/managers/tasks.py | 70,71 | 56,80 | has_failed | CeleryAsyncTasksManager | 72,74 | 71,74 | class CeleryAsyncTasksManager(AsyncTasksManager):
"""Thin wrapper around Celery tasks AsyncResult queries."""
def is_ready(self, task_uuid: UUID) -> bool:
"""Return `True` if the task has executed.
If the task is still running, pending, or is waiting for retry then `False` is returned.
... | class CeleryAsyncTasksManager(AsyncTasksManager):
"""Thin wrapper around Celery tasks AsyncResult queries."""
def is_ready(self, task_uuid: UUID) -> bool:
"""Return `True` if the task has executed.
If the task is still running, pending, or is waiting for retry then `False` is returned.
... | return self._get_result(task_uuid).failed()
| """Return `True` if the task failed."""
return self._get_result(task_uuid).failed()
| 2 | 285 | 18 | 303 | from abc import (
ABCMeta,
abstractmethod,
)
from enum import Enum
from typing import cast
from uuid import UUID
from celery.result import AsyncResult
class TaskState(str, Enum):
"""Enum representing the possible states of a task."""
PENDING = "PENDING"
"""The task is waiting for execution."""
... | from abc import (
ABCMeta,
abstractmethod,
)
from enum import Enum
from typing import cast
from uuid import UUID
from celery.result import AsyncResult
class TaskState(str, Enum):
"""Enum representing the possible states of a task."""
PENDING = "PENDING"
"""The task is waiting for execution."""
... |
45,844 | /home/hieuvd/dung_repo/raw/stars_03/galaxyproject_galaxy/galaxy | /home/hieuvd/dung_repo/raw/stars_03/galaxyproject_galaxy/galaxy/lib/galaxy/managers/tool_data.py | 138,139 | 110,149 | import_data_bundle_by_dataset | ToolDataImportManager | 139,149 | 139,149 | class ToolDataImportManager:
file_sources: ConfiguredFileSources
tool_data_tables: ToolDataTableManager
def __init__(self, app: MinimalManagerApp):
self.file_sources = app.file_sources
self.tool_data_tables = app.tool_data_tables
def import_data_bundle_by_uri(self, config, uri: str, to... | class ToolDataImportManager:
file_sources: ConfiguredFileSources
tool_data_tables: ToolDataTableManager
def __init__(self, app: MinimalManagerApp):
self.file_sources = app.file_sources
self.tool_data_tables = app.tool_data_tables
def import_data_bundle_by_uri(self, config, uri: str, to... | options = BundleProcessingOptions(
what="data import", # An alternative to this is sticking this in the bundle, only used for logging.
data_manager_path=config.galaxy_data_manager_data_path,
target_config_file=config.data_manager_config_file,
tool_data_file_path=... | options = BundleProcessingOptions(
what="data import", # An alternative to this is sticking this in the bundle, only used for logging.
data_manager_path=config.galaxy_data_manager_data_path,
target_config_file=config.data_manager_config_file,
tool_data_file_path=... | 28 | 347 | 138 | 485 | from pathlib import Path
from typing import (
cast,
Dict,
Optional,
)
from galaxy import exceptions
from galaxy.files import ConfiguredFileSources
from galaxy.files.uris import stream_url_to_file
from galaxy.model import DatasetInstance
from galaxy.structured_app import (
MinimalManagerApp,
Structu... | from pathlib import Path
from typing import (
cast,
Dict,
Optional,
)
from galaxy import exceptions
from galaxy.files import ConfiguredFileSources
from galaxy.files.uris import stream_url_to_file
from galaxy.model import DatasetInstance
from galaxy.structured_app import (
MinimalManagerApp,
Structu... |
45,845 | /home/hieuvd/dung_repo/raw/stars_03/galaxyproject_galaxy/galaxy | /home/hieuvd/dung_repo/raw/stars_03/galaxyproject_galaxy/galaxy/lib/galaxy/managers/tool_data.py | 74,75 | 32,110 | delete | ToolDataManager | 76,90 | 75,90 | class ToolDataManager:
"""
Interface/service object for interacting with tool data.
"""
def __init__(self, app: StructuredApp):
self._app = app
@property
def data_tables(self) -> Dict[str, ToolDataTable]:
return self._app.tool_data_tables.data_tables
def index(self) -> Too... | class ToolDataManager:
"""
Interface/service object for interacting with tool data.
"""
def __init__(self, app: StructuredApp):
self._app = app
@property
def data_tables(self) -> Dict[str, ToolDataTable]:
return self._app.tool_data_tables.data_tables
def index(self) -> Too... | data_table = self._tabular_data_table(table_name)
if not values:
raise exceptions.RequestParameterInvalidException("Invalid values for data table item specified.")
split_values = values.split("\t")
if len(split_values) != len(data_table.get_column_name_list()):
... | """Removes an item from a data table"""
data_table = self._tabular_data_table(table_name)
if not values:
raise exceptions.RequestParameterInvalidException("Invalid values for data table item specified.")
split_values = values.split("\t")
if len(split_values) != len(... | 43 | 856 | 190 | 1,046 | from pathlib import Path
from typing import (
cast,
Dict,
Optional,
)
from galaxy import exceptions
from galaxy.files import ConfiguredFileSources
from galaxy.files.uris import stream_url_to_file
from galaxy.model import DatasetInstance
from galaxy.structured_app import (
MinimalManagerApp,
Structu... | from pathlib import Path
from typing import (
cast,
Dict,
Optional,
)
from galaxy import exceptions
from galaxy.files import ConfiguredFileSources
from galaxy.files.uris import stream_url_to_file
from galaxy.model import DatasetInstance
from galaxy.structured_app import (
MinimalManagerApp,
Structu... |
45,847 | /home/hieuvd/dung_repo/raw/stars_03/galaxyproject_galaxy/galaxy | /home/hieuvd/dung_repo/raw/stars_03/galaxyproject_galaxy/galaxy/lib/galaxy/model/base.py | 122,124 | 81,150 | set_request_id | ModelMapping | 124,129 | 124,129 | class ModelMapping(Bunch):
def __init__(self, model_modules, engine):
self.engine = engine
self._SessionLocal = sessionmaker(autoflush=False)
versioned_session(self._SessionLocal)
context = scoped_session(self._SessionLocal, scopefunc=self.request_scopefunc)
# For backward co... | class ModelMapping(Bunch):
def __init__(self, model_modules, engine):
self.engine = engine
self._SessionLocal = sessionmaker(autoflush=False)
versioned_session(self._SessionLocal)
context = scoped_session(self._SessionLocal, scopefunc=self.request_scopefunc)
# For backward co... | # Set REQUEST_ID to a new dict.
# This new ContextVar value will only be seen by the current asyncio context
# and descendant threadpools, but not other threads or asyncio contexts.
return REQUEST_ID.set({"request": request_id})
| # Set REQUEST_ID to a new dict.
# This new ContextVar value will only be seen by the current asyncio context
# and descendant threadpools, but not other threads or asyncio contexts.
return REQUEST_ID.set({"request": request_id})
| 35 | 616 | 73 | 689 | """
Shared model and mapping code between Galaxy and Tool Shed, trying to
generalize to generic database connections.
"""
import contextlib
import logging
import os
import threading
from contextvars import ContextVar
from inspect import (
getmembers,
isclass,
)
from typing import (
Dict,
Type,
TYPE... | """
Shared model and mapping code between Galaxy and Tool Shed, trying to
generalize to generic database connections.
"""
import contextlib
import logging
import os
import threading
from contextvars import ContextVar
from inspect import (
getmembers,
isclass,
)
from typing import (
Dict,
Type,
TYPE... |
45,848 | /home/hieuvd/dung_repo/raw/stars_03/galaxyproject_galaxy/galaxy | /home/hieuvd/dung_repo/raw/stars_03/galaxyproject_galaxy/galaxy/lib/galaxy/model/database_heartbeat.py | 101,102 | 19,115 | send_database_heartbeat | DatabaseHeartbeat | 102,107 | 102,107 | class DatabaseHeartbeat:
def __init__(self, application_stack, heartbeat_interval=60):
self.application_stack = application_stack
self.new_session = self.application_stack.app.model.new_session
self.heartbeat_interval = heartbeat_interval
self.hostname = socket.gethostname()
... | class DatabaseHeartbeat:
def __init__(self, application_stack, heartbeat_interval=60):
self.application_stack = application_stack
self.new_session = self.application_stack.app.model.new_session
self.heartbeat_interval = heartbeat_interval
self.hostname = socket.gethostname()
... | if self.active:
while not self.exit.is_set():
self.update_watcher_designation()
self.exit.wait(self.heartbeat_interval)
| if self.active:
while not self.exit.is_set():
self.update_watcher_designation()
self.exit.wait(self.heartbeat_interval)
| 7 | 1,092 | 52 | 1,144 | import datetime
import logging
import os
import socket
import threading
from sqlalchemy import (
and_,
delete,
select,
)
from galaxy.model import WorkerProcess
from galaxy.model.orm.now import now
log = logging.getLogger(__name__)
class DatabaseHeartbeat:
def __init__(self, application_stack, heart... | import datetime
import logging
import os
import socket
import threading
from sqlalchemy import (
and_,
delete,
select,
)
from galaxy.model import WorkerProcess
from galaxy.model.orm.now import now
log = logging.getLogger(__name__)
class DatabaseHeartbeat:
def __init__(self, application_stack, heart... |
45,849 | /home/hieuvd/dung_repo/raw/stars_03/galaxyproject_galaxy/galaxy | /home/hieuvd/dung_repo/raw/stars_03/galaxyproject_galaxy/galaxy/lib/galaxy/model/database_object_names.py | 35,36 | 1,46 | build_check_constraint_name | 36,39 | 36,39 | """
Naming convention and helper functions for generating names of database
constraints and indexes.
"""
from typing import (
List,
Union,
)
from galaxy.util import listify
# Naming convention applied to database constraints and indexes.
# All except "ix" are conventions used by PostgreSQL by default.
# We k... | """
Naming convention and helper functions for generating names of database
constraints and indexes.
"""
from typing import (
List,
Union,
)
from galaxy.util import listify
# Naming convention applied to database constraints and indexes.
# All except "ix" are conventions used by PostgreSQL by default.
# We k... | return f"{table_name}_{column_name}_check"
| return f"{table_name}_{column_name}_check"
| 2 | 472 | 21 | 493 | """
Naming convention and helper functions for generating names of database
constraints and indexes.
"""
from typing import (
List,
Union,
)
from galaxy.util import listify
# Naming convention applied to database constraints and indexes.
# All except "ix" are conventions used by PostgreSQL by default.
# We k... | """
Naming convention and helper functions for generating names of database
constraints and indexes.
"""
from typing import (
List,
Union,
)
from galaxy.util import listify
# Naming convention applied to database constraints and indexes.
# All except "ix" are conventions used by PostgreSQL by default.
# We k... | |
45,850 | /home/hieuvd/dung_repo/raw/stars_03/galaxyproject_galaxy/galaxy | /home/hieuvd/dung_repo/raw/stars_03/galaxyproject_galaxy/galaxy/lib/galaxy/model/dataset_collections/builder.py | 19,20 | 1,132 | set_collection_elements | 20,38 | 20,38 | from galaxy import model
from galaxy.model.orm.util import add_object_to_object_session
from galaxy.util.oset import OrderedSet
from .type_description import COLLECTION_TYPE_DESCRIPTION_FACTORY
def build_collection(type, dataset_instances, collection=None, associated_identifiers=None):
"""
Build DatasetCollec... | from galaxy import model
from galaxy.model.orm.util import add_object_to_object_session
from galaxy.util.oset import OrderedSet
from .type_description import COLLECTION_TYPE_DESCRIPTION_FACTORY
def build_collection(type, dataset_instances, collection=None, associated_identifiers=None):
"""
Build DatasetCollec... | new_element_keys = OrderedSet(dataset_instances.keys()) - associated_identifiers
new_dataset_instances = {k: dataset_instances[k] for k in new_element_keys}
dataset_collection.element_count = dataset_collection.element_count or 0
element_index = dataset_collection.element_count
elements = []
for... | new_element_keys = OrderedSet(dataset_instances.keys()) - associated_identifiers
new_dataset_instances = {k: dataset_instances[k] for k in new_element_keys}
dataset_collection.element_count = dataset_collection.element_count or 0
element_index = dataset_collection.element_count
elements = []
for... | 46 | 1,195 | 217 | 1,412 | from galaxy import model
from galaxy.model.orm.util import add_object_to_object_session
from galaxy.util.oset import OrderedSet
from .type_description import COLLECTION_TYPE_DESCRIPTION_FACTORY
def build_collection(type, dataset_instances, collection=None, associated_identifiers=None):
"""
Build DatasetCollec... | from galaxy import model
from galaxy.model.orm.util import add_object_to_object_session
from galaxy.util.oset import OrderedSet
from .type_description import COLLECTION_TYPE_DESCRIPTION_FACTORY
def build_collection(type, dataset_instances, collection=None, associated_identifiers=None):
"""
Build DatasetCollec... | |
45,851 | /home/hieuvd/dung_repo/raw/stars_03/galaxyproject_galaxy/galaxy | /home/hieuvd/dung_repo/raw/stars_03/galaxyproject_galaxy/galaxy/lib/galaxy/model/dataset_collections/builder.py | 124,125 | 113,132 | populate_partial | BoundCollectionBuilder | 125,129 | 125,129 | class BoundCollectionBuilder(CollectionBuilder):
"""More stateful builder that is bound to a particular model object."""
def __init__(self, dataset_collection):
self.dataset_collection = dataset_collection
if dataset_collection.populated:
raise Exception("Cannot reset elements of an... | class BoundCollectionBuilder(CollectionBuilder):
"""More stateful builder that is bound to a particular model object."""
def __init__(self, dataset_collection):
self.dataset_collection = dataset_collection
if dataset_collection.populated:
raise Exception("Cannot reset elements of an... | elements = self.build_elements()
type_plugin = self._collection_type_description.rank_type_plugin()
set_collection_elements(self.dataset_collection, type_plugin, elements, self.associated_identifiers)
| elements = self.build_elements()
type_plugin = self._collection_type_description.rank_type_plugin()
set_collection_elements(self.dataset_collection, type_plugin, elements, self.associated_identifiers)
| 10 | 187 | 63 | 250 | from galaxy import model
from galaxy.model.orm.util import add_object_to_object_session
from galaxy.util.oset import OrderedSet
from .type_description import COLLECTION_TYPE_DESCRIPTION_FACTORY
def build_collection(type, dataset_instances, collection=None, associated_identifiers=None):
"""
Build DatasetCollec... | from galaxy import model
from galaxy.model.orm.util import add_object_to_object_session
from galaxy.util.oset import OrderedSet
from .type_description import COLLECTION_TYPE_DESCRIPTION_FACTORY
def build_collection(type, dataset_instances, collection=None, associated_identifiers=None):
"""
Build DatasetCollec... |
45,852 | /home/hieuvd/dung_repo/raw/stars_03/galaxyproject_galaxy/galaxy | /home/hieuvd/dung_repo/raw/stars_03/galaxyproject_galaxy/galaxy/lib/galaxy/model/dataset_collections/builder.py | 85,86 | 38,113 | build_elements | CollectionBuilder | 86,96 | 86,96 | class CollectionBuilder:
"""Purely functional builder pattern for building a dataset collection."""
def __init__(self, collection_type_description):
self._collection_type_description = collection_type_description
self._current_elements = {}
# Store collection here so we don't recreate t... | class CollectionBuilder:
"""Purely functional builder pattern for building a dataset collection."""
def __init__(self, collection_type_description):
self._collection_type_description = collection_type_description
self._current_elements = {}
# Store collection here so we don't recreate t... | elements = self._current_elements
if self._nested_collection:
new_elements = {}
for identifier, element in elements.items():
new_elements[identifier] = element.build()
elements = new_elements
else:
self._current_elements = {}
... | elements = self._current_elements
if self._nested_collection:
new_elements = {}
for identifier, element in elements.items():
new_elements[identifier] = element.build()
elements = new_elements
else:
self._current_elements = {}
... | 25 | 673 | 85 | 758 | from galaxy import model
from galaxy.model.orm.util import add_object_to_object_session
from galaxy.util.oset import OrderedSet
from .type_description import COLLECTION_TYPE_DESCRIPTION_FACTORY
def build_collection(type, dataset_instances, collection=None, associated_identifiers=None):
"""
Build DatasetCollec... | from galaxy import model
from galaxy.model.orm.util import add_object_to_object_session
from galaxy.util.oset import OrderedSet
from .type_description import COLLECTION_TYPE_DESCRIPTION_FACTORY
def build_collection(type, dataset_instances, collection=None, associated_identifiers=None):
"""
Build DatasetCollec... |
45,853 | /home/hieuvd/dung_repo/raw/stars_03/galaxyproject_galaxy/galaxy | /home/hieuvd/dung_repo/raw/stars_03/galaxyproject_galaxy/galaxy/lib/galaxy/model/dataset_collections/matching.py | 21,22 | 13,35 | add | CollectionsToMatch | 22,28 | 22,28 | class CollectionsToMatch:
"""Structure representing a set of collections that need to be matched up
when running tools (possibly workflows in the future as well).
"""
def __init__(self):
self.collections = {}
def add(self, input_name, hdca, subcollection_type=None, linked=True):
FILL_FUNC_... | class CollectionsToMatch:
"""Structure representing a set of collections that need to be matched up
when running tools (possibly workflows in the future as well).
"""
def __init__(self):
self.collections = {}
def add(self, input_name, hdca, subcollection_type=None, linked=True):
FILL_FUNC_... | self.collections[input_name] = bunch.Bunch(
hdca=hdca,
subcollection_type=subcollection_type,
linked=linked,
)
| self.collections[input_name] = bunch.Bunch(
hdca=hdca,
subcollection_type=subcollection_type,
linked=linked,
)
| 7 | 138 | 54 | 192 | from typing import Optional
from galaxy import exceptions
from galaxy.util import bunch
from .structure import (
get_structure,
leaf,
)
CANNOT_MATCH_ERROR_MESSAGE = "Cannot match collection types."
class CollectionsToMatch:
"""Structure representing a set of collections that need to be matched up
wh... | from typing import Optional
from galaxy import exceptions
from galaxy.util import bunch
from .structure import (
get_structure,
leaf,
)
CANNOT_MATCH_ERROR_MESSAGE = "Cannot match collection types."
class CollectionsToMatch:
"""Structure representing a set of collections that need to be matched up
wh... |
45,854 | /home/hieuvd/dung_repo/raw/stars_03/galaxyproject_galaxy/galaxy | /home/hieuvd/dung_repo/raw/stars_03/galaxyproject_galaxy/galaxy/lib/galaxy/model/dataset_collections/matching.py | 53,54 | 35,116 | __attempt_add_to_linked_match | MatchingCollections | 54,65 | 54,65 | class MatchingCollections:
"""Structure holding the result of matching a list of collections
together. This class being different than the class above and being
created in the DatasetCollectionManager layer may seem like
overkill but I suspect in the future plugins will be subtypable for
instance so... | class MatchingCollections:
"""Structure holding the result of matching a list of collections
together. This class being different than the class above and being
created in the DatasetCollectionManager layer may seem like
overkill but I suspect in the future plugins will be subtypable for
instance so... | structure = get_structure(hdca, collection_type_description, leaf_subcollection_type=subcollection_type)
if not self.linked_structure:
self.linked_structure = structure
self.collections[input_name] = hdca
self.subcollection_types[input_name] = subcollection_type
... | structure = get_structure(hdca, collection_type_description, leaf_subcollection_type=subcollection_type)
if not self.linked_structure:
self.linked_structure = structure
self.collections[input_name] = hdca
self.subcollection_types[input_name] = subcollection_type
... | 29 | 826 | 167 | 993 | from typing import Optional
from galaxy import exceptions
from galaxy.util import bunch
from .structure import (
get_structure,
leaf,
)
CANNOT_MATCH_ERROR_MESSAGE = "Cannot match collection types."
class CollectionsToMatch:
"""Structure representing a set of collections that need to be matched up
wh... | from typing import Optional
from galaxy import exceptions
from galaxy.util import bunch
from .structure import (
get_structure,
leaf,
)
CANNOT_MATCH_ERROR_MESSAGE = "Cannot match collection types."
class CollectionsToMatch:
"""Structure representing a set of collections that need to be matched up
wh... |
45,855 | /home/hieuvd/dung_repo/raw/stars_03/galaxyproject_galaxy/galaxy | /home/hieuvd/dung_repo/raw/stars_03/galaxyproject_galaxy/galaxy/lib/galaxy/model/dataset_collections/registry.py | 17,18 | 10,28 | prototype | DatasetCollectionTypesRegistry | 18,28 | 18,28 | class DatasetCollectionTypesRegistry:
def __init__(self):
self.__plugins = {p.collection_type: p() for p in PLUGIN_CLASSES}
def get(self, plugin_type):
return self.__plugins[plugin_type]
def prototype(self, plugin_type):
FILL_FUNC_BODY | class DatasetCollectionTypesRegistry:
def __init__(self):
self.__plugins = {p.collection_type: p() for p in PLUGIN_CLASSES}
def get(self, plugin_type):
return self.__plugins[plugin_type]
def prototype(self, plugin_type):
FILL_FUNC_BODY | plugin_type_object = self.get(plugin_type)
if not hasattr(plugin_type_object, "prototype_elements"):
raise Exception(f"Cannot pre-determine structure for collection of type {plugin_type}")
dataset_collection = model.DatasetCollection()
for e in plugin_type_object.prototype_e... | plugin_type_object = self.get(plugin_type)
if not hasattr(plugin_type_object, "prototype_elements"):
raise Exception(f"Cannot pre-determine structure for collection of type {plugin_type}")
dataset_collection = model.DatasetCollection()
for e in plugin_type_object.prototype_e... | 28 | 88 | 113 | 201 | from galaxy import model
from .types import (
list,
paired,
)
PLUGIN_CLASSES = [list.ListDatasetCollectionType, paired.PairedDatasetCollectionType]
class DatasetCollectionTypesRegistry:
def __init__(self):
self.__plugins = {p.collection_type: p() for p in PLUGIN_CLASSES}
def get(self, plugin... | from galaxy import model
from .types import (
list,
paired,
)
PLUGIN_CLASSES = [list.ListDatasetCollectionType, paired.PairedDatasetCollectionType]
class DatasetCollectionTypesRegistry:
def __init__(self):
self.__plugins = {p.collection_type: p() for p in PLUGIN_CLASSES}
def get(self, plugin... |
45,857 | /home/hieuvd/dung_repo/raw/stars_03/galaxyproject_galaxy/galaxy | /home/hieuvd/dung_repo/raw/stars_03/galaxyproject_galaxy/galaxy/lib/galaxy/model/dataset_collections/structure.py | 19,20 | 9,32 | clone | Leaf | 20,22 | 20,22 | class Leaf:
children_known = True
def __len__(self):
return 1
@property
def is_leaf(self):
return True
def clone(self):
FILL_FUNC_BODY def multiply(self, other_structure):
return other_structure.clone()
def sliced_collection_type(self, collection):
return i... | class Leaf:
children_known = True
def __len__(self):
return 1
@property
def is_leaf(self):
return True
def clone(self):
FILL_FUNC_BODY def multiply(self, other_structure):
return other_structure.clone()
def sliced_collection_type(self, collection):
return i... | return self
| return self
| 2 | 121 | 7 | 128 | """ Module for reasoning about structure of and matching hierarchical collections of data.
"""
import logging
log = logging.getLogger(__name__)
class Leaf:
children_known = True
def __len__(self):
return 1
@property
def is_leaf(self):
return True
def clone(self):
FILL_FUNC_BOD... | """ Module for reasoning about structure of and matching hierarchical collections of data.
"""
import logging
log = logging.getLogger(__name__)
class Leaf:
children_known = True
def __len__(self):
return 1
@property
def is_leaf(self):
return True
def clone(self):
FILL_FUNC_BOD... |
45,858 | /home/hieuvd/dung_repo/raw/stars_03/galaxyproject_galaxy/galaxy | /home/hieuvd/dung_repo/raw/stars_03/galaxyproject_galaxy/galaxy/lib/galaxy/model/dataset_collections/structure.py | 116,117 | 64,155 | can_match | Tree | 117,133 | 117,133 | class Tree(BaseTree):
children_known = True
def __init__(self, children, collection_type_description, when_values=None):
super().__init__(collection_type_description)
self.children = children
self.when_values = when_values
@staticmethod
def for_dataset_collection(dataset_collec... | class Tree(BaseTree):
children_known = True
def __init__(self, children, collection_type_description, when_values=None):
super().__init__(collection_type_description)
self.children = children
self.when_values = when_values
@staticmethod
def for_dataset_collection(dataset_collec... | if not self.collection_type_description.can_match_type(other_structure.collection_type_description):
return False
if len(self.children) != len(other_structure.children):
return False
for my_child, other_child in zip(self.children, other_structure.children):
... | if not self.collection_type_description.can_match_type(other_structure.collection_type_description):
return False
if len(self.children) != len(other_structure.children):
return False
for my_child, other_child in zip(self.children, other_structure.children):
... | 40 | 819 | 177 | 996 | """ Module for reasoning about structure of and matching hierarchical collections of data.
"""
import logging
log = logging.getLogger(__name__)
class Leaf:
children_known = True
def __len__(self):
return 1
@property
def is_leaf(self):
return True
def clone(self):
retur... | """ Module for reasoning about structure of and matching hierarchical collections of data.
"""
import logging
log = logging.getLogger(__name__)
class Leaf:
children_known = True
def __len__(self):
return 1
@property
def is_leaf(self):
return True
def clone(self):
retur... |
45,859 | /home/hieuvd/dung_repo/raw/stars_03/galaxyproject_galaxy/galaxy | /home/hieuvd/dung_repo/raw/stars_03/galaxyproject_galaxy/galaxy/lib/galaxy/model/dataset_collections/structure.py | 46,48 | 40,64 | is_leaf | UninitializedTree | 48,50 | 48,50 | class UninitializedTree(BaseTree):
children_known = False
def clone(self):
return self
@property
def is_leaf(self):
FILL_FUNC_BODY def __len__(self):
raise Exception("Unknown length")
def multiply(self, other_structure):
if other_structure.is_leaf:
return se... | class UninitializedTree(BaseTree):
children_known = False
def clone(self):
return self
@property
def is_leaf(self):
FILL_FUNC_BODY def __len__(self):
raise Exception("Unknown length")
def multiply(self, other_structure):
if other_structure.is_leaf:
return se... | return False
| return False
| 2 | 180 | 7 | 187 | """ Module for reasoning about structure of and matching hierarchical collections of data.
"""
import logging
log = logging.getLogger(__name__)
class Leaf:
children_known = True
def __len__(self):
return 1
@property
def is_leaf(self):
return True
def clone(self):
retur... | """ Module for reasoning about structure of and matching hierarchical collections of data.
"""
import logging
log = logging.getLogger(__name__)
class Leaf:
children_known = True
def __len__(self):
return 1
@property
def is_leaf(self):
return True
def clone(self):
retur... |
45,860 | /home/hieuvd/dung_repo/raw/stars_03/galaxyproject_galaxy/galaxy | /home/hieuvd/dung_repo/raw/stars_03/galaxyproject_galaxy/galaxy/lib/galaxy/model/dataset_collections/subcollections.py | 9,10 | 1,25 | _split_dataset_collection | 10,25 | 10,25 | from galaxy import exceptions
def split_dataset_collection_instance(dataset_collection_instance, collection_type):
"""Split up collection into collection."""
return _split_dataset_collection(dataset_collection_instance.collection, collection_type)
def _split_dataset_collection(dataset_collection, collection... | from galaxy import exceptions
def split_dataset_collection_instance(dataset_collection_instance, collection_type):
"""Split up collection into collection."""
return _split_dataset_collection(dataset_collection_instance.collection, collection_type)
def _split_dataset_collection(dataset_collection, collection... | this_collection_type = dataset_collection.collection_type
if not this_collection_type.endswith(collection_type) or this_collection_type == collection_type:
raise exceptions.MessageException("Cannot split collection in desired fashion.")
split_elements = []
for element in dataset_collection.elem... | this_collection_type = dataset_collection.collection_type
if not this_collection_type.endswith(collection_type) or this_collection_type == collection_type:
raise exceptions.MessageException("Cannot split collection in desired fashion.")
split_elements = []
for element in dataset_collection.elem... | 48 | 87 | 188 | 275 | from galaxy import exceptions
def split_dataset_collection_instance(dataset_collection_instance, collection_type):
"""Split up collection into collection."""
return _split_dataset_collection(dataset_collection_instance.collection, collection_type)
def _split_dataset_collection(dataset_collection, collection... | from galaxy import exceptions
def split_dataset_collection_instance(dataset_collection_instance, collection_type):
"""Split up collection into collection."""
return _split_dataset_collection(dataset_collection_instance.collection, collection_type)
def _split_dataset_collection(dataset_collection, collection... | |
45,861 | /home/hieuvd/dung_repo/raw/stars_03/galaxyproject_galaxy/galaxy | /home/hieuvd/dung_repo/raw/stars_03/galaxyproject_galaxy/galaxy/lib/galaxy/model/dataset_collections/type_description.py | 135,136 | 1,149 | map_over_collection_type | 136,148 | 136,148 | from typing import Union
from .registry import DATASET_COLLECTION_TYPES_REGISTRY
class CollectionTypeDescriptionFactory:
def __init__(self, type_registry=DATASET_COLLECTION_TYPES_REGISTRY):
# taking in type_registry though not using it, because we will someday
# I think.
self.type_registr... | from typing import Union
from .registry import DATASET_COLLECTION_TYPES_REGISTRY
class CollectionTypeDescriptionFactory:
def __init__(self, type_registry=DATASET_COLLECTION_TYPES_REGISTRY):
# taking in type_registry though not using it, because we will someday
# I think.
self.type_registr... | if hasattr(mapped_over_collection_type, "collection_type"):
mapped_over_collection_type = mapped_over_collection_type.collection_type
if not target_collection_type:
return mapped_over_collection_type
else:
if hasattr(target_collection_type, "collection_type"):
target_col... | if hasattr(mapped_over_collection_type, "collection_type"):
mapped_over_collection_type = mapped_over_collection_type.collection_type
if not target_collection_type:
return mapped_over_collection_type
else:
if hasattr(target_collection_type, "collection_type"):
target_col... | 20 | 1,668 | 139 | 1,807 | from typing import Union
from .registry import DATASET_COLLECTION_TYPES_REGISTRY
class CollectionTypeDescriptionFactory:
def __init__(self, type_registry=DATASET_COLLECTION_TYPES_REGISTRY):
# taking in type_registry though not using it, because we will someday
# I think.
self.type_registr... | from typing import Union
from .registry import DATASET_COLLECTION_TYPES_REGISTRY
class CollectionTypeDescriptionFactory:
def __init__(self, type_registry=DATASET_COLLECTION_TYPES_REGISTRY):
# taking in type_registry though not using it, because we will someday
# I think.
self.type_registr... | |
45,862 | /home/hieuvd/dung_repo/raw/stars_03/galaxyproject_galaxy/galaxy | /home/hieuvd/dung_repo/raw/stars_03/galaxyproject_galaxy/galaxy/lib/galaxy/model/dataset_collections/type_description.py | 93,94 | 17,135 | is_subcollection_of_type | CollectionTypeDescription | 94,98 | 94,98 | class CollectionTypeDescription:
"""Abstraction over dataset collection type that ties together string
reprentation in database/model with type registry.
>>> factory = CollectionTypeDescriptionFactory(None)
>>> nested_type_description = factory.for_collection_type("list:paired")
>>> paired_type_des... | class CollectionTypeDescription:
"""Abstraction over dataset collection type that ties together string
reprentation in database/model with type registry.
>>> factory = CollectionTypeDescriptionFactory(None)
>>> nested_type_description = factory.for_collection_type("list:paired")
>>> paired_type_des... | if not hasattr(other_collection_type, "collection_type"):
other_collection_type = self.collection_type_description_factory.for_collection_type(other_collection_type)
return other_collection_type.has_subcollections_of_type(self)
| if not hasattr(other_collection_type, "collection_type"):
other_collection_type = self.collection_type_description_factory.for_collection_type(other_collection_type)
return other_collection_type.has_subcollections_of_type(self)
| 9 | 1,407 | 75 | 1,482 | from typing import Union
from .registry import DATASET_COLLECTION_TYPES_REGISTRY
class CollectionTypeDescriptionFactory:
def __init__(self, type_registry=DATASET_COLLECTION_TYPES_REGISTRY):
# taking in type_registry though not using it, because we will someday
# I think.
self.type_registr... | from typing import Union
from .registry import DATASET_COLLECTION_TYPES_REGISTRY
class CollectionTypeDescriptionFactory:
def __init__(self, type_registry=DATASET_COLLECTION_TYPES_REGISTRY):
# taking in type_registry though not using it, because we will someday
# I think.
self.type_registr... |
45,863 | /home/hieuvd/dung_repo/raw/stars_03/galaxyproject_galaxy/galaxy | /home/hieuvd/dung_repo/raw/stars_03/galaxyproject_galaxy/galaxy/lib/galaxy/model/dataset_collections/type_description.py | 12,13 | 6,17 | for_collection_type | CollectionTypeDescriptionFactory | 13,17 | 13,17 | class CollectionTypeDescriptionFactory:
def __init__(self, type_registry=DATASET_COLLECTION_TYPES_REGISTRY):
# taking in type_registry though not using it, because we will someday
# I think.
self.type_registry = type_registry
def for_collection_type(self, collection_type):
FILL_FUNC_BOD... | class CollectionTypeDescriptionFactory:
def __init__(self, type_registry=DATASET_COLLECTION_TYPES_REGISTRY):
# taking in type_registry though not using it, because we will someday
# I think.
self.type_registry = type_registry
def for_collection_type(self, collection_type):
FILL_FUNC_BOD... | assert collection_type is not None
return CollectionTypeDescription(collection_type, self)
| assert collection_type is not None
return CollectionTypeDescription(collection_type, self)
| 8 | 101 | 28 | 129 | from typing import Union
from .registry import DATASET_COLLECTION_TYPES_REGISTRY
class CollectionTypeDescriptionFactory:
def __init__(self, type_registry=DATASET_COLLECTION_TYPES_REGISTRY):
# taking in type_registry though not using it, because we will someday
# I think.
self.type_registr... | from typing import Union
from .registry import DATASET_COLLECTION_TYPES_REGISTRY
class CollectionTypeDescriptionFactory:
def __init__(self, type_registry=DATASET_COLLECTION_TYPES_REGISTRY):
# taking in type_registry though not using it, because we will someday
# I think.
self.type_registr... |
45,864 | /home/hieuvd/dung_repo/raw/stars_03/galaxyproject_galaxy/galaxy | /home/hieuvd/dung_repo/raw/stars_03/galaxyproject_galaxy/galaxy/lib/galaxy/model/dataset_collections/types/list.py | 10,11 | 5,17 | generate_elements | ListDatasetCollectionType | 11,17 | 11,17 | class ListDatasetCollectionType(BaseDatasetCollectionType):
"""A flat list of named elements."""
collection_type = "list"
def generate_elements(self, elements):
FILL_FUNC_BODY | class ListDatasetCollectionType(BaseDatasetCollectionType):
"""A flat list of named elements."""
collection_type = "list"
def generate_elements(self, elements):
FILL_FUNC_BODY | for identifier, element in elements.items():
association = DatasetCollectionElement(
element=element,
element_identifier=identifier,
)
yield association
| for identifier, element in elements.items():
association = DatasetCollectionElement(
element=element,
element_identifier=identifier,
)
yield association
| 13 | 56 | 47 | 103 | from galaxy.model import DatasetCollectionElement
from . import BaseDatasetCollectionType
class ListDatasetCollectionType(BaseDatasetCollectionType):
"""A flat list of named elements."""
collection_type = "list"
def generate_elements(self, elements):
FILL_FUNC_BODY | from galaxy.model import DatasetCollectionElement
from . import BaseDatasetCollectionType
class ListDatasetCollectionType(BaseDatasetCollectionType):
"""A flat list of named elements."""
collection_type = "list"
def generate_elements(self, elements):
FILL_FUNC_BODY |
45,865 | /home/hieuvd/dung_repo/raw/stars_03/galaxyproject_galaxy/galaxy | /home/hieuvd/dung_repo/raw/stars_03/galaxyproject_galaxy/galaxy/lib/galaxy/model/index_filter_util.py | 41,42 | 1,72 | tag_filter | 42,67 | 42,67 | """Utility functions used to adapt galaxy.util.search to Galaxy model index queries."""
from typing import (
List,
Union,
)
from sqlalchemy import (
and_,
or_,
)
from sqlalchemy.orm import (
aliased,
InstrumentedAttribute,
)
from sqlalchemy.sql.expression import BinaryExpression
from galaxy i... | """Utility functions used to adapt galaxy.util.search to Galaxy model index queries."""
from typing import (
List,
Union,
)
from sqlalchemy import (
and_,
or_,
)
from sqlalchemy.orm import (
aliased,
InstrumentedAttribute,
)
from sqlalchemy.sql.expression import BinaryExpression
from galaxy i... | if ":" in term_text:
key, value = term_text.rsplit(":", 1)
if not quoted:
return and_(
assocation_model_class.user_tname.ilike(key),
assocation_model_class.user_value.ilike(f"%{value}%"),
)
else:
return and_(
... | if ":" in term_text:
key, value = term_text.rsplit(":", 1)
if not quoted:
return and_(
assocation_model_class.user_tname.ilike(key),
assocation_model_class.user_value.ilike(f"%{value}%"),
)
else:
return and_(
... | 44 | 390 | 271 | 661 | """Utility functions used to adapt galaxy.util.search to Galaxy model index queries."""
from typing import (
List,
Union,
)
from sqlalchemy import (
and_,
or_,
)
from sqlalchemy.orm import (
aliased,
InstrumentedAttribute,
)
from sqlalchemy.sql.expression import BinaryExpression
from galaxy i... | """Utility functions used to adapt galaxy.util.search to Galaxy model index queries."""
from typing import (
List,
Union,
)
from sqlalchemy import (
and_,
or_,
)
from sqlalchemy.orm import (
aliased,
InstrumentedAttribute,
)
from sqlalchemy.sql.expression import BinaryExpression
from galaxy i... | |
45,866 | /home/hieuvd/dung_repo/raw/stars_03/galaxyproject_galaxy/galaxy | /home/hieuvd/dung_repo/raw/stars_03/galaxyproject_galaxy/galaxy/lib/galaxy/model/mapping.py | 28,42 | 1,118 | init | 42,66 | 42,66 | import logging
from threading import local
from typing import (
Optional,
Type,
)
from galaxy import model
from galaxy.config import GalaxyAppConfiguration
from galaxy.model import mapper_registry
from galaxy.model.base import SharedModelMapping
from galaxy.model.orm.engine_factory import build_engine
from gal... | import logging
from threading import local
from typing import (
Optional,
Type,
)
from galaxy import model
from galaxy.config import GalaxyAppConfiguration
from galaxy.model import mapper_registry
from galaxy.model.base import SharedModelMapping
from galaxy.model.orm.engine_factory import build_engine
from gal... | # Build engine
engine = build_engine(
url,
engine_options,
database_query_profiling_proxy,
trace_logger,
slow_query_log_threshold,
thread_local_log=thread_local_log,
log_query_counts=log_query_counts,
)
# Create tables if needed
if create_tabl... | # Build engine
engine = build_engine(
url,
engine_options,
database_query_profiling_proxy,
trace_logger,
slow_query_log_threshold,
thread_local_log=thread_local_log,
log_query_counts=log_query_counts,
)
# Create tables if needed
if create_tabl... | 47 | 891 | 259 | 1,150 | import logging
from threading import local
from typing import (
Optional,
Type,
)
from galaxy import model
from galaxy.config import GalaxyAppConfiguration
from galaxy.model import mapper_registry
from galaxy.model.base import SharedModelMapping
from galaxy.model.orm.engine_factory import build_engine
from gal... | import logging
from threading import local
from typing import (
Optional,
Type,
)
from galaxy import model
from galaxy.config import GalaxyAppConfiguration
from galaxy.model import mapper_registry
from galaxy.model.base import SharedModelMapping
from galaxy.model.orm.engine_factory import build_engine
from gal... | |
45,867 | /home/hieuvd/dung_repo/raw/stars_03/galaxyproject_galaxy/galaxy | /home/hieuvd/dung_repo/raw/stars_03/galaxyproject_galaxy/galaxy/lib/galaxy/model/migrations/alembic/versions_gxy/3356bc2ecfc4_drop_view.py | 62,63 | 1,65 | downgrade | 63,65 | 63,65 | """drop view
Revision ID: 3356bc2ecfc4
Revises: 460d0ecd1dd8
Create Date: 2023-04-10 15:06:01.037416
"""
from alembic import op
# revision identifiers, used by Alembic.
revision = "3356bc2ecfc4"
down_revision = "460d0ecd1dd8"
branch_labels = None
depends_on = None
view_name = "collection_job_state_summary_view"
a... | """drop view
Revision ID: 3356bc2ecfc4
Revises: 460d0ecd1dd8
Create Date: 2023-04-10 15:06:01.037416
"""
from alembic import op
# revision identifiers, used by Alembic.
revision = "3356bc2ecfc4"
down_revision = "460d0ecd1dd8"
branch_labels = None
depends_on = None
view_name = "collection_job_state_summary_view"
a... | stmt = f"CREATE VIEW {view_name} AS {aggregate_query}"
op.execute(stmt)
| stmt = f"CREATE VIEW {view_name} AS {aggregate_query}"
op.execute(stmt)
| 8 | 801 | 33 | 834 | """drop view
Revision ID: 3356bc2ecfc4
Revises: 460d0ecd1dd8
Create Date: 2023-04-10 15:06:01.037416
"""
from alembic import op
# revision identifiers, used by Alembic.
revision = "3356bc2ecfc4"
down_revision = "460d0ecd1dd8"
branch_labels = None
depends_on = None
view_name = "collection_job_state_summary_view"
a... | """drop view
Revision ID: 3356bc2ecfc4
Revises: 460d0ecd1dd8
Create Date: 2023-04-10 15:06:01.037416
"""
from alembic import op
# revision identifiers, used by Alembic.
revision = "3356bc2ecfc4"
down_revision = "460d0ecd1dd8"
branch_labels = None
depends_on = None
view_name = "collection_job_state_summary_view"
a... | |
45,868 | /home/hieuvd/dung_repo/raw/stars_03/galaxyproject_galaxy/galaxy | /home/hieuvd/dung_repo/raw/stars_03/galaxyproject_galaxy/galaxy/lib/galaxy/model/migrations/alembic/versions_gxy/460d0ecd1dd8_.py | 21,22 | 1,29 | upgrade | 22,26 | 22,26 | """Merge head revisions
COMMENT: After merging 23.0 into dev in 0ac48236df7984ae2c74d6d0470a6b0aec8e9cc6,
the gxy branch was split at revision c29f into 2 conflicting branches, each
having 2 revisions on top of c29f. This revision merges the diverged branches
back into one branch.
Revision ID: 460d0ecd1dd8
Revises: c... | """Merge head revisions
COMMENT: After merging 23.0 into dev in 0ac48236df7984ae2c74d6d0470a6b0aec8e9cc6,
the gxy branch was split at revision c29f into 2 conflicting branches, each
having 2 revisions on top of c29f. This revision merges the diverged branches
back into one branch.
Revision ID: 460d0ecd1dd8
Revises: c... | # Intentionally empty
pass
| # Intentionally empty
pass
| 4 | 294 | 16 | 310 | """Merge head revisions
COMMENT: After merging 23.0 into dev in 0ac48236df7984ae2c74d6d0470a6b0aec8e9cc6,
the gxy branch was split at revision c29f into 2 conflicting branches, each
having 2 revisions on top of c29f. This revision merges the diverged branches
back into one branch.
Revision ID: 460d0ecd1dd8
Revises: c... | """Merge head revisions
COMMENT: After merging 23.0 into dev in 0ac48236df7984ae2c74d6d0470a6b0aec8e9cc6,
the gxy branch was split at revision c29f into 2 conflicting branches, each
having 2 revisions on top of c29f. This revision merges the diverged branches
back into one branch.
Revision ID: 460d0ecd1dd8
Revises: c... | |
45,870 | /home/hieuvd/dung_repo/raw/stars_03/galaxyproject_galaxy/galaxy | /home/hieuvd/dung_repo/raw/stars_03/galaxyproject_galaxy/galaxy/lib/galaxy/model/migrations/base.py | 352,353 | 299,363 | _get_revision | BaseAlembicManager | 353,359 | 353,359 | class BaseAlembicManager(abc.ABC):
"""
Alembic operations on one database.
"""
@abc.abstractmethod
def _get_alembic_root(self): ...
@staticmethod
def is_at_revision(engine: Engine, revision: Union[str, Iterable[str]]) -> bool:
"""
True if revision is a subset of the set of ... | class BaseAlembicManager(abc.ABC):
"""
Alembic operations on one database.
"""
@abc.abstractmethod
def _get_alembic_root(self): ...
@staticmethod
def is_at_revision(engine: Engine, revision: Union[str, Iterable[str]]) -> bool:
"""
True if revision is a subset of the set of ... | try:
return self.script_directory.get_revision(revision_id)
except alembic.util.exc.CommandError as e:
log.error(f"Revision {revision_id} not found in the script directory")
raise e
| try:
return self.script_directory.get_revision(revision_id)
except alembic.util.exc.CommandError as e:
log.error(f"Revision {revision_id} not found in the script directory")
raise e
| 17 | 788 | 73 | 861 | """
Shared code for galaxy and tool shed migrations.
"""
import abc
import logging
import os
import sys
import urllib.parse
from argparse import (
ArgumentParser,
Namespace,
)
from typing import (
cast,
Dict,
Iterable,
List,
Optional,
Union,
)
import alembic
from alembic import command... | """
Shared code for galaxy and tool shed migrations.
"""
import abc
import logging
import os
import sys
import urllib.parse
from argparse import (
ArgumentParser,
Namespace,
)
from typing import (
cast,
Dict,
Iterable,
List,
Optional,
Union,
)
import alembic
from alembic import command... |
45,871 | /home/hieuvd/dung_repo/raw/stars_03/galaxyproject_galaxy/galaxy | /home/hieuvd/dung_repo/raw/stars_03/galaxyproject_galaxy/galaxy/lib/galaxy/model/migrations/base.py | 285,286 | 257,299 | _exec_command | BaseCommand | 286,299 | 286,299 | class BaseCommand(abc.ABC):
@abc.abstractmethod
def init(self, args: Namespace) -> None: ...
@abc.abstractmethod
def _get_dbscript(self, config_file: str) -> BaseDbScript: ...
def upgrade(self, args: Namespace) -> None:
self._exec_command("upgrade", args)
def downgrade(self, args: Nam... | class BaseCommand(abc.ABC):
@abc.abstractmethod
def init(self, args: Namespace) -> None: ...
@abc.abstractmethod
def _get_dbscript(self, config_file: str) -> BaseDbScript: ...
def upgrade(self, args: Namespace) -> None:
self._exec_command("upgrade", args)
def downgrade(self, args: Nam... | dbscript = self._get_dbscript(args.config)
try:
getattr(dbscript, command)(args)
except alembic.util.exc.CommandError as e:
if hasattr(args, "raiseerr") and args.raiseerr:
raise
else:
log.error(e)
print(f"FAILED... | dbscript = self._get_dbscript(args.config)
try:
getattr(dbscript, command)(args)
except alembic.util.exc.CommandError as e:
if hasattr(args, "raiseerr") and args.raiseerr:
raise
else:
log.error(e)
print(f"FAILED... | 21 | 310 | 121 | 431 | """
Shared code for galaxy and tool shed migrations.
"""
import abc
import logging
import os
import sys
import urllib.parse
from argparse import (
ArgumentParser,
Namespace,
)
from typing import (
cast,
Dict,
Iterable,
List,
Optional,
Union,
)
import alembic
from alembic import command... | """
Shared code for galaxy and tool shed migrations.
"""
import abc
import logging
import os
import sys
import urllib.parse
from argparse import (
ArgumentParser,
Namespace,
)
from typing import (
cast,
Dict,
Iterable,
List,
Optional,
Union,
)
import alembic
from alembic import command... |
45,872 | /home/hieuvd/dung_repo/raw/stars_03/galaxyproject_galaxy/galaxy | /home/hieuvd/dung_repo/raw/stars_03/galaxyproject_galaxy/galaxy/lib/galaxy/model/migrations/base.py | 221,222 | 179,257 | _get_alembic_cfg | BaseDbScript | 222,233 | 222,233 | class BaseDbScript(abc.ABC):
"""Facade for common database schema migration operations."""
@abc.abstractmethod
def _set_dburl(self, config_file: Optional[str] = None) -> None: ...
@abc.abstractmethod
def _upgrade_to_head(self, is_sql_mode: bool): ...
def __init__(self, config_file: Optional[s... | class BaseDbScript(abc.ABC):
"""Facade for common database schema migration operations."""
@abc.abstractmethod
def _set_dburl(self, config_file: Optional[str] = None) -> None: ...
@abc.abstractmethod
def _upgrade_to_head(self, is_sql_mode: bool): ...
def __init__(self, config_file: Optional[s... | config_file = os.getenv("ALEMBIC_CONFIG")
if not config_file:
# We need to reference the runtime module because this is an abstract class,
# so the path will be different for different concrete classes.
module_file = sys.modules[self.__module__].__file__
a... | config_file = os.getenv("ALEMBIC_CONFIG")
if not config_file:
# We need to reference the runtime module because this is an abstract class,
# so the path will be different for different concrete classes.
module_file = sys.modules[self.__module__].__file__
a... | 50 | 873 | 182 | 1,055 | """
Shared code for galaxy and tool shed migrations.
"""
import abc
import logging
import os
import sys
import urllib.parse
from argparse import (
ArgumentParser,
Namespace,
)
from typing import (
cast,
Dict,
Iterable,
List,
Optional,
Union,
)
import alembic
from alembic import command... | """
Shared code for galaxy and tool shed migrations.
"""
import abc
import logging
import os
import sys
import urllib.parse
from argparse import (
ArgumentParser,
Namespace,
)
from typing import (
cast,
Dict,
Iterable,
List,
Optional,
Union,
)
import alembic
from alembic import command... |
45,873 | /home/hieuvd/dung_repo/raw/stars_03/galaxyproject_galaxy/galaxy | /home/hieuvd/dung_repo/raw/stars_03/galaxyproject_galaxy/galaxy/lib/galaxy/model/migrations/base.py | 148,149 | 46,179 | _make_sql_arg_parser | BaseParserBuilder | 149,157 | 149,157 | class BaseParserBuilder(abc.ABC):
"""
Assembler object that simplifies the construction of an argument parser for database migration scripts.
"""
@abc.abstractmethod
def _get_command_object(self): ...
def __init__(self, parser, subcommand_required=True):
self._cmd = self._get_command_o... | class BaseParserBuilder(abc.ABC):
"""
Assembler object that simplifies the construction of an argument parser for database migration scripts.
"""
@abc.abstractmethod
def _get_command_object(self): ...
def __init__(self, parser, subcommand_required=True):
self._cmd = self._get_command_o... | parser = ArgumentParser(add_help=False)
parser.add_argument(
"--sql",
action="store_true",
help="Don't emit SQL to database - dump to standard output/file instead. See Alembic docs on offline mode.",
)
return parser
| parser = ArgumentParser(add_help=False)
parser.add_argument(
"--sql",
action="store_true",
help="Don't emit SQL to database - dump to standard output/file instead. See Alembic docs on offline mode.",
)
return parser
| 26 | 1,327 | 85 | 1,412 | """
Shared code for galaxy and tool shed migrations.
"""
import abc
import logging
import os
import sys
import urllib.parse
from argparse import (
ArgumentParser,
Namespace,
)
from typing import (
cast,
Dict,
Iterable,
List,
Optional,
Union,
)
import alembic
from alembic import command... | """
Shared code for galaxy and tool shed migrations.
"""
import abc
import logging
import os
import sys
import urllib.parse
from argparse import (
ArgumentParser,
Namespace,
)
from typing import (
cast,
Dict,
Iterable,
List,
Optional,
Union,
)
import alembic
from alembic import command... |
45,874 | /home/hieuvd/dung_repo/raw/stars_03/galaxyproject_galaxy/galaxy | /home/hieuvd/dung_repo/raw/stars_03/galaxyproject_galaxy/galaxy/lib/galaxy/model/migrations/base.py | 390,391 | 363,407 | _load_db | DatabaseStateCache | 391,395 | 391,395 | class DatabaseStateCache:
"""
Snapshot of database state.
"""
def __init__(self, engine: Engine) -> None:
self._load_db(engine)
@property
def tables(self) -> Dict[str, Table]:
return self.db_metadata.tables
def is_database_empty(self) -> bool:
return not bool(self.... | class DatabaseStateCache:
"""
Snapshot of database state.
"""
def __init__(self, engine: Engine) -> None:
self._load_db(engine)
@property
def tables(self) -> Dict[str, Table]:
return self.db_metadata.tables
def is_database_empty(self) -> bool:
return not bool(self.... | with engine.connect() as conn:
self.db_metadata = self._load_db_metadata(conn)
self.sqlalchemymigrate_version = self._load_sqlalchemymigrate_version(conn)
| with engine.connect() as conn:
self.db_metadata = self._load_db_metadata(conn)
self.sqlalchemymigrate_version = self._load_sqlalchemymigrate_version(conn)
| 10 | 439 | 61 | 500 | """
Shared code for galaxy and tool shed migrations.
"""
import abc
import logging
import os
import sys
import urllib.parse
from argparse import (
ArgumentParser,
Namespace,
)
from typing import (
cast,
Dict,
Iterable,
List,
Optional,
Union,
)
import alembic
from alembic import command... | """
Shared code for galaxy and tool shed migrations.
"""
import abc
import logging
import os
import sys
import urllib.parse
from argparse import (
ArgumentParser,
Namespace,
)
from typing import (
cast,
Dict,
Iterable,
List,
Optional,
Union,
)
import alembic
from alembic import command... |
45,875 | /home/hieuvd/dung_repo/raw/stars_03/galaxyproject_galaxy/galaxy | /home/hieuvd/dung_repo/raw/stars_03/galaxyproject_galaxy/galaxy/lib/galaxy/model/migrations/dbscript.py | 54,55 | 53,62 | init | Command | 55,58 | 55,58 | class Command(BaseCommand):
def init(self, args: Namespace) -> None:
FILL_FUNC_BODY def _get_dbscript(self, config_file: str) -> BaseDbScript:
return DbScript(config_file)
| class Command(BaseCommand):
def init(self, args: Namespace) -> None:
FILL_FUNC_BODY def _get_dbscript(self, config_file: str) -> BaseDbScript:
return DbScript(config_file)
| gxy_config, tsi_config, is_auto_migrate = get_configuration(sys.argv, os.getcwd())
verify_databases_via_script(gxy_config, tsi_config, is_auto_migrate)
| gxy_config, tsi_config, is_auto_migrate = get_configuration(sys.argv, os.getcwd())
verify_databases_via_script(gxy_config, tsi_config, is_auto_migrate)
| 9 | 69 | 68 | 137 | import logging
import os
import sys
from argparse import Namespace
from typing import Optional
from galaxy.model.migrations import verify_databases_via_script
from galaxy.model.migrations.base import (
BaseCommand,
BaseDbScript,
BaseParserBuilder,
)
from galaxy.model.migrations.scripts import (
get_con... | import logging
import os
import sys
from argparse import Namespace
from typing import Optional
from galaxy.model.migrations import verify_databases_via_script
from galaxy.model.migrations.base import (
BaseCommand,
BaseDbScript,
BaseParserBuilder,
)
from galaxy.model.migrations.scripts import (
get_con... |
45,876 | /home/hieuvd/dung_repo/raw/stars_03/galaxyproject_galaxy/galaxy | /home/hieuvd/dung_repo/raw/stars_03/galaxyproject_galaxy/galaxy/lib/galaxy/model/migrations/dbscript.py | 78,79 | 62,92 | _set_dburl | DbScript | 79,84 | 79,84 | class DbScript(BaseDbScript):
"""
Facade for common database schema migration operations on the gxy branch.
When the gxy and tsi branches are persisted in the same database, some
alembic commands will display output on the state on both branches (e.g.
history, version, dbversion). The upgrade comman... | class DbScript(BaseDbScript):
"""
Facade for common database schema migration operations on the gxy branch.
When the gxy and tsi branches are persisted in the same database, some
alembic commands will display output on the state on both branches (e.g.
history, version, dbversion). The upgrade comman... | gxy_config, tsi_config, _ = get_configuration_from_file(os.getcwd(), config_file)
self.gxy_url = gxy_config.url
self.tsi_url = tsi_config.url
self.alembic_config.set_main_option("sqlalchemy.url", self.gxy_url)
| gxy_config, tsi_config, _ = get_configuration_from_file(os.getcwd(), config_file)
self.gxy_url = gxy_config.url
self.tsi_url = tsi_config.url
self.alembic_config.set_main_option("sqlalchemy.url", self.gxy_url)
| 14 | 379 | 98 | 477 | import logging
import os
import sys
from argparse import Namespace
from typing import Optional
from galaxy.model.migrations import verify_databases_via_script
from galaxy.model.migrations.base import (
BaseCommand,
BaseDbScript,
BaseParserBuilder,
)
from galaxy.model.migrations.scripts import (
get_con... | import logging
import os
import sys
from argparse import Namespace
from typing import Optional
from galaxy.model.migrations import verify_databases_via_script
from galaxy.model.migrations.base import (
BaseCommand,
BaseDbScript,
BaseParserBuilder,
)
from galaxy.model.migrations.scripts import (
get_con... |
45,877 | /home/hieuvd/dung_repo/raw/stars_03/galaxyproject_galaxy/galaxy | /home/hieuvd/dung_repo/raw/stars_03/galaxyproject_galaxy/galaxy/lib/galaxy/model/migrations/dbscript.py | 49,50 | 48,53 | _get_command_object | ParserBuilder | 50,53 | 50,53 | class ParserBuilder(BaseParserBuilder):
def _get_command_object(self):
FILL_FUNC_BODY | class ParserBuilder(BaseParserBuilder):
def _get_command_object(self):
FILL_FUNC_BODY | return Command()
| return Command()
| 2 | 32 | 10 | 42 | import logging
import os
import sys
from argparse import Namespace
from typing import Optional
from galaxy.model.migrations import verify_databases_via_script
from galaxy.model.migrations.base import (
BaseCommand,
BaseDbScript,
BaseParserBuilder,
)
from galaxy.model.migrations.scripts import (
get_con... | import logging
import os
import sys
from argparse import Namespace
from typing import Optional
from galaxy.model.migrations import verify_databases_via_script
from galaxy.model.migrations.base import (
BaseCommand,
BaseDbScript,
BaseParserBuilder,
)
from galaxy.model.migrations.scripts import (
get_con... |
45,879 | /home/hieuvd/dung_repo/raw/stars_03/galaxyproject_galaxy/galaxy | /home/hieuvd/dung_repo/raw/stars_03/galaxyproject_galaxy/galaxy/lib/galaxy/model/migrations/scripts.py | 223,224 | 136,245 | _get_gxy_alembic_db_version | LegacyManageDb | 224,236 | 224,236 | class LegacyManageDb:
LEGACY_CONFIG_FILE_ARG_NAMES = ["-c", "--config", "--config-file"]
def __init__(self):
self._set_db_urls()
def get_gxy_version(self):
"""
Get the head revision for the gxy branch from the Alembic script directory.
(previously referred to as "max/reposi... | class LegacyManageDb:
LEGACY_CONFIG_FILE_ARG_NAMES = ["-c", "--config", "--config-file"]
def __init__(self):
self._set_db_urls()
def get_gxy_version(self):
"""
Get the head revision for the gxy branch from the Alembic script directory.
(previously referred to as "max/reposi... | # We may get 2 values, one for each branch (gxy and tsi). So we need to
# determine which one is the gxy head.
with engine.connect() as conn:
context = MigrationContext.configure(conn)
db_heads = context.get_current_heads()
if db_heads:
gxy_rev... | # We may get 2 values, one for each branch (gxy and tsi). So we need to
# determine which one is the gxy head.
with engine.connect() as conn:
context = MigrationContext.configure(conn)
db_heads = context.get_current_heads()
if db_heads:
gxy_rev... | 52 | 1,148 | 154 | 1,302 | import os
import sys
from typing import (
List,
Optional,
Tuple,
)
import alembic.config
from alembic.config import Config
from alembic.runtime.migration import MigrationContext
from alembic.script import ScriptDirectory
from sqlalchemy import create_engine
from sqlalchemy.engine import Engine
from galaxy... | import os
import sys
from typing import (
List,
Optional,
Tuple,
)
import alembic.config
from alembic.config import Config
from alembic.runtime.migration import MigrationContext
from alembic.script import ScriptDirectory
from sqlalchemy import create_engine
from sqlalchemy.engine import Engine
from galaxy... |
45,881 | /home/hieuvd/dung_repo/raw/stars_03/galaxyproject_galaxy/galaxy | /home/hieuvd/dung_repo/raw/stars_03/galaxyproject_galaxy/galaxy/lib/galaxy/model/migrations/util.py | 169,170 | 159,177 | pre_execute_check | AddColumn | 170,172 | 170,172 | class AddColumn(DDLOperation):
"""Wraps alembic's add_column directive."""
def __init__(self, table_name: str, column: sa.Column) -> None:
self.table_name = table_name
self.column = column
def execute(self) -> None:
op.add_column(self.table_name, self.column)
def pre_execute_c... | class AddColumn(DDLOperation):
"""Wraps alembic's add_column directive."""
def __init__(self, table_name: str, column: sa.Column) -> None:
self.table_name = table_name
self.column = column
def execute(self) -> None:
op.add_column(self.table_name, self.column)
def pre_execute_c... | return not column_exists(self.table_name, self.column.name, False)
| return not column_exists(self.table_name, self.column.name, False)
| 5 | 181 | 25 | 206 | import logging
from abc import (
ABC,
abstractmethod,
)
from contextlib import contextmanager
from typing import (
Any,
List,
Optional,
Sequence,
)
import sqlalchemy as sa
from alembic import (
context,
op,
)
from sqlalchemy.exc import OperationalError
log = logging.getLogger(__name__)... | import logging
from abc import (
ABC,
abstractmethod,
)
from contextlib import contextmanager
from typing import (
Any,
List,
Optional,
Sequence,
)
import sqlalchemy as sa
from alembic import (
context,
op,
)
from sqlalchemy.exc import OperationalError
log = logging.getLogger(__name__)... |
45,882 | /home/hieuvd/dung_repo/raw/stars_03/galaxyproject_galaxy/galaxy | /home/hieuvd/dung_repo/raw/stars_03/galaxyproject_galaxy/galaxy/lib/galaxy/model/migrations/util.py | 209,210 | 198,221 | non_batch_execute | AlterColumn | 210,212 | 210,212 | class AlterColumn(DDLAlterOperation):
"""Wraps alembic's alter_column directive."""
def __init__(self, table_name: str, column_name: str, **kw: Any) -> None:
self.table_name = table_name
self.column_name = column_name
self.kw = kw
def batch_execute(self, batch_op) -> None:
... | class AlterColumn(DDLAlterOperation):
"""Wraps alembic's alter_column directive."""
def __init__(self, table_name: str, column_name: str, **kw: Any) -> None:
self.table_name = table_name
self.column_name = column_name
self.kw = kw
def batch_execute(self, batch_op) -> None:
... | op.alter_column(self.table_name, self.column_name, **self.kw)
| op.alter_column(self.table_name, self.column_name, **self.kw)
| 3 | 265 | 28 | 293 | import logging
from abc import (
ABC,
abstractmethod,
)
from contextlib import contextmanager
from typing import (
Any,
List,
Optional,
Sequence,
)
import sqlalchemy as sa
from alembic import (
context,
op,
)
from sqlalchemy.exc import OperationalError
log = logging.getLogger(__name__)... | import logging
from abc import (
ABC,
abstractmethod,
)
from contextlib import contextmanager
from typing import (
Any,
List,
Optional,
Sequence,
)
import sqlalchemy as sa
from alembic import (
context,
op,
)
from sqlalchemy.exc import OperationalError
log = logging.getLogger(__name__)... |
45,883 | /home/hieuvd/dung_repo/raw/stars_03/galaxyproject_galaxy/galaxy | /home/hieuvd/dung_repo/raw/stars_03/galaxyproject_galaxy/galaxy/lib/galaxy/model/migrations/util.py | 240,241 | 221,258 | batch_execute | CreateForeignKey | 241,245 | 241,245 | class CreateForeignKey(DDLAlterOperation):
"""Wraps alembic's create_foreign_key directive."""
def __init__(
self,
foreign_key_name: str,
table_name: str,
referent_table: str,
local_cols: List[str],
remote_cols: List[str],
**kw: Any,
) -> None:
... | class CreateForeignKey(DDLAlterOperation):
"""Wraps alembic's create_foreign_key directive."""
def __init__(
self,
foreign_key_name: str,
table_name: str,
referent_table: str,
local_cols: List[str],
remote_cols: List[str],
**kw: Any,
) -> None:
... | batch_op.create_foreign_key(
self.foreign_key_name, self.referent_table, self.local_cols, self.remote_cols, **self.kw
)
| batch_op.create_foreign_key(
self.foreign_key_name, self.referent_table, self.local_cols, self.remote_cols, **self.kw
)
| 7 | 382 | 57 | 439 | import logging
from abc import (
ABC,
abstractmethod,
)
from contextlib import contextmanager
from typing import (
Any,
List,
Optional,
Sequence,
)
import sqlalchemy as sa
from alembic import (
context,
op,
)
from sqlalchemy.exc import OperationalError
log = logging.getLogger(__name__)... | import logging
from abc import (
ABC,
abstractmethod,
)
from contextlib import contextmanager
from typing import (
Any,
List,
Optional,
Sequence,
)
import sqlalchemy as sa
from alembic import (
context,
op,
)
from sqlalchemy.exc import OperationalError
log = logging.getLogger(__name__)... |
45,884 | /home/hieuvd/dung_repo/raw/stars_03/galaxyproject_galaxy/galaxy | /home/hieuvd/dung_repo/raw/stars_03/galaxyproject_galaxy/galaxy/lib/galaxy/model/migrations/util.py | 133,134 | 121,141 | pre_execute_check | CreateIndex | 134,136 | 134,136 | class CreateIndex(DDLOperation):
"""Wraps alembic's create_index directive."""
def __init__(self, index_name: str, table_name: str, columns: Sequence, **kw: Any) -> None:
self.index_name = index_name
self.table_name = table_name
self.columns = columns
self.kw = kw
def execu... | class CreateIndex(DDLOperation):
"""Wraps alembic's create_index directive."""
def __init__(self, index_name: str, table_name: str, columns: Sequence, **kw: Any) -> None:
self.index_name = index_name
self.table_name = table_name
self.columns = columns
self.kw = kw
def execu... | return not index_exists(self.index_name, self.table_name, False)
| return not index_exists(self.index_name, self.table_name, False)
| 5 | 221 | 25 | 246 | import logging
from abc import (
ABC,
abstractmethod,
)
from contextlib import contextmanager
from typing import (
Any,
List,
Optional,
Sequence,
)
import sqlalchemy as sa
from alembic import (
context,
op,
)
from sqlalchemy.exc import OperationalError
log = logging.getLogger(__name__)... | import logging
from abc import (
ABC,
abstractmethod,
)
from contextlib import contextmanager
from typing import (
Any,
List,
Optional,
Sequence,
)
import sqlalchemy as sa
from alembic import (
context,
op,
)
from sqlalchemy.exc import OperationalError
log = logging.getLogger(__name__)... |
45,885 | /home/hieuvd/dung_repo/raw/stars_03/galaxyproject_galaxy/galaxy | /home/hieuvd/dung_repo/raw/stars_03/galaxyproject_galaxy/galaxy/lib/galaxy/model/migrations/util.py | 95,96 | 88,105 | execute | CreateTable | 96,98 | 96,98 | class CreateTable(DDLOperation):
"""Wraps alembic's create_table directive."""
def __init__(self, table_name: str, *columns: sa.schema.SchemaItem) -> None:
self.table_name = table_name
self.columns = columns
def execute(self) -> Optional[sa.Table]:
FILL_FUNC_BODY def pre_execute_check(s... | class CreateTable(DDLOperation):
"""Wraps alembic's create_table directive."""
def __init__(self, table_name: str, *columns: sa.schema.SchemaItem) -> None:
self.table_name = table_name
self.columns = columns
def execute(self) -> Optional[sa.Table]:
FILL_FUNC_BODY def pre_execute_check(s... | return op.create_table(self.table_name, *self.columns)
| return op.create_table(self.table_name, *self.columns)
| 3 | 173 | 23 | 196 | import logging
from abc import (
ABC,
abstractmethod,
)
from contextlib import contextmanager
from typing import (
Any,
List,
Optional,
Sequence,
)
import sqlalchemy as sa
from alembic import (
context,
op,
)
from sqlalchemy.exc import OperationalError
log = logging.getLogger(__name__)... | import logging
from abc import (
ABC,
abstractmethod,
)
from contextlib import contextmanager
from typing import (
Any,
List,
Optional,
Sequence,
)
import sqlalchemy as sa
from alembic import (
context,
op,
)
from sqlalchemy.exc import OperationalError
log = logging.getLogger(__name__)... |
45,886 | /home/hieuvd/dung_repo/raw/stars_03/galaxyproject_galaxy/galaxy | /home/hieuvd/dung_repo/raw/stars_03/galaxyproject_galaxy/galaxy/lib/galaxy/model/migrations/util.py | 269,270 | 258,280 | non_batch_execute | CreateUniqueConstraint | 270,272 | 270,272 | class CreateUniqueConstraint(DDLAlterOperation):
"""Wraps alembic's create_unique_constraint directive."""
def __init__(self, constraint_name: str, table_name: str, columns: List[str]) -> None:
super().__init__(table_name)
self.constraint_name = constraint_name
self.columns = columns
... | class CreateUniqueConstraint(DDLAlterOperation):
"""Wraps alembic's create_unique_constraint directive."""
def __init__(self, constraint_name: str, table_name: str, columns: List[str]) -> None:
super().__init__(table_name)
self.constraint_name = constraint_name
self.columns = columns
... | op.create_unique_constraint(self.constraint_name, self.table_name, self.columns)
| op.create_unique_constraint(self.constraint_name, self.table_name, self.columns)
| 3 | 253 | 29 | 282 | import logging
from abc import (
ABC,
abstractmethod,
)
from contextlib import contextmanager
from typing import (
Any,
List,
Optional,
Sequence,
)
import sqlalchemy as sa
from alembic import (
context,
op,
)
from sqlalchemy.exc import OperationalError
log = logging.getLogger(__name__)... | import logging
from abc import (
ABC,
abstractmethod,
)
from contextlib import contextmanager
from typing import (
Any,
List,
Optional,
Sequence,
)
import sqlalchemy as sa
from alembic import (
context,
op,
)
from sqlalchemy.exc import OperationalError
log = logging.getLogger(__name__)... |
45,887 | /home/hieuvd/dung_repo/raw/stars_03/galaxyproject_galaxy/galaxy | /home/hieuvd/dung_repo/raw/stars_03/galaxyproject_galaxy/galaxy/lib/galaxy/model/migrations/util.py | 68,69 | 57,88 | run | DDLAlterOperation | 69,74 | 69,74 | class DDLAlterOperation(DDLOperation):
"""
Base class for DDL operations that implement special handling of ALTER statements.
Ref:
- https://alembic.sqlalchemy.org/en/latest/ops.html#alembic.operations.Operations.batch_alter_table
- https://alembic.sqlalchemy.org/en/latest/batch.html
"""
de... | class DDLAlterOperation(DDLOperation):
"""
Base class for DDL operations that implement special handling of ALTER statements.
Ref:
- https://alembic.sqlalchemy.org/en/latest/ops.html#alembic.operations.Operations.batch_alter_table
- https://alembic.sqlalchemy.org/en/latest/batch.html
"""
de... | if context.is_offline_mode():
log.info("Generation of `alter` statements is disabled in offline mode.")
return None
return super().run()
| if context.is_offline_mode():
log.info("Generation of `alter` statements is disabled in offline mode.")
return None
return super().run()
| 15 | 300 | 48 | 348 | import logging
from abc import (
ABC,
abstractmethod,
)
from contextlib import contextmanager
from typing import (
Any,
List,
Optional,
Sequence,
)
import sqlalchemy as sa
from alembic import (
context,
op,
)
from sqlalchemy.exc import OperationalError
log = logging.getLogger(__name__)... | import logging
from abc import (
ABC,
abstractmethod,
)
from contextlib import contextmanager
from typing import (
Any,
List,
Optional,
Sequence,
)
import sqlalchemy as sa
from alembic import (
context,
op,
)
from sqlalchemy.exc import OperationalError
log = logging.getLogger(__name__)... |
45,888 | /home/hieuvd/dung_repo/raw/stars_03/galaxyproject_galaxy/galaxy | /home/hieuvd/dung_repo/raw/stars_03/galaxyproject_galaxy/galaxy/lib/galaxy/model/migrations/util.py | 43,44 | 24,57 | log_check_not_passed | DDLOperation | 44,45 | 44,45 | class DDLOperation(ABC):
"""Base class for all DDL operations."""
def run(self) -> Optional[Any]:
if not self._is_repair_mode():
return self.execute()
else:
if self.pre_execute_check():
return self.execute()
else:
self.log_chec... | class DDLOperation(ABC):
"""Base class for all DDL operations."""
def run(self) -> Optional[Any]:
if not self._is_repair_mode():
return self.execute()
else:
if self.pre_execute_check():
return self.execute()
else:
self.log_chec... | def log_check_not_passed(self) -> None: ...
| def log_check_not_passed(self) -> None: ...
| 5 | 308 | 19 | 327 | import logging
from abc import (
ABC,
abstractmethod,
)
from contextlib import contextmanager
from typing import (
Any,
List,
Optional,
Sequence,
)
import sqlalchemy as sa
from alembic import (
context,
op,
)
from sqlalchemy.exc import OperationalError
log = logging.getLogger(__name__)... | import logging
from abc import (
ABC,
abstractmethod,
)
from contextlib import contextmanager
from typing import (
Any,
List,
Optional,
Sequence,
)
import sqlalchemy as sa
from alembic import (
context,
op,
)
from sqlalchemy.exc import OperationalError
log = logging.getLogger(__name__)... |
45,889 | /home/hieuvd/dung_repo/raw/stars_03/galaxyproject_galaxy/galaxy | /home/hieuvd/dung_repo/raw/stars_03/galaxyproject_galaxy/galaxy/lib/galaxy/model/migrations/util.py | 193,194 | 177,198 | log_check_not_passed | DropColumn | 194,198 | 194,198 | class DropColumn(DDLAlterOperation):
"""Wraps alembic's drop_column directive."""
def __init__(self, table_name: str, column_name: str) -> None:
super().__init__(table_name)
self.column_name = column_name
def batch_execute(self, batch_op) -> None:
batch_op.drop_column(self.column_n... | class DropColumn(DDLAlterOperation):
"""Wraps alembic's drop_column directive."""
def __init__(self, table_name: str, column_name: str) -> None:
super().__init__(table_name)
self.column_name = column_name
def batch_execute(self, batch_op) -> None:
batch_op.drop_column(self.column_n... | name = _table_object_description(self.column_name, self.table_name)
self._log_object_does_not_exist_message(name)
| name = _table_object_description(self.column_name, self.table_name)
self._log_object_does_not_exist_message(name)
| 5 | 209 | 47 | 256 | import logging
from abc import (
ABC,
abstractmethod,
)
from contextlib import contextmanager
from typing import (
Any,
List,
Optional,
Sequence,
)
import sqlalchemy as sa
from alembic import (
context,
op,
)
from sqlalchemy.exc import OperationalError
log = logging.getLogger(__name__)... | import logging
from abc import (
ABC,
abstractmethod,
)
from contextlib import contextmanager
from typing import (
Any,
List,
Optional,
Sequence,
)
import sqlalchemy as sa
from alembic import (
context,
op,
)
from sqlalchemy.exc import OperationalError
log = logging.getLogger(__name__)... |
45,890 | /home/hieuvd/dung_repo/raw/stars_03/galaxyproject_galaxy/galaxy | /home/hieuvd/dung_repo/raw/stars_03/galaxyproject_galaxy/galaxy/lib/galaxy/model/migrations/util.py | 296,297 | 280,301 | log_check_not_passed | DropConstraint | 297,301 | 297,301 | class DropConstraint(DDLAlterOperation):
"""Wraps alembic's drop_constraint directive."""
def __init__(self, constraint_name: str, table_name: str) -> None:
super().__init__(table_name)
self.constraint_name = constraint_name
def batch_execute(self, batch_op) -> None:
batch_op.drop_... | class DropConstraint(DDLAlterOperation):
"""Wraps alembic's drop_constraint directive."""
def __init__(self, constraint_name: str, table_name: str) -> None:
super().__init__(table_name)
self.constraint_name = constraint_name
def batch_execute(self, batch_op) -> None:
batch_op.drop_... | name = _table_object_description(self.constraint_name, self.table_name)
self._log_object_does_not_exist_message(name)
| name = _table_object_description(self.constraint_name, self.table_name)
self._log_object_does_not_exist_message(name)
| 5 | 211 | 47 | 258 | import logging
from abc import (
ABC,
abstractmethod,
)
from contextlib import contextmanager
from typing import (
Any,
List,
Optional,
Sequence,
)
import sqlalchemy as sa
from alembic import (
context,
op,
)
from sqlalchemy.exc import OperationalError
log = logging.getLogger(__name__)... | import logging
from abc import (
ABC,
abstractmethod,
)
from contextlib import contextmanager
from typing import (
Any,
List,
Optional,
Sequence,
)
import sqlalchemy as sa
from alembic import (
context,
op,
)
from sqlalchemy.exc import OperationalError
log = logging.getLogger(__name__)... |
45,891 | /home/hieuvd/dung_repo/raw/stars_03/galaxyproject_galaxy/galaxy | /home/hieuvd/dung_repo/raw/stars_03/galaxyproject_galaxy/galaxy/lib/galaxy/model/migrations/util.py | 154,155 | 141,159 | log_check_not_passed | DropIndex | 155,159 | 155,159 | class DropIndex(DDLOperation):
"""Wraps alembic's drop_index directive."""
def __init__(self, index_name: str, table_name: str) -> None:
self.index_name = index_name
self.table_name = table_name
def execute(self) -> None:
op.drop_index(self.index_name, table_name=self.table_name)
... | class DropIndex(DDLOperation):
"""Wraps alembic's drop_index directive."""
def __init__(self, index_name: str, table_name: str) -> None:
self.index_name = index_name
self.table_name = table_name
def execute(self) -> None:
op.drop_index(self.index_name, table_name=self.table_name)
... | name = _table_object_description(self.index_name, self.table_name)
self._log_object_does_not_exist_message(name)
| name = _table_object_description(self.index_name, self.table_name)
self._log_object_does_not_exist_message(name)
| 5 | 174 | 47 | 221 | import logging
from abc import (
ABC,
abstractmethod,
)
from contextlib import contextmanager
from typing import (
Any,
List,
Optional,
Sequence,
)
import sqlalchemy as sa
from alembic import (
context,
op,
)
from sqlalchemy.exc import OperationalError
log = logging.getLogger(__name__)... | import logging
from abc import (
ABC,
abstractmethod,
)
from contextlib import contextmanager
from typing import (
Any,
List,
Optional,
Sequence,
)
import sqlalchemy as sa
from alembic import (
context,
op,
)
from sqlalchemy.exc import OperationalError
log = logging.getLogger(__name__)... |
45,892 | /home/hieuvd/dung_repo/raw/stars_03/galaxyproject_galaxy/galaxy | /home/hieuvd/dung_repo/raw/stars_03/galaxyproject_galaxy/galaxy/lib/galaxy/model/migrations/util.py | 111,112 | 105,121 | execute | DropTable | 112,114 | 112,114 | class DropTable(DDLOperation):
"""Wraps alembic's drop_table directive."""
def __init__(self, table_name: str) -> None:
self.table_name = table_name
def execute(self) -> None:
FILL_FUNC_BODY def pre_execute_check(self) -> bool:
return table_exists(self.table_name, False)
def log_ch... | class DropTable(DDLOperation):
"""Wraps alembic's drop_table directive."""
def __init__(self, table_name: str) -> None:
self.table_name = table_name
def execute(self) -> None:
FILL_FUNC_BODY def pre_execute_check(self) -> bool:
return table_exists(self.table_name, False)
def log_ch... | op.drop_table(self.table_name)
| op.drop_table(self.table_name)
| 1 | 155 | 17 | 172 | import logging
from abc import (
ABC,
abstractmethod,
)
from contextlib import contextmanager
from typing import (
Any,
List,
Optional,
Sequence,
)
import sqlalchemy as sa
from alembic import (
context,
op,
)
from sqlalchemy.exc import OperationalError
log = logging.getLogger(__name__)... | import logging
from abc import (
ABC,
abstractmethod,
)
from contextlib import contextmanager
from typing import (
Any,
List,
Optional,
Sequence,
)
import sqlalchemy as sa
from alembic import (
context,
op,
)
from sqlalchemy.exc import OperationalError
log = logging.getLogger(__name__)... |
45,893 | /home/hieuvd/dung_repo/raw/stars_03/galaxyproject_galaxy/galaxy | /home/hieuvd/dung_repo/raw/stars_03/galaxyproject_galaxy/galaxy/lib/galaxy/model/none_like.py | 41,42 | 26,43 | get_file_name | NoneDataset | 42,43 | 42,43 | class NoneDataset(RecursiveNone):
def __init__(self, datatypes_registry=None, ext="data", dbkey="?"):
self.ext = self.extension = ext
self.dbkey = dbkey
assert datatypes_registry is not None
self.datatype = datatypes_registry.get_datatype_by_extension(ext)
self._metadata = No... | class NoneDataset(RecursiveNone):
def __init__(self, datatypes_registry=None, ext="data", dbkey="?"):
self.ext = self.extension = ext
self.dbkey = dbkey
assert datatypes_registry is not None
self.datatype = datatypes_registry.get_datatype_by_extension(ext)
self._metadata = No... | return "None"
| return "None"
| 2 | 177 | 7 | 184 | """
Objects with No values
"""
from galaxy.model.metadata import MetadataCollection
class RecursiveNone:
def __str__(self):
return "None"
def __repr__(self):
return str(self)
def __getattr__(self, name):
value = RecursiveNone()
setattr(self, name, value)
return v... | """
Objects with No values
"""
from galaxy.model.metadata import MetadataCollection
class RecursiveNone:
def __str__(self):
return "None"
def __repr__(self):
return str(self)
def __getattr__(self, name):
value = RecursiveNone()
setattr(self, name, value)
return v... |
45,894 | /home/hieuvd/dung_repo/raw/stars_03/galaxyproject_galaxy/galaxy | /home/hieuvd/dung_repo/raw/stars_03/galaxyproject_galaxy/galaxy/lib/galaxy/model/orm/engine_factory.py | 45,46 | 1,140 | pretty_stack | 46,52 | 46,52 | import inspect
import logging
import os
import threading
import time
from multiprocessing.util import register_after_fork
from typing import Dict
from sqlalchemy import (
create_engine,
event,
exc,
)
from sqlalchemy.engine import Engine
from sqlalchemy.pool import NullPool
log = logging.getLogger(__name__... | import inspect
import logging
import os
import threading
import time
from multiprocessing.util import register_after_fork
from typing import Dict
from sqlalchemy import (
create_engine,
event,
exc,
)
from sqlalchemy.engine import Engine
from sqlalchemy.pool import NullPool
log = logging.getLogger(__name__... | rval = []
for _, fname, line, funcname, _, _ in inspect.stack()[2:]:
rval.append("%s:%s@%d" % (stripwd(fname), funcname, line))
return rval
| rval = []
for _, fname, line, funcname, _, _ in inspect.stack()[2:]:
rval.append("%s:%s@%d" % (stripwd(fname), funcname, line))
return rval
| 19 | 1,426 | 70 | 1,496 | import inspect
import logging
import os
import threading
import time
from multiprocessing.util import register_after_fork
from typing import Dict
from sqlalchemy import (
create_engine,
event,
exc,
)
from sqlalchemy.engine import Engine
from sqlalchemy.pool import NullPool
log = logging.getLogger(__name__... | import inspect
import logging
import os
import threading
import time
from multiprocessing.util import register_after_fork
from typing import Dict
from sqlalchemy import (
create_engine,
event,
exc,
)
from sqlalchemy.engine import Engine
from sqlalchemy.pool import NullPool
log = logging.getLogger(__name__... | |
45,896 | /home/hieuvd/dung_repo/raw/stars_03/galaxyproject_galaxy/galaxy | /home/hieuvd/dung_repo/raw/stars_03/galaxyproject_galaxy/galaxy/lib/galaxy/model/orm/util.py | 4,5 | 1,34 | add_object_to_object_session | 19,25 | 5,25 | from sqlalchemy import inspect
def add_object_to_object_session(object, object_with_session):
FILL_FUNC_BODYdef add_object_to_session(object, session):
"""Explicitly add object to the session."""
if session and object:
session.add(object)
def get_object_session(object):
if object:
return... | from sqlalchemy import inspect
def add_object_to_object_session(object, object_with_session):
"""
Explicitly add object to the session.
Addresses SQLAlchemy 2.0 compatibility issue:
https://docs.sqlalchemy.org/en/14/changelog/migration_14.html#cascade-backrefs-behavior-deprecated-for-removal-in-2-0
... | if object_with_session:
session = get_object_session(object_with_session)
if session:
add_object_to_session(object, session)
| """
Explicitly add object to the session.
Addresses SQLAlchemy 2.0 compatibility issue:
https://docs.sqlalchemy.org/en/14/changelog/migration_14.html#cascade-backrefs-behavior-deprecated-for-removal-in-2-0
This function preserves SQLAlchemy's pre-2.0 logic and should be used when:
1. foo and b... | 9 | 338 | 52 | 390 | from sqlalchemy import inspect
def add_object_to_object_session(object, object_with_session):
FILL_FUNC_BODYdef add_object_to_session(object, session):
"""Explicitly add object to the session."""
if session and object:
session.add(object)
def get_object_session(object):
if object:
return... | from sqlalchemy import inspect
def add_object_to_object_session(object, object_with_session):
"""
Explicitly add object to the session.
Addresses SQLAlchemy 2.0 compatibility issue:
https://docs.sqlalchemy.org/en/14/changelog/migration_14.html#cascade-backrefs-behavior-deprecated-for-removal-in-2-0
... | |
45,897 | /home/hieuvd/dung_repo/raw/stars_03/galaxyproject_galaxy/galaxy | /home/hieuvd/dung_repo/raw/stars_03/galaxyproject_galaxy/galaxy/lib/galaxy/model/store/_bco_convert_utils.py | 52,53 | 1,58 | bco_workflow_version | 53,58 | 53,58 | import urllib.parse
from typing import (
List,
Set,
)
from galaxy.model import (
Workflow,
WorkflowStep,
)
from galaxy.schema.bco import (
ExecutionDomainUri,
SoftwarePrerequisite,
)
class SoftwarePrerequisiteTracker:
_recorded_tools: Set[str] = set()
_software_prerequisites: List[Sof... | import urllib.parse
from typing import (
List,
Set,
)
from galaxy.model import (
Workflow,
WorkflowStep,
)
from galaxy.schema.bco import (
ExecutionDomainUri,
SoftwarePrerequisite,
)
class SoftwarePrerequisiteTracker:
_recorded_tools: Set[str] = set()
_software_prerequisites: List[Sof... | current_version = 0
for i, w in enumerate(reversed(workflow.stored_workflow.workflows)):
if workflow == w:
current_version = i
return f"{current_version}.0"
| current_version = 0
for i, w in enumerate(reversed(workflow.stored_workflow.workflows)):
if workflow == w:
current_version = i
return f"{current_version}.0"
| 17 | 494 | 66 | 560 | import urllib.parse
from typing import (
List,
Set,
)
from galaxy.model import (
Workflow,
WorkflowStep,
)
from galaxy.schema.bco import (
ExecutionDomainUri,
SoftwarePrerequisite,
)
class SoftwarePrerequisiteTracker:
_recorded_tools: Set[str] = set()
_software_prerequisites: List[Sof... | import urllib.parse
from typing import (
List,
Set,
)
from galaxy.model import (
Workflow,
WorkflowStep,
)
from galaxy.schema.bco import (
ExecutionDomainUri,
SoftwarePrerequisite,
)
class SoftwarePrerequisiteTracker:
_recorded_tools: Set[str] = set()
_software_prerequisites: List[Sof... | |
45,898 | /home/hieuvd/dung_repo/raw/stars_03/galaxyproject_galaxy/galaxy | /home/hieuvd/dung_repo/raw/stars_03/galaxyproject_galaxy/galaxy/lib/galaxy/model/store/_bco_convert_utils.py | 21,22 | 17,52 | register_step | SoftwarePrerequisiteTracker | 22,47 | 22,47 | class SoftwarePrerequisiteTracker:
_recorded_tools: Set[str] = set()
_software_prerequisites: List[SoftwarePrerequisite] = []
def register_step(self, step: WorkflowStep) -> None:
FILL_FUNC_BODY @property
def software_prerequisites(self) -> List[SoftwarePrerequisite]:
return self._software_pr... | class SoftwarePrerequisiteTracker:
_recorded_tools: Set[str] = set()
_software_prerequisites: List[SoftwarePrerequisite] = []
def register_step(self, step: WorkflowStep) -> None:
FILL_FUNC_BODY @property
def software_prerequisites(self) -> List[SoftwarePrerequisite]:
return self._software_pr... | if step.type != "tool":
# TODO: walk subworkflow steps someday...
return
tool_id = step.tool_id
if tool_id in self._recorded_tools:
return
tool_version = step.tool_version
assert tool_id
self._recorded_tools.add(tool_id)
uri_sa... | if step.type != "tool":
# TODO: walk subworkflow steps someday...
return
tool_id = step.tool_id
if tool_id in self._recorded_tools:
return
tool_version = step.tool_version
assert tool_id
self._recorded_tools.add(tool_id)
uri_sa... | 72 | 116 | 311 | 427 | import urllib.parse
from typing import (
List,
Set,
)
from galaxy.model import (
Workflow,
WorkflowStep,
)
from galaxy.schema.bco import (
ExecutionDomainUri,
SoftwarePrerequisite,
)
class SoftwarePrerequisiteTracker:
_recorded_tools: Set[str] = set()
_software_prerequisites: List[Sof... | import urllib.parse
from typing import (
List,
Set,
)
from galaxy.model import (
Workflow,
WorkflowStep,
)
from galaxy.schema.bco import (
ExecutionDomainUri,
SoftwarePrerequisite,
)
class SoftwarePrerequisiteTracker:
_recorded_tools: Set[str] = set()
_software_prerequisites: List[Sof... |
45,899 | /home/hieuvd/dung_repo/raw/stars_03/galaxyproject_galaxy/galaxy | /home/hieuvd/dung_repo/raw/stars_03/galaxyproject_galaxy/galaxy/lib/galaxy/model/store/build_objects.py | 74,75 | 1,133 | main | 75,122 | 75,122 | import argparse
import logging
import os
import sys
import yaml
import galaxy.model
from galaxy.datatypes.registry import example_datatype_registry_for_sample
from galaxy.model import store
from galaxy.model.store.discover import persist_target_to_export_store
from galaxy.objectstore import build_object_store_from_co... | import argparse
import logging
import os
import sys
import yaml
import galaxy.model
from galaxy.datatypes.registry import example_datatype_registry_for_sample
from galaxy.model import store
from galaxy.model.store.discover import persist_target_to_export_store
from galaxy.objectstore import build_object_store_from_co... | if argv is None:
argv = sys.argv[1:]
args = _arg_parser().parse_args(argv)
object_store_config = Bunch(
object_store_store_by="uuid",
object_store_config_file=args.object_store_config,
object_store_check_old_style=False,
jobs_directory=None,
new_file_path=Non... | if argv is None:
argv = sys.argv[1:]
args = _arg_parser().parse_args(argv)
object_store_config = Bunch(
object_store_store_by="uuid",
object_store_config_file=args.object_store_config,
object_store_check_old_style=False,
jobs_directory=None,
new_file_path=Non... | 102 | 872 | 560 | 1,432 | import argparse
import logging
import os
import sys
import yaml
import galaxy.model
from galaxy.datatypes.registry import example_datatype_registry_for_sample
from galaxy.model import store
from galaxy.model.store.discover import persist_target_to_export_store
from galaxy.objectstore import build_object_store_from_co... | import argparse
import logging
import os
import sys
import yaml
import galaxy.model
from galaxy.datatypes.registry import example_datatype_registry_for_sample
from galaxy.model import store
from galaxy.model.store.discover import persist_target_to_export_store
from galaxy.objectstore import build_object_store_from_co... | |
45,900 | /home/hieuvd/dung_repo/raw/stars_03/galaxyproject_galaxy/galaxy | /home/hieuvd/dung_repo/raw/stars_03/galaxyproject_galaxy/galaxy/lib/galaxy/model/tool_shed_install/mapping.py | 9,10 | 1,23 | init | 10,16 | 10,16 | from galaxy.model import tool_shed_install as install_model
from galaxy.model.base import ModelMapping
from galaxy.model.orm.engine_factory import build_engine
from galaxy.model.tool_shed_install import mapper_registry
metadata = mapper_registry.metadata
def init(url, engine_options=None, create_tables=False):
FILL_... | from galaxy.model import tool_shed_install as install_model
from galaxy.model.base import ModelMapping
from galaxy.model.orm.engine_factory import build_engine
from galaxy.model.tool_shed_install import mapper_registry
metadata = mapper_registry.metadata
def init(url, engine_options=None, create_tables=False):
FILL_... | engine = build_engine(url, engine_options)
if create_tables:
create_database_objects(engine)
return configure_model_mapping(engine)
| engine = build_engine(url, engine_options)
if create_tables:
create_database_objects(engine)
return configure_model_mapping(engine)
| 9 | 167 | 50 | 217 | from galaxy.model import tool_shed_install as install_model
from galaxy.model.base import ModelMapping
from galaxy.model.orm.engine_factory import build_engine
from galaxy.model.tool_shed_install import mapper_registry
metadata = mapper_registry.metadata
def init(url, engine_options=None, create_tables=False):
FILL_... | from galaxy.model import tool_shed_install as install_model
from galaxy.model.base import ModelMapping
from galaxy.model.orm.engine_factory import build_engine
from galaxy.model.tool_shed_install import mapper_registry
metadata = mapper_registry.metadata
def init(url, engine_options=None, create_tables=False):
FILL_... | |
45,901 | /home/hieuvd/dung_repo/raw/stars_03/galaxyproject_galaxy/galaxy | /home/hieuvd/dung_repo/raw/stars_03/galaxyproject_galaxy/galaxy/lib/galaxy/model/triggers/history_update_time_field.py | 62,63 | 1,161 | get_timestamp_drop_sql | 66,80 | 63,80 | """
Database trigger installation and removal
"""
from galaxy.model.triggers.utils import execute_statements
def install_timestamp_triggers(engine):
"""
Install update_time propagation triggers for history table
"""
statements = get_timestamp_install_sql(engine.name)
execute_statements(engine, st... | """
Database trigger installation and removal
"""
from galaxy.model.triggers.utils import execute_statements
def install_timestamp_triggers(engine):
"""
Install update_time propagation triggers for history table
"""
statements = get_timestamp_install_sql(engine.name)
execute_statements(engine, st... |
sql = []
if "postgres" in variant:
sql.append("DROP FUNCTION IF EXISTS update_history_update_time() CASCADE;")
else:
for operation in ["INSERT", "UPDATE", "DELETE"]:
for when in ["BEFORE", "AFTER"]:
sql.append(build_drop_trigger(operation, "history_dataset_assoc... | """
Generate a list of statements to drop the timestamp update triggers
"""
sql = []
if "postgres" in variant:
sql.append("DROP FUNCTION IF EXISTS update_history_update_time() CASCADE;")
else:
for operation in ["INSERT", "UPDATE", "DELETE"]:
for when in ["BEFORE", "... | 33 | 1,452 | 151 | 1,603 | """
Database trigger installation and removal
"""
from galaxy.model.triggers.utils import execute_statements
def install_timestamp_triggers(engine):
"""
Install update_time propagation triggers for history table
"""
statements = get_timestamp_install_sql(engine.name)
execute_statements(engine, st... | """
Database trigger installation and removal
"""
from galaxy.model.triggers.utils import execute_statements
def install_timestamp_triggers(engine):
"""
Install update_time propagation triggers for history table
"""
statements = get_timestamp_install_sql(engine.name)
execute_statements(engine, st... | |
45,902 | /home/hieuvd/dung_repo/raw/stars_03/galaxyproject_galaxy/galaxy | /home/hieuvd/dung_repo/raw/stars_03/galaxyproject_galaxy/galaxy/lib/galaxy/model/triggers/update_audit_table.py | 133,134 | 1,177 | _sqlite_remove | 134,144 | 134,144 | from galaxy.model.triggers.utils import execute_statements
# function name prefix
fn_prefix = "fn_audit_history_by"
# map between source table and associated incoming id field
trigger_config = {
"history_dataset_association": "history_id",
"history_dataset_collection_association": "history_id",
"history":... | from galaxy.model.triggers.utils import execute_statements
# function name prefix
fn_prefix = "fn_audit_history_by"
# map between source table and associated incoming id field
trigger_config = {
"history_dataset_association": "history_id",
"history_dataset_collection_association": "history_id",
"history":... | sql = []
for source_table in trigger_config:
for operation in ["UPDATE", "INSERT"]:
trigger_name = get_trigger_name(source_table, operation, "AFTER")
sql.append(f"DROP TRIGGER IF EXISTS {trigger_name};")
return sql
| sql = []
for source_table in trigger_config:
for operation in ["UPDATE", "INSERT"]:
trigger_name = get_trigger_name(source_table, operation, "AFTER")
sql.append(f"DROP TRIGGER IF EXISTS {trigger_name};")
return sql
| 24 | 1,721 | 90 | 1,811 | from galaxy.model.triggers.utils import execute_statements
# function name prefix
fn_prefix = "fn_audit_history_by"
# map between source table and associated incoming id field
trigger_config = {
"history_dataset_association": "history_id",
"history_dataset_collection_association": "history_id",
"history":... | from galaxy.model.triggers.utils import execute_statements
# function name prefix
fn_prefix = "fn_audit_history_by"
# map between source table and associated incoming id field
trigger_config = {
"history_dataset_association": "history_id",
"history_dataset_collection_association": "history_id",
"history":... | |
45,903 | /home/hieuvd/dung_repo/raw/stars_03/galaxyproject_galaxy/galaxy | /home/hieuvd/dung_repo/raw/stars_03/galaxyproject_galaxy/galaxy/lib/galaxy/model/triggers/utils.py | 4,5 | 1,10 | execute_statements | 5,10 | 5,10 | from sqlalchemy import DDL
def execute_statements(engine, raw_sql):
FILL_FUNC_BODY | from sqlalchemy import DDL
def execute_statements(engine, raw_sql):
FILL_FUNC_BODY | statements = raw_sql if isinstance(raw_sql, list) else [raw_sql]
with engine.begin() as connection:
for sql in statements:
cmd = DDL(sql)
connection.execute(cmd)
| statements = raw_sql if isinstance(raw_sql, list) else [raw_sql]
with engine.begin() as connection:
for sql in statements:
cmd = DDL(sql)
connection.execute(cmd)
| 20 | 34 | 62 | 96 | from sqlalchemy import DDL
def execute_statements(engine, raw_sql):
FILL_FUNC_BODY | from sqlalchemy import DDL
def execute_statements(engine, raw_sql):
FILL_FUNC_BODY | |
45,904 | /home/hieuvd/dung_repo/raw/stars_03/galaxyproject_galaxy/galaxy | /home/hieuvd/dung_repo/raw/stars_03/galaxyproject_galaxy/galaxy/lib/galaxy/navigation/data.py | 7,8 | 1,11 | load_root_component | 8,11 | 8,11 | import yaml
from galaxy.util.resources import resource_string
from .components import Component
def load_root_component() -> Component:
FILL_FUNC_BODY | import yaml
from galaxy.util.resources import resource_string
from .components import Component
def load_root_component() -> Component:
FILL_FUNC_BODY | new_data_yaml = resource_string(__package__, "navigation.yml")
navigation_raw = yaml.safe_load(new_data_yaml)
return Component.from_dict("root", navigation_raw)
| new_data_yaml = resource_string(__package__, "navigation.yml")
navigation_raw = yaml.safe_load(new_data_yaml)
return Component.from_dict("root", navigation_raw)
| 10 | 46 | 60 | 106 | import yaml
from galaxy.util.resources import resource_string
from .components import Component
def load_root_component() -> Component:
FILL_FUNC_BODY | import yaml
from galaxy.util.resources import resource_string
from .components import Component
def load_root_component() -> Component:
FILL_FUNC_BODY | |
45,907 | /home/hieuvd/dung_repo/raw/stars_03/galaxyproject_galaxy/galaxy | /home/hieuvd/dung_repo/raw/stars_03/galaxyproject_galaxy/galaxy/lib/galaxy/objectstore/badges.py | 104,105 | 1,142 | serialize_badges | 111,142 | 105,142 | from typing import (
Any,
Dict,
List,
Optional,
Set,
Union,
)
from typing_extensions import (
Literal,
TypedDict,
)
BadgeSourceT = Literal["admin", "galaxy"]
# Badges that can be explicitly set by admins.
AdminBadgeT = Literal[
"faster",
"slower",
"short_term",
"backed_... | from typing import (
Any,
Dict,
List,
Optional,
Set,
Union,
)
from typing_extensions import (
Literal,
TypedDict,
)
BadgeSourceT = Literal["admin", "galaxy"]
# Badges that can be explicitly set by admins.
AdminBadgeT = Literal[
"faster",
"slower",
"short_term",
"backed_... | badge_dicts: List[BadgeDict] = []
for badge in stored_badges:
badge_dict: BadgeDict = {
"source": "admin",
"type": badge["type"],
"message": badge["message"],
}
badge_dicts.append(badge_dict)
quota_badge_dict: BadgeDict
if quota_enabled:
... | """Produce blended, unified list of badges for target object store entity.
Combine more free form admin information stored about badges with Galaxy tracked
information (quota and access restriction information) to produce a unified list
of badges to be consumed via the API.
"""
badge_dicts: Lis... | 62 | 1,193 | 315 | 1,508 | from typing import (
Any,
Dict,
List,
Optional,
Set,
Union,
)
from typing_extensions import (
Literal,
TypedDict,
)
BadgeSourceT = Literal["admin", "galaxy"]
# Badges that can be explicitly set by admins.
AdminBadgeT = Literal[
"faster",
"slower",
"short_term",
"backed_... | from typing import (
Any,
Dict,
List,
Optional,
Set,
Union,
)
from typing_extensions import (
Literal,
TypedDict,
)
BadgeSourceT = Literal["admin", "galaxy"]
# Badges that can be explicitly set by admins.
AdminBadgeT = Literal[
"faster",
"slower",
"short_term",
"backed_... | |
45,909 | /home/hieuvd/dung_repo/raw/stars_03/galaxyproject_galaxy/galaxy | /home/hieuvd/dung_repo/raw/stars_03/galaxyproject_galaxy/galaxy/lib/galaxy/objectstore/caching.py | 47,49 | 32,52 | log_description | CacheTarget | 49,52 | 49,52 | class CacheTarget(NamedTuple):
path: str
size: int # cache size in gigabytes
limit: float # cache limit as a percent
def fits_in_cache(self, bytes: int) -> bool:
# if we don't have a positive cache size - interpret it as an unbounded
# object store
if not (self.size > 0):
... | class CacheTarget(NamedTuple):
path: str
size: int # cache size in gigabytes
limit: float # cache limit as a percent
def fits_in_cache(self, bytes: int) -> bool:
# if we don't have a positive cache size - interpret it as an unbounded
# object store
if not (self.size > 0):
... | return f"{self.limit} percent of {self.size} gigabytes"
| return f"{self.limit} percent of {self.size} gigabytes"
| 6 | 160 | 26 | 186 | """
"""
import logging
import os
import threading
import time
from math import inf
from typing import (
List,
Optional,
Tuple,
)
from typing_extensions import NamedTuple
from galaxy.util import (
nice_size,
string_as_bool,
)
from galaxy.util.sleeper import Sleeper
log = logging.getLogger(__name_... | """
"""
import logging
import os
import threading
import time
from math import inf
from typing import (
List,
Optional,
Tuple,
)
from typing_extensions import NamedTuple
from galaxy.util import (
nice_size,
string_as_bool,
)
from galaxy.util.sleeper import Sleeper
log = logging.getLogger(__name_... |
45,910 | /home/hieuvd/dung_repo/raw/stars_03/galaxyproject_galaxy/galaxy | /home/hieuvd/dung_repo/raw/stars_03/galaxyproject_galaxy/galaxy/lib/galaxy/objectstore/caching.py | 198,199 | 179,216 | _cache_monitor | InProcessCacheMonitor | 199,207 | 199,207 | class InProcessCacheMonitor:
def __init__(self, cache_target: CacheTarget, interval: int = 30, initial_sleep: Optional[int] = 2):
# This Event object is initialized to False
# It is set to True in shutdown(), causing
# the cache monitor thread to return/terminate
self.stop_cache_moni... | class InProcessCacheMonitor:
def __init__(self, cache_target: CacheTarget, interval: int = 30, initial_sleep: Optional[int] = 2):
# This Event object is initialized to False
# It is set to True in shutdown(), causing
# the cache monitor thread to return/terminate
self.stop_cache_moni... | if self.initial_sleep is not None:
time.sleep(
self.initial_sleep
) # startup sleep hack - probably originally implemented to prevent contention at app startup
while not self.stop_cache_monitor_event.is_set():
check_cache(self.cache_target)
... | if self.initial_sleep is not None:
time.sleep(
self.initial_sleep
) # startup sleep hack - probably originally implemented to prevent contention at app startup
while not self.stop_cache_monitor_event.is_set():
check_cache(self.cache_target)
... | 27 | 296 | 97 | 393 | """
"""
import logging
import os
import threading
import time
from math import inf
from typing import (
List,
Optional,
Tuple,
)
from typing_extensions import NamedTuple
from galaxy.util import (
nice_size,
string_as_bool,
)
from galaxy.util.sleeper import Sleeper
log = logging.getLogger(__name_... | """
"""
import logging
import os
import threading
import time
from math import inf
from typing import (
List,
Optional,
Tuple,
)
from typing_extensions import NamedTuple
from galaxy.util import (
nice_size,
string_as_bool,
)
from galaxy.util.sleeper import Sleeper
log = logging.getLogger(__name_... |
45,913 | /home/hieuvd/dung_repo/raw/stars_03/galaxyproject_galaxy/galaxy | /home/hieuvd/dung_repo/raw/stars_03/galaxyproject_galaxy/galaxy/lib/galaxy/objectstore/pulsar.py | 30,31 | 9,78 | file_ready | PulsarObjectStore | 31,33 | 31,33 | class PulsarObjectStore(BaseObjectStore):
"""
Object store implementation that delegates to a remote Pulsar server.
This may be more aspirational than practical for now, it would be good to
Galaxy to a point that a handler thread could be setup that doesn't attempt
to access the disk files returned... | class PulsarObjectStore(BaseObjectStore):
"""
Object store implementation that delegates to a remote Pulsar server.
This may be more aspirational than practical for now, it would be good to
Galaxy to a point that a handler thread could be setup that doesn't attempt
to access the disk files returned... | return self.pulsar_client.file_ready(**self.__build_kwds(obj, **kwds))
| return self.pulsar_client.file_ready(**self.__build_kwds(obj, **kwds))
| 3 | 868 | 32 | 900 | from . import BaseObjectStore
try:
from pulsar.client.manager import ObjectStoreClientManager
except ImportError:
ObjectStoreClientManager = None
class PulsarObjectStore(BaseObjectStore):
"""
Object store implementation that delegates to a remote Pulsar server.
This may be more aspirational than... | from . import BaseObjectStore
try:
from pulsar.client.manager import ObjectStoreClientManager
except ImportError:
ObjectStoreClientManager = None
class PulsarObjectStore(BaseObjectStore):
"""
Object store implementation that delegates to a remote Pulsar server.
This may be more aspirational than... |
45,915 | /home/hieuvd/dung_repo/raw/stars_03/galaxyproject_galaxy/galaxy | /home/hieuvd/dung_repo/raw/stars_03/galaxyproject_galaxy/galaxy/lib/galaxy/objectstore/rucio.py | 202,203 | 143,276 | upload | RucioBroker | 203,214 | 203,214 | class RucioBroker:
def __init__(self, rucio_config):
self._temp_file_name = None
self.config = rucio_config
self.upload_scheme = rucio_config["upload_scheme"]
self.upload_rse_name = rucio_config["upload_rse_name"]
self.scope = rucio_config["scope"]
self.register_only ... | class RucioBroker:
def __init__(self, rucio_config):
self._temp_file_name = None
self.config = rucio_config
self.upload_scheme = rucio_config["upload_scheme"]
self.upload_rse_name = rucio_config["upload_rse_name"]
self.scope = rucio_config["scope"]
self.register_only ... | key = _encode_key(key)
item = {
"path": source_path,
"rse": self.upload_rse_name,
"did_scope": self.scope,
"did_name": key,
"force_scheme": self.upload_scheme,
}
items = [item]
self.get_rucio_upload_client().upload(items... | key = _encode_key(key)
item = {
"path": source_path,
"rse": self.upload_rse_name,
"did_scope": self.scope,
"did_name": key,
"force_scheme": self.upload_scheme,
}
items = [item]
self.get_rucio_upload_client().upload(items... | 21 | 1,392 | 113 | 1,505 | import hashlib
import logging
import os
import shutil
from typing import Optional
try:
import rucio.common
from rucio.client import Client
from rucio.client.downloadclient import DownloadClient
from rucio.client.uploadclient import UploadClient
from .rucio_extra_clients import (
DeleteClie... | import hashlib
import logging
import os
import shutil
from typing import Optional
try:
import rucio.common
from rucio.client import Client
from rucio.client.downloadclient import DownloadClient
from rucio.client.uploadclient import UploadClient
from .rucio_extra_clients import (
DeleteClie... |
45,918 | /home/hieuvd/dung_repo/raw/stars_03/galaxyproject_galaxy/galaxy | /home/hieuvd/dung_repo/raw/stars_03/galaxyproject_galaxy/galaxy/lib/galaxy/objectstore/s3.py | 131,132 | 130,157 | _config_to_dict | CloudConfigMixin | 132,157 | 132,157 | class CloudConfigMixin:
def _config_to_dict(self):
FILL_FUNC_BODY | class CloudConfigMixin:
def _config_to_dict(self):
FILL_FUNC_BODY | return {
"auth": {
"access_key": self.access_key,
"secret_key": self.secret_key,
},
"bucket": {
"name": self.bucket,
"use_reduced_redundancy": self.use_rr,
},
"connection": {
... | return {
"auth": {
"access_key": self.access_key,
"secret_key": self.secret_key,
},
"bucket": {
"name": self.bucket,
"use_reduced_redundancy": self.use_rr,
},
"connection": {
... | 41 | 29 | 229 | 258 | """
Object Store plugin for the Amazon Simple Storage Service (S3)
"""
import logging
import multiprocessing
import os
import shutil
import subprocess
import time
from datetime import datetime
from typing import Optional
try:
# Imports are done this way to allow objectstore code to be used outside of Galaxy.
... | """
Object Store plugin for the Amazon Simple Storage Service (S3)
"""
import logging
import multiprocessing
import os
import shutil
import subprocess
import time
from datetime import datetime
from typing import Optional
try:
# Imports are done this way to allow objectstore code to be used outside of Galaxy.
... |
45,919 | /home/hieuvd/dung_repo/raw/stars_03/galaxyproject_galaxy/galaxy | /home/hieuvd/dung_repo/raw/stars_03/galaxyproject_galaxy/galaxy/lib/galaxy/objectstore/s3.py | 761,762 | 752,772 | _configure_connection | GenericS3ObjectStore | 762,772 | 762,772 | class GenericS3ObjectStore(S3ObjectStore):
"""
Object store that stores objects as items in a generic S3 (non AWS) bucket.
A local cache exists that is used as an intermediate location for files between
Galaxy and the S3 storage service.
"""
store_type = "generic_s3"
def _configure_connect... | class GenericS3ObjectStore(S3ObjectStore):
"""
Object store that stores objects as items in a generic S3 (non AWS) bucket.
A local cache exists that is used as an intermediate location for files between
Galaxy and the S3 storage service.
"""
store_type = "generic_s3"
def _configure_connect... | log.debug("Configuring generic S3 Connection")
self.conn = boto.connect_s3(
aws_access_key_id=self.access_key,
aws_secret_access_key=self.secret_key,
is_secure=self.is_secure,
host=self.host,
port=self.port,
calling_format=boto.s3.c... | log.debug("Configuring generic S3 Connection")
self.conn = boto.connect_s3(
aws_access_key_id=self.access_key,
aws_secret_access_key=self.secret_key,
is_secure=self.is_secure,
host=self.host,
port=self.port,
calling_format=boto.s3.c... | 15 | 100 | 133 | 233 | """
Object Store plugin for the Amazon Simple Storage Service (S3)
"""
import logging
import multiprocessing
import os
import shutil
import subprocess
import time
from datetime import datetime
from typing import Optional
try:
# Imports are done this way to allow objectstore code to be used outside of Galaxy.
... | """
Object Store plugin for the Amazon Simple Storage Service (S3)
"""
import logging
import multiprocessing
import os
import shutil
import subprocess
import time
from datetime import datetime
from typing import Optional
try:
# Imports are done this way to allow objectstore code to be used outside of Galaxy.
... |
45,921 | /home/hieuvd/dung_repo/raw/stars_03/galaxyproject_galaxy/galaxy | /home/hieuvd/dung_repo/raw/stars_03/galaxyproject_galaxy/galaxy/lib/galaxy/objectstore/s3_multipart_upload.py | 57,58 | 1,78 | multipart_upload | 59,78 | 58,78 | #!/usr/bin/env python
"""
Split large file into multiple pieces for upload to S3.
This parallelizes the task over available cores using multiprocessing.
Code mostly taken form CloudBioLinux.
"""
import glob
import os
import subprocess
import threading
try:
import boto
from boto.s3.connection import S3Connecti... | #!/usr/bin/env python
"""
Split large file into multiple pieces for upload to S3.
This parallelizes the task over available cores using multiprocessing.
Code mostly taken form CloudBioLinux.
"""
import glob
import os
import subprocess
import threading
try:
import boto
from boto.s3.connection import S3Connecti... |
def split_file(in_file, mb_size, split_num=5):
prefix = os.path.join(os.path.dirname(in_file), f"{os.path.basename(s3_key_name)}S3PART")
max_chunk = s3server["max_chunk_size"]
# Split chunks so they are 5MB < chunk < 250MB(max_chunk_size)
split_size = int(max(min(mb_size / (split_nu... | """Upload large files using Amazon's multipart upload functionality."""
def split_file(in_file, mb_size, split_num=5):
prefix = os.path.join(os.path.dirname(in_file), f"{os.path.basename(s3_key_name)}S3PART")
max_chunk = s3server["max_chunk_size"]
# Split chunks so they are 5MB < chunk ... | 65 | 604 | 358 | 962 | #!/usr/bin/env python
"""
Split large file into multiple pieces for upload to S3.
This parallelizes the task over available cores using multiprocessing.
Code mostly taken form CloudBioLinux.
"""
import glob
import os
import subprocess
import threading
try:
import boto
from boto.s3.connection import S3Connecti... | #!/usr/bin/env python
"""
Split large file into multiple pieces for upload to S3.
This parallelizes the task over available cores using multiprocessing.
Code mostly taken form CloudBioLinux.
"""
import glob
import os
import subprocess
import threading
try:
import boto
from boto.s3.connection import S3Connecti... | |
45,922 | /home/hieuvd/dung_repo/raw/stars_03/galaxyproject_galaxy/galaxy | /home/hieuvd/dung_repo/raw/stars_03/galaxyproject_galaxy/galaxy/lib/galaxy/queues.py | 20,21 | 1,49 | all_control_queues_for_declare | 25,32 | 21,32 | """
All message queues used by Galaxy
"""
import socket
from typing import Optional
from kombu import (
Connection,
Exchange,
Queue,
)
ALL_CONTROL = "control.*"
galaxy_exchange = Exchange("galaxy_core_exchange", type="topic")
def all_control_queues_for_declare(application_stack):
FILL_FUNC_BODYdef co... | """
All message queues used by Galaxy
"""
import socket
from typing import Optional
from kombu import (
Connection,
Exchange,
Queue,
)
ALL_CONTROL = "control.*"
galaxy_exchange = Exchange("galaxy_core_exchange", type="topic")
def all_control_queues_for_declare(application_stack):
"""
For in-m... | # Get all active processes and construct queues for each process
process_names = (
f"{p.server_name}@{p.hostname}" for p in application_stack.app.database_heartbeat.get_active_processes()
)
return [Queue(f"control.{server_name}", galaxy_exchange, routing_key="control.*") for server_name in proce... | """
For in-memory routing (used by sqlalchemy-based transports), we need to be able to
build the entire routing table in producers.
"""
# Get all active processes and construct queues for each process
process_names = (
f"{p.server_name}@{p.hostname}" for p in application_stack.app.databa... | 28 | 357 | 109 | 466 | """
All message queues used by Galaxy
"""
import socket
from typing import Optional
from kombu import (
Connection,
Exchange,
Queue,
)
ALL_CONTROL = "control.*"
galaxy_exchange = Exchange("galaxy_core_exchange", type="topic")
def all_control_queues_for_declare(application_stack):
FILL_FUNC_BODYdef co... | """
All message queues used by Galaxy
"""
import socket
from typing import Optional
from kombu import (
Connection,
Exchange,
Queue,
)
ALL_CONTROL = "control.*"
galaxy_exchange = Exchange("galaxy_core_exchange", type="topic")
def all_control_queues_for_declare(application_stack):
"""
For in-m... | |
45,923 | /home/hieuvd/dung_repo/raw/stars_03/galaxyproject_galaxy/galaxy | /home/hieuvd/dung_repo/raw/stars_03/galaxyproject_galaxy/galaxy/lib/galaxy/schema/bco/util.py | 46,52 | 1,100 | galaxy_execution_domain | 52,66 | 52,66 | """Utilities for working with BCO models.
We don't have a lot of functional code in this schema module so this may belong
somewhere else in another galaxy-data package.
"""
import hashlib
from typing import (
Any,
Dict,
List,
Optional,
)
from galaxy.schema.bco import (
BioComputeObject,
BioCo... | """Utilities for working with BCO models.
We don't have a lot of functional code in this schema module so this may belong
somewhere else in another galaxy-data package.
"""
import hashlib
from typing import (
Any,
Dict,
List,
Optional,
)
from galaxy.schema.bco import (
BioComputeObject,
BioCo... | data_endpoint = ExternalDataEndpoint(
name="Access to Galaxy",
url=url,
)
execution_domain = ExecutionDomain(
script=[_galaxy_script_item(workflow_url)],
script_driver="Galaxy",
software_prerequisites=software_prerequisites or [],
external_data_endpoints=[data... | data_endpoint = ExternalDataEndpoint(
name="Access to Galaxy",
url=url,
)
execution_domain = ExecutionDomain(
script=[_galaxy_script_item(workflow_url)],
script_driver="Galaxy",
software_prerequisites=software_prerequisites or [],
external_data_endpoints=[data... | 23 | 787 | 139 | 926 | """Utilities for working with BCO models.
We don't have a lot of functional code in this schema module so this may belong
somewhere else in another galaxy-data package.
"""
import hashlib
from typing import (
Any,
Dict,
List,
Optional,
)
from galaxy.schema.bco import (
BioComputeObject,
BioCo... | """Utilities for working with BCO models.
We don't have a lot of functional code in this schema module so this may belong
somewhere else in another galaxy-data package.
"""
import hashlib
from typing import (
Any,
Dict,
List,
Optional,
)
from galaxy.schema.bco import (
BioComputeObject,
BioCo... | |
45,924 | /home/hieuvd/dung_repo/raw/stars_03/galaxyproject_galaxy/galaxy | /home/hieuvd/dung_repo/raw/stars_03/galaxyproject_galaxy/galaxy/lib/galaxy/schema/fetch_data.py | 248,251 | 244,256 | targets_string_to_json | BaseDataPayload | 251,256 | 251,256 | class BaseDataPayload(FetchBaseModel):
history_id: DecodedDatabaseIdField
model_config = ConfigDict(extra="allow")
@field_validator("targets", mode="before", check_fields=False)
@classmethod
def targets_string_to_json(cls, v):
FILL_FUNC_BODY | class BaseDataPayload(FetchBaseModel):
history_id: DecodedDatabaseIdField
model_config = ConfigDict(extra="allow")
@field_validator("targets", mode="before", check_fields=False)
@classmethod
def targets_string_to_json(cls, v):
FILL_FUNC_BODY | if isinstance(v, str):
return json.loads(v)
return v
| if isinstance(v, str):
return json.loads(v)
return v
| 7 | 91 | 31 | 122 | import json
from enum import Enum
from typing import (
List,
Optional,
Union,
)
from pydantic import (
ConfigDict,
Field,
field_validator,
Json,
)
from typing_extensions import (
Annotated,
Literal,
)
from galaxy.schema.fields import DecodedDatabaseIdField
from galaxy.schema.schema... | import json
from enum import Enum
from typing import (
List,
Optional,
Union,
)
from pydantic import (
ConfigDict,
Field,
field_validator,
Json,
)
from typing_extensions import (
Annotated,
Literal,
)
from galaxy.schema.fields import DecodedDatabaseIdField
from galaxy.schema.schema... |
45,925 | /home/hieuvd/dung_repo/raw/stars_03/galaxyproject_galaxy/galaxy | /home/hieuvd/dung_repo/raw/stars_03/galaxyproject_galaxy/galaxy/lib/galaxy/schema/fields.py | 30,31 | 1,136 | ensure_valid_id | 31,41 | 31,41 | import re
from typing import (
get_origin,
TYPE_CHECKING,
Union,
)
from pydantic import (
BeforeValidator,
Field,
PlainSerializer,
WithJsonSchema,
)
from typing_extensions import (
Annotated,
get_args,
)
if TYPE_CHECKING:
from galaxy.security.idencoding import IdEncodingHelper
... | import re
from typing import (
get_origin,
TYPE_CHECKING,
Union,
)
from pydantic import (
BeforeValidator,
Field,
PlainSerializer,
WithJsonSchema,
)
from typing_extensions import (
Annotated,
get_args,
)
if TYPE_CHECKING:
from galaxy.security.idencoding import IdEncodingHelper
... | assert isinstance(v, str)
len_v = len(v)
if len_v % ENCODED_ID_LENGTH_MULTIPLE:
raise ValueError("Invalid id length, must be multiple of 16")
m = ENCODED_DATABASE_ID_PATTERN.fullmatch(v.lower())
if not m:
raise ValueError("Invalid characters in encoded ID")
return v
| assert isinstance(v, str)
len_v = len(v)
if len_v % ENCODED_ID_LENGTH_MULTIPLE:
raise ValueError("Invalid id length, must be multiple of 16")
m = ENCODED_DATABASE_ID_PATTERN.fullmatch(v.lower())
if not m:
raise ValueError("Invalid characters in encoded ID")
return v
| 33 | 1,329 | 120 | 1,449 | import re
from typing import (
get_origin,
TYPE_CHECKING,
Union,
)
from pydantic import (
BeforeValidator,
Field,
PlainSerializer,
WithJsonSchema,
)
from typing_extensions import (
Annotated,
get_args,
)
if TYPE_CHECKING:
from galaxy.security.idencoding import IdEncodingHelper
... | import re
from typing import (
get_origin,
TYPE_CHECKING,
Union,
)
from pydantic import (
BeforeValidator,
Field,
PlainSerializer,
WithJsonSchema,
)
from typing_extensions import (
Annotated,
get_args,
)
if TYPE_CHECKING:
from galaxy.security.idencoding import IdEncodingHelper
... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.