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,926 | /home/hieuvd/dung_repo/raw/stars_03/galaxyproject_galaxy/galaxy | /home/hieuvd/dung_repo/raw/stars_03/galaxyproject_galaxy/galaxy/lib/galaxy/schema/generics.py | 45,46 | 44,53 | get_defs_ref | CustomJsonSchema | 46,53 | 46,53 | class CustomJsonSchema(GenerateJsonSchema):
def get_defs_ref(self, core_mode_ref):
FILL_FUNC_BODY | class CustomJsonSchema(GenerateJsonSchema):
def get_defs_ref(self, core_mode_ref):
FILL_FUNC_BODY | full_def = super().get_defs_ref(core_mode_ref)
choices = self._prioritized_defsref_choices[full_def]
ref, mode = core_mode_ref
if ref in ref_to_name:
for i, choice in enumerate(choices):
choices[i] = choice.replace(choices[0], ref_to_name[ref]) # type: ignore... | full_def = super().get_defs_ref(core_mode_ref)
choices = self._prioritized_defsref_choices[full_def]
ref, mode = core_mode_ref
if ref in ref_to_name:
for i, choice in enumerate(choices):
choices[i] = choice.replace(choices[0], ref_to_name[ref]) # type: ignore... | 28 | 39 | 125 | 164 | from typing import (
Any,
Tuple,
Type,
TypeVar,
)
from pydantic import BaseModel
from pydantic.json_schema import GenerateJsonSchema
from galaxy.schema.fields import (
DecodedDatabaseIdField,
EncodedDatabaseIdField,
)
DatabaseIdT = TypeVar("DatabaseIdT")
ref_to_name = {}
class GenericModel... | from typing import (
Any,
Tuple,
Type,
TypeVar,
)
from pydantic import BaseModel
from pydantic.json_schema import GenerateJsonSchema
from galaxy.schema.fields import (
DecodedDatabaseIdField,
EncodedDatabaseIdField,
)
DatabaseIdT = TypeVar("DatabaseIdT")
ref_to_name = {}
class GenericModel... |
45,927 | /home/hieuvd/dung_repo/raw/stars_03/galaxyproject_galaxy/galaxy | /home/hieuvd/dung_repo/raw/stars_03/galaxyproject_galaxy/galaxy/lib/galaxy/schema/generics.py | 22,24 | 21,44 | model_parametrized_name | GenericModel | 24,28 | 24,28 | class GenericModel(BaseModel):
@classmethod
def model_parametrized_name(cls, params: Tuple[Type[Any], ...]) -> str:
FILL_FUNC_BODY @classmethod
def __get_pydantic_core_schema__(cls, *args, **kwargs):
result = super().__get_pydantic_core_schema__(*args, **kwargs)
ref_to_name[result["ref"]]... | class GenericModel(BaseModel):
@classmethod
def model_parametrized_name(cls, params: Tuple[Type[Any], ...]) -> str:
FILL_FUNC_BODY @classmethod
def __get_pydantic_core_schema__(cls, *args, **kwargs):
result = super().__get_pydantic_core_schema__(*args, **kwargs)
ref_to_name[result["ref"]]... | suffix = cls.__determine_suffix__(params)
class_name = cls.__name__.split("Generic", 1)[-1]
return f"{class_name}{suffix}"
| suffix = cls.__determine_suffix__(params)
class_name = cls.__name__.split("Generic", 1)[-1]
return f"{class_name}{suffix}"
| 9 | 215 | 55 | 270 | from typing import (
Any,
Tuple,
Type,
TypeVar,
)
from pydantic import BaseModel
from pydantic.json_schema import GenerateJsonSchema
from galaxy.schema.fields import (
DecodedDatabaseIdField,
EncodedDatabaseIdField,
)
DatabaseIdT = TypeVar("DatabaseIdT")
ref_to_name = {}
class GenericModel... | from typing import (
Any,
Tuple,
Type,
TypeVar,
)
from pydantic import BaseModel
from pydantic.json_schema import GenerateJsonSchema
from galaxy.schema.fields import (
DecodedDatabaseIdField,
EncodedDatabaseIdField,
)
DatabaseIdT = TypeVar("DatabaseIdT")
ref_to_name = {}
class GenericModel... |
45,928 | /home/hieuvd/dung_repo/raw/stars_03/galaxyproject_galaxy/galaxy | /home/hieuvd/dung_repo/raw/stars_03/galaxyproject_galaxy/galaxy/lib/galaxy/schema/jobs.py | 121,124 | 103,129 | decode_json | SearchJobsPayload | 124,129 | 124,129 | class SearchJobsPayload(Model):
tool_id: str = Field(
default=...,
title="Tool ID",
description="The tool ID related to the job.",
)
inputs: Dict[str, Any] = Field(
default=...,
title="Inputs",
description="The inputs of the job.",
)
state: Optional[Jo... | class SearchJobsPayload(Model):
tool_id: str = Field(
default=...,
title="Tool ID",
description="The tool ID related to the job.",
)
inputs: Dict[str, Any] = Field(
default=...,
title="Inputs",
description="The inputs of the job.",
)
state: Optional[Jo... | if isinstance(v, str):
return json.loads(v)
return v
| if isinstance(v, str):
return json.loads(v)
return v
| 7 | 204 | 31 | 235 | import json
from typing import (
Any,
Dict,
List,
Optional,
Union,
)
from pydantic import (
ConfigDict,
Field,
field_validator,
UUID4,
)
from typing_extensions import Literal
from galaxy.schema.fields import (
DecodedDatabaseIdField,
EncodedDatabaseIdField,
)
from galaxy.sc... | import json
from typing import (
Any,
Dict,
List,
Optional,
Union,
)
from pydantic import (
ConfigDict,
Field,
field_validator,
UUID4,
)
from typing_extensions import Literal
from galaxy.schema.fields import (
DecodedDatabaseIdField,
EncodedDatabaseIdField,
)
from galaxy.sc... |
45,929 | /home/hieuvd/dung_repo/raw/stars_03/galaxyproject_galaxy/galaxy | /home/hieuvd/dung_repo/raw/stars_03/galaxyproject_galaxy/galaxy/lib/galaxy/schema/workflows.py | 93,105 | 54,174 | inputs_string_to_json | InvokeWorkflowPayload | 105,109 | 105,109 | class InvokeWorkflowPayload(GetTargetHistoryPayload):
# TODO - Are the descriptions correct?
instance: Optional[bool] = Field(
False,
title="Is instance",
description="True when fetching by Workflow ID, False when fetching by StoredWorkflow ID",
)
scheduler: Optional[str] = Field... | class InvokeWorkflowPayload(GetTargetHistoryPayload):
# TODO - Are the descriptions correct?
instance: Optional[bool] = Field(
False,
title="Is instance",
description="True when fetching by Workflow ID, False when fetching by StoredWorkflow ID",
)
scheduler: Optional[str] = Field... | if isinstance(v, str):
return json.loads(v)
return v
| if isinstance(v, str):
return json.loads(v)
return v
| 7 | 1,111 | 29 | 1,140 | import json
from typing import (
Any,
Dict,
List,
Optional,
Union,
)
from pydantic import (
Field,
field_validator,
)
from galaxy.schema.schema import (
AnnotationField,
InputDataCollectionStep,
InputDataStep,
InputParameterStep,
Model,
Organization,
PauseStep,
... | import json
from typing import (
Any,
Dict,
List,
Optional,
Union,
)
from pydantic import (
Field,
field_validator,
)
from galaxy.schema.schema import (
AnnotationField,
InputDataCollectionStep,
InputDataStep,
InputParameterStep,
Model,
Organization,
PauseStep,
... |
45,931 | /home/hieuvd/dung_repo/raw/stars_03/galaxyproject_galaxy/galaxy | /home/hieuvd/dung_repo/raw/stars_03/galaxyproject_galaxy/galaxy/lib/galaxy/security/idencoding.py | 166,167 | 155,168 | decode_id | IdAsLowercaseAlphanumEncodingHelper | 167,168 | 167,168 | class IdAsLowercaseAlphanumEncodingHelper:
"""
Helper class to encode IDs as lowercase alphanumeric strings, and vice versa
"""
def __init__(self, security: IdEncodingHelper):
self.security = security
def encode_id(self, id: int) -> str:
return hex_to_lowercase_alphanum(self.securi... | class IdAsLowercaseAlphanumEncodingHelper:
"""
Helper class to encode IDs as lowercase alphanumeric strings, and vice versa
"""
def __init__(self, security: IdEncodingHelper):
self.security = security
def encode_id(self, id: int) -> str:
return hex_to_lowercase_alphanum(self.securi... | return self.security.decode_id(lowercase_alphanum_to_hex(id).rjust(16, "0"))
| return self.security.decode_id(lowercase_alphanum_to_hex(id).rjust(16, "0"))
| 3 | 134 | 35 | 169 | import codecs
import collections
import logging
from typing import (
Optional,
Union,
)
from Crypto.Cipher import Blowfish
from Crypto.Random import get_random_bytes
import galaxy.exceptions
from galaxy.util import (
hex_to_lowercase_alphanum,
lowercase_alphanum_to_hex,
smart_str,
unicodify,
)... | import codecs
import collections
import logging
from typing import (
Optional,
Union,
)
from Crypto.Cipher import Blowfish
from Crypto.Random import get_random_bytes
import galaxy.exceptions
from galaxy.util import (
hex_to_lowercase_alphanum,
lowercase_alphanum_to_hex,
smart_str,
unicodify,
)... |
45,932 | /home/hieuvd/dung_repo/raw/stars_03/galaxyproject_galaxy/galaxy | /home/hieuvd/dung_repo/raw/stars_03/galaxyproject_galaxy/galaxy/lib/galaxy/security/idencoding.py | 51,52 | 29,137 | encode_dict_ids | IdEncodingHelper | 56,62 | 52,62 | class IdEncodingHelper:
def __init__(self, **config):
id_secret = config["id_secret"]
self.id_secret = id_secret
self.id_cipher = Blowfish.new(smart_str(self.id_secret), mode=Blowfish.MODE_ECB)
per_kind_id_secret_base = config.get("per_kind_id_secret_base", self.id_secret)
s... | class IdEncodingHelper:
def __init__(self, **config):
id_secret = config["id_secret"]
self.id_secret = id_secret
self.id_cipher = Blowfish.new(smart_str(self.id_secret), mode=Blowfish.MODE_ECB)
per_kind_id_secret_base = config.get("per_kind_id_secret_base", self.id_secret)
s... | for key, val in a_dict.items():
if key == "id" or key.endswith("_id") and (skip_startswith is None or not key.startswith(skip_startswith)):
a_dict[key] = self.encode_id(val, kind=kind)
return a_dict
| """
Encode all ids in dictionary. Ids are identified by (a) an 'id' key or
(b) a key that ends with '_id'
"""
for key, val in a_dict.items():
if key == "id" or key.endswith("_id") and (skip_startswith is None or not key.startswith(skip_startswith)):
a_... | 24 | 1,375 | 90 | 1,465 | import codecs
import collections
import logging
from typing import (
Optional,
Union,
)
from Crypto.Cipher import Blowfish
from Crypto.Random import get_random_bytes
import galaxy.exceptions
from galaxy.util import (
hex_to_lowercase_alphanum,
lowercase_alphanum_to_hex,
smart_str,
unicodify,
)... | import codecs
import collections
import logging
from typing import (
Optional,
Union,
)
from Crypto.Cipher import Blowfish
from Crypto.Random import get_random_bytes
import galaxy.exceptions
from galaxy.util import (
hex_to_lowercase_alphanum,
lowercase_alphanum_to_hex,
smart_str,
unicodify,
)... |
45,933 | /home/hieuvd/dung_repo/raw/stars_03/galaxyproject_galaxy/galaxy | /home/hieuvd/dung_repo/raw/stars_03/galaxyproject_galaxy/galaxy/lib/galaxy/security/passwords.py | 61,62 | 1,71 | pbkdf2_bin | 67,71 | 62,71 | import hashlib
from base64 import b64encode
from os import urandom
from galaxy.util import (
safe_str_cmp,
smart_str,
unicodify,
)
SALT_LENGTH = 12
KEY_LENGTH = 24
HASH_FUNCTION = "sha256"
COST_FACTOR = 100000
def hash_password(password):
"""
Hash a password, currently will use the PBKDF2 scheme... | import hashlib
from base64 import b64encode
from os import urandom
from galaxy.util import (
safe_str_cmp,
smart_str,
unicodify,
)
SALT_LENGTH = 12
KEY_LENGTH = 24
HASH_FUNCTION = "sha256"
COST_FACTOR = 100000
def hash_password(password):
"""
Hash a password, currently will use the PBKDF2 scheme... | data = smart_str(data)
salt = smart_str(salt)
return hashlib.pbkdf2_hmac(hashfunc, data, salt, iterations, keylen)
| """Returns a binary digest for the PBKDF2 hash algorithm of `data`
with the given `salt`. It iterates `iterations` time and produces a
key of `keylen` bytes. By default SHA-256 is used as hash function,
a different hashlib `hashfunc` can be provided.
"""
data = smart_str(data)
salt = smart... | 12 | 767 | 52 | 819 | import hashlib
from base64 import b64encode
from os import urandom
from galaxy.util import (
safe_str_cmp,
smart_str,
unicodify,
)
SALT_LENGTH = 12
KEY_LENGTH = 24
HASH_FUNCTION = "sha256"
COST_FACTOR = 100000
def hash_password(password):
"""
Hash a password, currently will use the PBKDF2 scheme... | import hashlib
from base64 import b64encode
from os import urandom
from galaxy.util import (
safe_str_cmp,
smart_str,
unicodify,
)
SALT_LENGTH = 12
KEY_LENGTH = 24
HASH_FUNCTION = "sha256"
COST_FACTOR = 100000
def hash_password(password):
"""
Hash a password, currently will use the PBKDF2 scheme... | |
45,934 | /home/hieuvd/dung_repo/raw/stars_03/galaxyproject_galaxy/galaxy | /home/hieuvd/dung_repo/raw/stars_03/galaxyproject_galaxy/galaxy/lib/galaxy/security/ssh_util.py | 14,15 | 1,26 | generate_ssh_keys | 16,26 | 15,26 | import tempfile
from typing import NamedTuple
from Crypto.PublicKey import RSA
class SSHKeys(NamedTuple):
private_key: bytes
public_key: bytes
private_key_file: str
public_key_file: str
def generate_ssh_keys() -> SSHKeys:
FILL_FUNC_BODY | import tempfile
from typing import NamedTuple
from Crypto.PublicKey import RSA
class SSHKeys(NamedTuple):
private_key: bytes
public_key: bytes
private_key_file: str
public_key_file: str
def generate_ssh_keys() -> SSHKeys:
"""Returns a named tuple with private and public key and their paths."""
... | key = RSA.generate(2048)
private_key = key.export_key()
public_key = key.publickey().export_key(format="OpenSSH")
with tempfile.NamedTemporaryFile(delete=False) as f:
f.write(private_key)
private_key_file = f.name
with tempfile.NamedTemporaryFile(delete=False) as f:
f.write(p... | """Returns a named tuple with private and public key and their paths."""
key = RSA.generate(2048)
private_key = key.export_key()
public_key = key.publickey().export_key(format="OpenSSH")
with tempfile.NamedTemporaryFile(delete=False) as f:
f.write(private_key)
private_key_file = f.na... | 30 | 108 | 162 | 270 | import tempfile
from typing import NamedTuple
from Crypto.PublicKey import RSA
class SSHKeys(NamedTuple):
private_key: bytes
public_key: bytes
private_key_file: str
public_key_file: str
def generate_ssh_keys() -> SSHKeys:
FILL_FUNC_BODY | import tempfile
from typing import NamedTuple
from Crypto.PublicKey import RSA
class SSHKeys(NamedTuple):
private_key: bytes
public_key: bytes
private_key_file: str
public_key_file: str
def generate_ssh_keys() -> SSHKeys:
"""Returns a named tuple with private and public key and their paths."""
... | |
45,935 | /home/hieuvd/dung_repo/raw/stars_03/galaxyproject_galaxy/galaxy | /home/hieuvd/dung_repo/raw/stars_03/galaxyproject_galaxy/galaxy/lib/galaxy/security/vault.py | 196,197 | 172,200 | list_secrets | CustosVault | 197,200 | 197,200 | class CustosVault(Vault):
def __init__(self, config):
if not custos_sdk_available:
raise InvalidVaultConfigException(
"Custos sdk library 'custos-sdk' is not available. Make sure the custos-sdk is installed."
)
custos_settings = CustosServerClientSettings(
... | class CustosVault(Vault):
def __init__(self, config):
if not custos_sdk_available:
raise InvalidVaultConfigException(
"Custos sdk library 'custos-sdk' is not available. Make sure the custos-sdk is installed."
)
custos_settings = CustosServerClientSettings(
... | raise NotImplementedError()
| raise NotImplementedError()
| 2 | 326 | 14 | 340 | import abc
import logging
import os
import re
from typing import (
List,
Optional,
)
import yaml
from cryptography.fernet import (
Fernet,
MultiFernet,
)
from sqlalchemy import select
try:
from custos.clients.resource_secret_management_client import ResourceSecretManagementClient
from custos.c... | import abc
import logging
import os
import re
from typing import (
List,
Optional,
)
import yaml
from cryptography.fernet import (
Fernet,
MultiFernet,
)
from sqlalchemy import select
try:
from custos.clients.resource_secret_management_client import ResourceSecretManagementClient
from custos.c... |
45,936 | /home/hieuvd/dung_repo/raw/stars_03/galaxyproject_galaxy/galaxy | /home/hieuvd/dung_repo/raw/stars_03/galaxyproject_galaxy/galaxy/lib/galaxy/security/vault.py | 152,153 | 124,172 | read_secret | DatabaseVault | 153,159 | 153,159 | class DatabaseVault(Vault):
def __init__(self, sa_session, config):
self.sa_session = sa_session
self.encryption_keys = config.get("encryption_keys")
self.fernet_keys = [Fernet(key.encode("utf-8")) for key in self.encryption_keys]
def _get_multi_fernet(self) -> MultiFernet:
retu... | class DatabaseVault(Vault):
def __init__(self, sa_session, config):
self.sa_session = sa_session
self.encryption_keys = config.get("encryption_keys")
self.fernet_keys = [Fernet(key.encode("utf-8")) for key in self.encryption_keys]
def _get_multi_fernet(self) -> MultiFernet:
retu... | key_obj = self._get_vault_value(key)
if key_obj and key_obj.value:
f = self._get_multi_fernet()
return f.decrypt(key_obj.value.encode("utf-8")).decode("utf-8")
return None
| key_obj = self._get_vault_value(key)
if key_obj and key_obj.value:
f = self._get_multi_fernet()
return f.decrypt(key_obj.value.encode("utf-8")).decode("utf-8")
return None
| 14 | 543 | 82 | 625 | import abc
import logging
import os
import re
from typing import (
List,
Optional,
)
import yaml
from cryptography.fernet import (
Fernet,
MultiFernet,
)
from sqlalchemy import select
try:
from custos.clients.resource_secret_management_client import ResourceSecretManagementClient
from custos.c... | import abc
import logging
import os
import re
from typing import (
List,
Optional,
)
import yaml
from cryptography.fernet import (
Fernet,
MultiFernet,
)
from sqlalchemy import select
try:
from custos.clients.resource_secret_management_client import ResourceSecretManagementClient
from custos.c... |
45,937 | /home/hieuvd/dung_repo/raw/stars_03/galaxyproject_galaxy/galaxy | /home/hieuvd/dung_repo/raw/stars_03/galaxyproject_galaxy/galaxy/lib/galaxy/security/vault.py | 117,118 | 100,124 | write_secret | HashicorpVault | 118,120 | 118,120 | class HashicorpVault(Vault):
def __init__(self, config):
if not hvac:
raise InvalidVaultConfigException(
"Hashicorp vault library 'hvac' is not available. Make sure hvac is installed."
)
self.vault_address = config.get("vault_address")
self.vault_token... | class HashicorpVault(Vault):
def __init__(self, config):
if not hvac:
raise InvalidVaultConfigException(
"Hashicorp vault library 'hvac' is not available. Make sure hvac is installed."
)
self.vault_address = config.get("vault_address")
self.vault_token... | self.client.secrets.kv.v2.create_or_update_secret(path=key, secret={"value": value})
| self.client.secrets.kv.v2.create_or_update_secret(path=key, secret={"value": value})
| 3 | 278 | 38 | 316 | import abc
import logging
import os
import re
from typing import (
List,
Optional,
)
import yaml
from cryptography.fernet import (
Fernet,
MultiFernet,
)
from sqlalchemy import select
try:
from custos.clients.resource_secret_management_client import ResourceSecretManagementClient
from custos.c... | import abc
import logging
import os
import re
from typing import (
List,
Optional,
)
import yaml
from cryptography.fernet import (
Fernet,
MultiFernet,
)
from sqlalchemy import select
try:
from custos.clients.resource_secret_management_client import ResourceSecretManagementClient
from custos.c... |
45,938 | /home/hieuvd/dung_repo/raw/stars_03/galaxyproject_galaxy/galaxy | /home/hieuvd/dung_repo/raw/stars_03/galaxyproject_galaxy/galaxy/lib/galaxy/security/vault.py | 91,92 | 85,100 | write_secret | NullVault | 92,96 | 92,96 | class NullVault(Vault):
def read_secret(self, key: str) -> Optional[str]:
raise InvalidVaultConfigException(
"No vault configured. Make sure the vault_config_file setting is defined in galaxy.yml"
)
def write_secret(self, key: str, value: str) -> None:
FILL_FUNC_BODY def list_sec... | class NullVault(Vault):
def read_secret(self, key: str) -> Optional[str]:
raise InvalidVaultConfigException(
"No vault configured. Make sure the vault_config_file setting is defined in galaxy.yml"
)
def write_secret(self, key: str, value: str) -> None:
FILL_FUNC_BODY def list_sec... | raise InvalidVaultConfigException(
"No vault configured. Make sure the vault_config_file setting is defined in galaxy.yml"
)
| raise InvalidVaultConfigException(
"No vault configured. Make sure the vault_config_file setting is defined in galaxy.yml"
)
| 15 | 128 | 41 | 169 | import abc
import logging
import os
import re
from typing import (
List,
Optional,
)
import yaml
from cryptography.fernet import (
Fernet,
MultiFernet,
)
from sqlalchemy import select
try:
from custos.clients.resource_secret_management_client import ResourceSecretManagementClient
from custos.c... | import abc
import logging
import os
import re
from typing import (
List,
Optional,
)
import yaml
from cryptography.fernet import (
Fernet,
MultiFernet,
)
from sqlalchemy import select
try:
from custos.clients.resource_secret_management_client import ResourceSecretManagementClient
from custos.c... |
45,939 | /home/hieuvd/dung_repo/raw/stars_03/galaxyproject_galaxy/galaxy | /home/hieuvd/dung_repo/raw/stars_03/galaxyproject_galaxy/galaxy/lib/galaxy/security/vault.py | 211,212 | 200,218 | write_secret | UserVaultWrapper | 212,214 | 212,214 | class UserVaultWrapper(Vault):
def __init__(self, vault: Vault, user):
self.vault = vault
self.user = user
def read_secret(self, key: str) -> Optional[str]:
if self.user:
return self.vault.read_secret(f"user/{self.user.id}/{key}")
else:
return None
d... | class UserVaultWrapper(Vault):
def __init__(self, vault: Vault, user):
self.vault = vault
self.user = user
def read_secret(self, key: str) -> Optional[str]:
if self.user:
return self.vault.read_secret(f"user/{self.user.id}/{key}")
else:
return None
d... | return self.vault.write_secret(f"user/{self.user.id}/{key}", value)
| return self.vault.write_secret(f"user/{self.user.id}/{key}", value)
| 3 | 165 | 31 | 196 | import abc
import logging
import os
import re
from typing import (
List,
Optional,
)
import yaml
from cryptography.fernet import (
Fernet,
MultiFernet,
)
from sqlalchemy import select
try:
from custos.clients.resource_secret_management_client import ResourceSecretManagementClient
from custos.c... | import abc
import logging
import os
import re
from typing import (
List,
Optional,
)
import yaml
from cryptography.fernet import (
Fernet,
MultiFernet,
)
from sqlalchemy import select
try:
from custos.clients.resource_secret_management_client import ResourceSecretManagementClient
from custos.c... |
45,940 | /home/hieuvd/dung_repo/raw/stars_03/galaxyproject_galaxy/galaxy | /home/hieuvd/dung_repo/raw/stars_03/galaxyproject_galaxy/galaxy/lib/galaxy/security/vault.py | 281,283 | 273,302 | from_vault_type | VaultFactory | 283,295 | 283,295 | class VaultFactory:
@staticmethod
def load_vault_config(vault_conf_yml: str) -> Optional[dict]:
if os.path.exists(vault_conf_yml):
with open(vault_conf_yml) as f:
return yaml.safe_load(f)
return None
@staticmethod
def from_vault_type(app, vault_type: Optional... | class VaultFactory:
@staticmethod
def load_vault_config(vault_conf_yml: str) -> Optional[dict]:
if os.path.exists(vault_conf_yml):
with open(vault_conf_yml) as f:
return yaml.safe_load(f)
return None
@staticmethod
def from_vault_type(app, vault_type: Optional... | vault: Vault
if vault_type == "hashicorp":
vault = HashicorpVault(cfg)
elif vault_type == "database":
vault = DatabaseVault(app.model.context, cfg)
elif vault_type == "custos":
vault = CustosVault(cfg)
else:
raise InvalidVaultConfig... | vault: Vault
if vault_type == "hashicorp":
vault = HashicorpVault(cfg)
elif vault_type == "database":
vault = DatabaseVault(app.model.context, cfg)
elif vault_type == "custos":
vault = CustosVault(cfg)
else:
raise InvalidVaultConfig... | 38 | 249 | 167 | 416 | import abc
import logging
import os
import re
from typing import (
List,
Optional,
)
import yaml
from cryptography.fernet import (
Fernet,
MultiFernet,
)
from sqlalchemy import select
try:
from custos.clients.resource_secret_management_client import ResourceSecretManagementClient
from custos.c... | import abc
import logging
import os
import re
from typing import (
List,
Optional,
)
import yaml
from cryptography.fernet import (
Fernet,
MultiFernet,
)
from sqlalchemy import select
try:
from custos.clients.resource_secret_management_client import ResourceSecretManagementClient
from custos.c... |
45,941 | /home/hieuvd/dung_repo/raw/stars_03/galaxyproject_galaxy/galaxy | /home/hieuvd/dung_repo/raw/stars_03/galaxyproject_galaxy/galaxy/lib/galaxy/security/vault.py | 266,267 | 254,273 | write_secret | VaultKeyPrefixWrapper | 267,269 | 267,269 | class VaultKeyPrefixWrapper(Vault):
"""
Adds a prefix to all vault keys, such as the galaxy instance id
"""
def __init__(self, vault: Vault, prefix: str):
self.vault = vault
self.prefix = prefix.strip("/")
def read_secret(self, key: str) -> Optional[str]:
return self.vault.... | class VaultKeyPrefixWrapper(Vault):
"""
Adds a prefix to all vault keys, such as the galaxy instance id
"""
def __init__(self, vault: Vault, prefix: str):
self.vault = vault
self.prefix = prefix.strip("/")
def read_secret(self, key: str) -> Optional[str]:
return self.vault.... | return self.vault.write_secret(f"/{self.prefix}/{key}", value)
| return self.vault.write_secret(f"/{self.prefix}/{key}", value)
| 3 | 178 | 28 | 206 | import abc
import logging
import os
import re
from typing import (
List,
Optional,
)
import yaml
from cryptography.fernet import (
Fernet,
MultiFernet,
)
from sqlalchemy import select
try:
from custos.clients.resource_secret_management_client import ResourceSecretManagementClient
from custos.c... | import abc
import logging
import os
import re
from typing import (
List,
Optional,
)
import yaml
from cryptography.fernet import (
Fernet,
MultiFernet,
)
from sqlalchemy import select
try:
from custos.clients.resource_secret_management_client import ResourceSecretManagementClient
from custos.c... |
45,942 | /home/hieuvd/dung_repo/raw/stars_03/galaxyproject_galaxy/galaxy | /home/hieuvd/dung_repo/raw/stars_03/galaxyproject_galaxy/galaxy/lib/galaxy/security/vault.py | 242,243 | 218,254 | read_secret | VaultKeyValidationWrapper | 243,246 | 243,246 | class VaultKeyValidationWrapper(Vault):
"""
A decorator to standardize and validate vault key paths
"""
def __init__(self, vault: Vault):
self.vault = vault
@staticmethod
def validate_key(key):
if not key:
return False
return not VAULT_KEY_INVALID_REGEX.sear... | class VaultKeyValidationWrapper(Vault):
"""
A decorator to standardize and validate vault key paths
"""
def __init__(self, vault: Vault):
self.vault = vault
@staticmethod
def validate_key(key):
if not key:
return False
return not VAULT_KEY_INVALID_REGEX.sear... | key = self.normalize_key(key)
return self.vault.read_secret(key)
| key = self.normalize_key(key)
return self.vault.read_secret(key)
| 5 | 311 | 31 | 342 | import abc
import logging
import os
import re
from typing import (
List,
Optional,
)
import yaml
from cryptography.fernet import (
Fernet,
MultiFernet,
)
from sqlalchemy import select
try:
from custos.clients.resource_secret_management_client import ResourceSecretManagementClient
from custos.c... | import abc
import logging
import os
import re
from typing import (
List,
Optional,
)
import yaml
from cryptography.fernet import (
Fernet,
MultiFernet,
)
from sqlalchemy import select
try:
from custos.clients.resource_secret_management_client import ResourceSecretManagementClient
from custos.c... |
45,943 | /home/hieuvd/dung_repo/raw/stars_03/galaxyproject_galaxy/galaxy | /home/hieuvd/dung_repo/raw/stars_03/galaxyproject_galaxy/galaxy/lib/galaxy/selenium/cli.py | 18,19 | 1,104 | add_selenium_arguments | 20,57 | 19,57 | REMOTE_DESCRIPTION = "Use a remote driver for selenium connection."
BROWSER_DESCRIPTION = "Use specific browser for selenium (e.g. firefox or chrome)."
REMOTE_HOST_DESCRIPTION = "Selenium hub remote host to use (if remote driver in use)."
REMOTE_PORT_DESCRIPTION = "Selenium hub remote port to use (if remote driver in u... | REMOTE_DESCRIPTION = "Use a remote driver for selenium connection."
BROWSER_DESCRIPTION = "Use specific browser for selenium (e.g. firefox or chrome)."
REMOTE_HOST_DESCRIPTION = "Selenium hub remote host to use (if remote driver in use)."
REMOTE_PORT_DESCRIPTION = "Selenium hub remote port to use (if remote driver in u... |
parser.add_argument(
"--selenium-browser",
default="auto",
help=BROWSER_DESCRIPTION,
)
parser.add_argument(
"--selenium-headless",
default=False,
action="store_true",
help=HEADLESS_DESCRIPTION,
)
parser.add_argument(
"--selenium-remote... | """Add common selenium arguments for argparse driver utility."""
parser.add_argument(
"--selenium-browser",
default="auto",
help=BROWSER_DESCRIPTION,
)
parser.add_argument(
"--selenium-headless",
default=False,
action="store_true",
help=HEADLESS_D... | 34 | 617 | 344 | 961 | REMOTE_DESCRIPTION = "Use a remote driver for selenium connection."
BROWSER_DESCRIPTION = "Use specific browser for selenium (e.g. firefox or chrome)."
REMOTE_HOST_DESCRIPTION = "Selenium hub remote host to use (if remote driver in use)."
REMOTE_PORT_DESCRIPTION = "Selenium hub remote port to use (if remote driver in u... | REMOTE_DESCRIPTION = "Use a remote driver for selenium connection."
BROWSER_DESCRIPTION = "Use specific browser for selenium (e.g. firefox or chrome)."
REMOTE_HOST_DESCRIPTION = "Selenium hub remote host to use (if remote driver in use)."
REMOTE_PORT_DESCRIPTION = "Selenium hub remote port to use (if remote driver in u... | |
45,944 | /home/hieuvd/dung_repo/raw/stars_03/galaxyproject_galaxy/galaxy | /home/hieuvd/dung_repo/raw/stars_03/galaxyproject_galaxy/galaxy/lib/galaxy/selenium/cli.py | 89,90 | 57,104 | finish | DriverWrapper | 90,104 | 90,104 | class DriverWrapper(NavigatesGalaxy):
"""Adapt argparse command-line options to a concrete Selenium driver."""
def __init__(self, args):
browser = args.selenium_browser
self.display = virtual_display_if_enabled(args.selenium_headless)
if args.selenium_remote:
driver = get_re... | class DriverWrapper(NavigatesGalaxy):
"""Adapt argparse command-line options to a concrete Selenium driver."""
def __init__(self, args):
browser = args.selenium_browser
self.display = virtual_display_if_enabled(args.selenium_headless)
if args.selenium_remote:
driver = get_re... | exception = None
try:
self.driver.close()
except Exception as e:
exception = e
try:
self.display.stop()
except Exception as e:
exception = e
if exception is not None:
raise exception
| exception = None
try:
self.driver.close()
except Exception as e:
exception = e
try:
self.display.stop()
except Exception as e:
exception = e
if exception is not None:
raise exception
| 28 | 296 | 82 | 378 | REMOTE_DESCRIPTION = "Use a remote driver for selenium connection."
BROWSER_DESCRIPTION = "Use specific browser for selenium (e.g. firefox or chrome)."
REMOTE_HOST_DESCRIPTION = "Selenium hub remote host to use (if remote driver in use)."
REMOTE_PORT_DESCRIPTION = "Selenium hub remote port to use (if remote driver in u... | REMOTE_DESCRIPTION = "Use a remote driver for selenium connection."
BROWSER_DESCRIPTION = "Use specific browser for selenium (e.g. firefox or chrome)."
REMOTE_HOST_DESCRIPTION = "Selenium hub remote host to use (if remote driver in use)."
REMOTE_PORT_DESCRIPTION = "Selenium hub remote port to use (if remote driver in u... |
45,945 | /home/hieuvd/dung_repo/raw/stars_03/galaxyproject_galaxy/galaxy | /home/hieuvd/dung_repo/raw/stars_03/galaxyproject_galaxy/galaxy/lib/galaxy/selenium/context.py | 66,67 | 1,76 | init | 67,76 | 67,76 | import os
from abc import abstractmethod
from typing import Optional
from urllib.parse import urljoin
import yaml
from .driver_factory import ConfiguredDriver
from .navigates_galaxy import NavigatesGalaxy
class GalaxySeleniumContext(NavigatesGalaxy):
url: str
target_url_from_selenium: str
configured_dri... | import os
from abc import abstractmethod
from typing import Optional
from urllib.parse import urljoin
import yaml
from .driver_factory import ConfiguredDriver
from .navigates_galaxy import NavigatesGalaxy
class GalaxySeleniumContext(NavigatesGalaxy):
url: str
target_url_from_selenium: str
configured_dri... | if os.path.exists("galaxy_selenium_context.yml"):
with open("galaxy_selenium_context.yml") as f:
as_dict = yaml.safe_load(f)
context = clazz(as_dict)
else:
config = config or {}
context = clazz(config)
return context
| if os.path.exists("galaxy_selenium_context.yml"):
with open("galaxy_selenium_context.yml") as f:
as_dict = yaml.safe_load(f)
context = clazz(as_dict)
else:
config = config or {}
context = clazz(config)
return context
| 23 | 718 | 102 | 820 | import os
from abc import abstractmethod
from typing import Optional
from urllib.parse import urljoin
import yaml
from .driver_factory import ConfiguredDriver
from .navigates_galaxy import NavigatesGalaxy
class GalaxySeleniumContext(NavigatesGalaxy):
url: str
target_url_from_selenium: str
configured_dri... | import os
from abc import abstractmethod
from typing import Optional
from urllib.parse import urljoin
import yaml
from .driver_factory import ConfiguredDriver
from .navigates_galaxy import NavigatesGalaxy
class GalaxySeleniumContext(NavigatesGalaxy):
url: str
target_url_from_selenium: str
configured_dri... | |
45,946 | /home/hieuvd/dung_repo/raw/stars_03/galaxyproject_galaxy/galaxy | /home/hieuvd/dung_repo/raw/stars_03/galaxyproject_galaxy/galaxy/lib/galaxy/selenium/context.py | 28,29 | 12,48 | screenshot | GalaxySeleniumContext | 36,43 | 29,43 | class GalaxySeleniumContext(NavigatesGalaxy):
url: str
target_url_from_selenium: str
configured_driver: ConfiguredDriver
def build_url(self, url: str, for_selenium: bool = True) -> str:
if for_selenium:
base = self.target_url_from_selenium
else:
base = self.url
... | class GalaxySeleniumContext(NavigatesGalaxy):
url: str
target_url_from_selenium: str
configured_driver: ConfiguredDriver
def build_url(self, url: str, for_selenium: bool = True) -> str:
if for_selenium:
base = self.target_url_from_selenium
else:
base = self.url
... | target = self._screenshot_path(label)
if target is None:
return
self.driver.save_screenshot(target)
return target
| """If GALAXY_TEST_SCREENSHOTS_DIRECTORY is set create a screenshot there named <label>.png.
Unlike the above "snapshot" feature, this will be written out regardless and not in a per-test
directory. The above method is used for debugging failures within a specific test. This method
if mo... | 11 | 317 | 49 | 366 | import os
from abc import abstractmethod
from typing import Optional
from urllib.parse import urljoin
import yaml
from .driver_factory import ConfiguredDriver
from .navigates_galaxy import NavigatesGalaxy
class GalaxySeleniumContext(NavigatesGalaxy):
url: str
target_url_from_selenium: str
configured_dri... | import os
from abc import abstractmethod
from typing import Optional
from urllib.parse import urljoin
import yaml
from .driver_factory import ConfiguredDriver
from .navigates_galaxy import NavigatesGalaxy
class GalaxySeleniumContext(NavigatesGalaxy):
url: str
target_url_from_selenium: str
configured_dri... |
45,947 | /home/hieuvd/dung_repo/raw/stars_03/galaxyproject_galaxy/galaxy | /home/hieuvd/dung_repo/raw/stars_03/galaxyproject_galaxy/galaxy/lib/galaxy/selenium/context.py | 62,63 | 48,66 | _screenshot_path | GalaxySeleniumContextImpl | 63,66 | 63,66 | class GalaxySeleniumContextImpl(GalaxySeleniumContext):
"""Minimal, simplified GalaxySeleniumContext useful outside the context of test cases.
A variant of this concept that can also populate content via the API
to then interact with via the Selenium is :class:`galaxy_test.selenium.framework.GalaxySelenium... | class GalaxySeleniumContextImpl(GalaxySeleniumContext):
"""Minimal, simplified GalaxySeleniumContext useful outside the context of test cases.
A variant of this concept that can also populate content via the API
to then interact with via the Selenium is :class:`galaxy_test.selenium.framework.GalaxySelenium... | return label + extension
| return label + extension
| 4 | 273 | 11 | 284 | import os
from abc import abstractmethod
from typing import Optional
from urllib.parse import urljoin
import yaml
from .driver_factory import ConfiguredDriver
from .navigates_galaxy import NavigatesGalaxy
class GalaxySeleniumContext(NavigatesGalaxy):
url: str
target_url_from_selenium: str
configured_dri... | import os
from abc import abstractmethod
from typing import Optional
from urllib.parse import urljoin
import yaml
from .driver_factory import ConfiguredDriver
from .navigates_galaxy import NavigatesGalaxy
class GalaxySeleniumContext(NavigatesGalaxy):
url: str
target_url_from_selenium: str
configured_dri... |
45,948 | /home/hieuvd/dung_repo/raw/stars_03/galaxyproject_galaxy/galaxy | /home/hieuvd/dung_repo/raw/stars_03/galaxyproject_galaxy/galaxy/lib/galaxy/selenium/scripts/dump_tour.py | 13,14 | 1,53 | main | 14,30 | 14,30 | #!/usr/bin/env python
import argparse
import datetime
import os
import sys
import time
from galaxy.selenium import cli
DESCRIPTION = "Walk a Galaxy tour and dump screenshots."
def main(argv=None):
FILL_FUNC_BODYclass DumpTourCallback:
driver_wrapper: cli.DriverWrapper
def __init__(self, driver_wrapper, out... | #!/usr/bin/env python
import argparse
import datetime
import os
import sys
import time
from galaxy.selenium import cli
DESCRIPTION = "Walk a Galaxy tour and dump screenshots."
def main(argv=None):
FILL_FUNC_BODYclass DumpTourCallback:
driver_wrapper: cli.DriverWrapper
def __init__(self, driver_wrapper, out... | if argv is None:
argv = sys.argv[1:]
args = _arg_parser().parse_args(argv)
driver_wrapper = cli.DriverWrapper(args)
output = args.output
assert output is not None
output = output.replace("TIMESTAMP", datetime.datetime.now().strftime("%Y%m%d%H%M%s"))
if os.path.exists(output):
... | if argv is None:
argv = sys.argv[1:]
args = _arg_parser().parse_args(argv)
driver_wrapper = cli.DriverWrapper(args)
output = args.output
assert output is not None
output = output.replace("TIMESTAMP", datetime.datetime.now().strftime("%Y%m%d%H%M%s"))
if os.path.exists(output):
... | 41 | 319 | 194 | 513 | #!/usr/bin/env python
import argparse
import datetime
import os
import sys
import time
from galaxy.selenium import cli
DESCRIPTION = "Walk a Galaxy tour and dump screenshots."
def main(argv=None):
FILL_FUNC_BODYclass DumpTourCallback:
driver_wrapper: cli.DriverWrapper
def __init__(self, driver_wrapper, out... | #!/usr/bin/env python
import argparse
import datetime
import os
import sys
import time
from galaxy.selenium import cli
DESCRIPTION = "Walk a Galaxy tour and dump screenshots."
def main(argv=None):
FILL_FUNC_BODYclass DumpTourCallback:
driver_wrapper: cli.DriverWrapper
def __init__(self, driver_wrapper, out... | |
45,949 | /home/hieuvd/dung_repo/raw/stars_03/galaxyproject_galaxy/galaxy | /home/hieuvd/dung_repo/raw/stars_03/galaxyproject_galaxy/galaxy/lib/galaxy/selenium/scripts/dump_tour.py | 37,38 | 30,43 | handle_step | DumpTourCallback | 38,43 | 38,43 | class DumpTourCallback:
driver_wrapper: cli.DriverWrapper
def __init__(self, driver_wrapper, output):
self.driver_wrapper = driver_wrapper
self.output = output
def handle_step(self, step, step_index):
FILL_FUNC_BODY | class DumpTourCallback:
driver_wrapper: cli.DriverWrapper
def __init__(self, driver_wrapper, output):
self.driver_wrapper = driver_wrapper
self.output = output
def handle_step(self, step, step_index):
FILL_FUNC_BODY | time.sleep(0.5)
self.driver_wrapper.driver.save_screenshot("%s/%i.png" % (self.output, step_index))
time.sleep(0.5)
| time.sleep(0.5)
self.driver_wrapper.driver.save_screenshot("%s/%i.png" % (self.output, step_index))
time.sleep(0.5)
| 6 | 78 | 59 | 137 | #!/usr/bin/env python
import argparse
import datetime
import os
import sys
import time
from galaxy.selenium import cli
DESCRIPTION = "Walk a Galaxy tour and dump screenshots."
def main(argv=None):
if argv is None:
argv = sys.argv[1:]
args = _arg_parser().parse_args(argv)
driver_wrapper = cli.Dr... | #!/usr/bin/env python
import argparse
import datetime
import os
import sys
import time
from galaxy.selenium import cli
DESCRIPTION = "Walk a Galaxy tour and dump screenshots."
def main(argv=None):
if argv is None:
argv = sys.argv[1:]
args = _arg_parser().parse_args(argv)
driver_wrapper = cli.Dr... |
45,950 | /home/hieuvd/dung_repo/raw/stars_03/galaxyproject_galaxy/galaxy | /home/hieuvd/dung_repo/raw/stars_03/galaxyproject_galaxy/galaxy/lib/galaxy/selenium/toolbox/filters.py | 1,2 | 1,10 | restrict_test | 7,10 | 2,10 | def restrict_test(context, section):
FILL_FUNC_BODY | def restrict_test(context, section):
"""
Disable the Test Section section
This tool filter will disable the Test Section section.
"""
FILL_FUNC_BODY | if section.name == "Test Section":
return False
return True
| """
Disable the Test Section section
This tool filter will disable the Test Section section.
"""
if section.name == "Test Section":
return False
return True
| 9 | 47 | 22 | 69 | def restrict_test(context, section):
FILL_FUNC_BODY | def restrict_test(context, section):
"""
Disable the Test Section section
This tool filter will disable the Test Section section.
"""
FILL_FUNC_BODY | |
45,951 | /home/hieuvd/dung_repo/raw/stars_03/galaxyproject_galaxy/galaxy | /home/hieuvd/dung_repo/raw/stars_03/galaxyproject_galaxy/galaxy/lib/galaxy/tool_shed/cache.py | 48,57 | 18,71 | get_installed_repository | ToolShedRepositoryCache | 57,71 | 57,71 | class ToolShedRepositoryCache:
"""
Cache installed ToolShedRepository objects.
"""
local_repositories: List[ToolConfRepository]
repositories: List[ToolShedRepository]
repos_by_tuple: Dict[Tuple[str, str, str], List[ToolConfRepository]]
def __init__(self, session: install_model_scoped_sessi... | class ToolShedRepositoryCache:
"""
Cache installed ToolShedRepository objects.
"""
local_repositories: List[ToolConfRepository]
repositories: List[ToolShedRepository]
repos_by_tuple: Dict[Tuple[str, str, str], List[ToolConfRepository]]
def __init__(self, session: install_model_scoped_sessi... | if repository_id:
repos = [repo for repo in self.repositories if repo.id == repository_id]
if repos:
return repos[0]
else:
return None
repos = self.repos_by_tuple[(tool_shed, owner, name)]
for repo in repos:
if insta... | if repository_id:
repos = [repo for repo in self.repositories if repo.id == repository_id]
if repos:
return repos[0]
else:
return None
repos = self.repos_by_tuple[(tool_shed, owner, name)]
for repo in repos:
if insta... | 47 | 452 | 167 | 619 | import logging
from collections import defaultdict
from typing import (
Dict,
List,
Tuple,
)
from sqlalchemy.orm import defer
from galaxy.model.scoped_session import install_model_scoped_session
from galaxy.model.tool_shed_install import ToolShedRepository
from galaxy.tool_util.toolbox.base import ToolCon... | import logging
from collections import defaultdict
from typing import (
Dict,
List,
Tuple,
)
from sqlalchemy.orm import defer
from galaxy.model.scoped_session import install_model_scoped_session
from galaxy.model.tool_shed_install import ToolShedRepository
from galaxy.tool_util.toolbox.base import ToolCon... |
45,952 | /home/hieuvd/dung_repo/raw/stars_03/galaxyproject_galaxy/galaxy | /home/hieuvd/dung_repo/raw/stars_03/galaxyproject_galaxy/galaxy/lib/galaxy/tool_shed/galaxy_install/client.py | 35,35 | 29,38 | write_bundle | DataManagerInterface | 35,36 | 35,36 | class DataManagerInterface(Protocol):
GUID_TYPE: str = "data_manager"
DEFAULT_VERSION: str = "0.0.1"
def process_result(self, out_data): ...
FILL_FUNC_BODY
| class DataManagerInterface(Protocol):
GUID_TYPE: str = "data_manager"
DEFAULT_VERSION: str = "0.0.1"
def process_result(self, out_data): ...
FILL_FUNC_BODY
| def write_bundle(self, out: Dict[str, OutputDataset]) -> Dict[str, OutputDataset]: ...
| def write_bundle(self, out: Dict[str, OutputDataset]) -> Dict[str, OutputDataset]: ...
| 9 | 65 | 33 | 98 | import threading
from typing import (
Any,
Dict,
Generic,
List,
Optional,
TYPE_CHECKING,
TypeVar,
Union,
)
from typing_extensions import Protocol
from galaxy.model.base import ModelMapping
from galaxy.model.tool_shed_install import HasToolBox
from galaxy.security.idencoding import IdEn... | import threading
from typing import (
Any,
Dict,
Generic,
List,
Optional,
TYPE_CHECKING,
TypeVar,
Union,
)
from typing_extensions import Protocol
from galaxy.model.base import ModelMapping
from galaxy.model.tool_shed_install import HasToolBox
from galaxy.security.idencoding import IdEn... |
45,953 | /home/hieuvd/dung_repo/raw/stars_03/galaxyproject_galaxy/galaxy | /home/hieuvd/dung_repo/raw/stars_03/galaxyproject_galaxy/galaxy/lib/galaxy/tool_shed/galaxy_install/client.py | 48,48 | 38,51 | remove_manager | DataManagersInterface | 48,49 | 48,49 | class DataManagersInterface(Protocol):
@property
def _reload_count(self) -> int: ...
def load_manager_from_elem(
self, data_manager_elem, tool_path=None, add_manager=True
) -> Optional[DataManagerInterface]: ...
def get_manager(self, data_manager_id: str) -> Optional[DataManagerInterface]:... | class DataManagersInterface(Protocol):
@property
def _reload_count(self) -> int: ...
def load_manager_from_elem(
self, data_manager_elem, tool_path=None, add_manager=True
) -> Optional[DataManagerInterface]: ...
def get_manager(self, data_manager_id: str) -> Optional[DataManagerInterface]:... | def remove_manager(self, manager_ids: Union[str, List[str]]) -> None: ...
| def remove_manager(self, manager_ids: Union[str, List[str]]) -> None: ...
| 8 | 114 | 28 | 142 | import threading
from typing import (
Any,
Dict,
Generic,
List,
Optional,
TYPE_CHECKING,
TypeVar,
Union,
)
from typing_extensions import Protocol
from galaxy.model.base import ModelMapping
from galaxy.model.tool_shed_install import HasToolBox
from galaxy.security.idencoding import IdEn... | import threading
from typing import (
Any,
Dict,
Generic,
List,
Optional,
TYPE_CHECKING,
TypeVar,
Union,
)
from typing_extensions import Protocol
from galaxy.model.base import ModelMapping
from galaxy.model.tool_shed_install import HasToolBox
from galaxy.security.idencoding import IdEn... |
45,954 | /home/hieuvd/dung_repo/raw/stars_03/galaxyproject_galaxy/galaxy | /home/hieuvd/dung_repo/raw/stars_03/galaxyproject_galaxy/galaxy/lib/galaxy/tool_shed/galaxy_install/client.py | 66,66 | 54,67 | wait_for_toolbox_reload | InstallationTarget | 66,67 | 66,67 | class InstallationTarget(HasToolBox, Generic[ToolBoxType]):
data_managers: DataManagersInterface
install_model: ModelMapping
model: ModelMapping
security: IdEncodingHelper
config: Any
installed_repository_manager: "galaxy.tool_shed.metadata.installed_repository_manger.InstalledRepositoryManager"... | class InstallationTarget(HasToolBox, Generic[ToolBoxType]):
data_managers: DataManagersInterface
install_model: ModelMapping
model: ModelMapping
security: IdEncodingHelper
config: Any
installed_repository_manager: "galaxy.tool_shed.metadata.installed_repository_manger.InstalledRepositoryManager"... | def wait_for_toolbox_reload(self, old_toolbox: ToolBoxType) -> None: ...
| def wait_for_toolbox_reload(self, old_toolbox: ToolBoxType) -> None: ...
| 7 | 153 | 30 | 183 | import threading
from typing import (
Any,
Dict,
Generic,
List,
Optional,
TYPE_CHECKING,
TypeVar,
Union,
)
from typing_extensions import Protocol
from galaxy.model.base import ModelMapping
from galaxy.model.tool_shed_install import HasToolBox
from galaxy.security.idencoding import IdEn... | import threading
from typing import (
Any,
Dict,
Generic,
List,
Optional,
TYPE_CHECKING,
TypeVar,
Union,
)
from typing_extensions import Protocol
from galaxy.model.base import ModelMapping
from galaxy.model.tool_shed_install import HasToolBox
from galaxy.security.idencoding import IdEn... |
45,959 | /home/hieuvd/dung_repo/raw/stars_03/galaxyproject_galaxy/galaxy | /home/hieuvd/dung_repo/raw/stars_03/galaxyproject_galaxy/galaxy/lib/galaxy/tool_shed/galaxy_install/update_repository_manager.py | 101,104 | 28,126 | update_repository_record | UpdateRepositoryManager | 108,126 | 104,126 | class UpdateRepositoryManager:
def __init__(self, app):
self.app = app
self.context = self.app.install_model.context
# Ideally only one Galaxy server process should be able to check for repository updates.
if self.app.config.enable_tool_shed_check:
self.running = True
... | class UpdateRepositoryManager:
def __init__(self, app):
self.app = app
self.context = self.app.install_model.context
# Ideally only one Galaxy server process should be able to check for repository updates.
if self.app.config.enable_tool_shed_check:
self.running = True
... | repository.metadata_ = updated_metadata_dict
tool_shed_url = get_tool_shed_url_from_tool_shed_registry(self.app, repository.tool_shed)
clean_dependency_relationships(self.app, updated_metadata_dict, repository, tool_shed_url)
# Update the repository.changeset_revision column in the datab... | """
Update a tool_shed_repository database record with new information retrieved from the
Tool Shed. This happens when updating an installed repository to a new changeset revision.
"""
repository.metadata_ = updated_metadata_dict
tool_shed_url = get_tool_shed_url_from_to... | 58 | 1,131 | 297 | 1,428 | """
Determine if installed tool shed repositories have updates available in their respective tool sheds.
"""
import logging
import threading
from typing import NamedTuple
from sqlalchemy import false
from galaxy import util
from galaxy.model.base import transaction
from galaxy.model.tool_shed_install import ToolShed... | """
Determine if installed tool shed repositories have updates available in their respective tool sheds.
"""
import logging
import threading
from typing import NamedTuple
from sqlalchemy import false
from galaxy import util
from galaxy.model.base import transaction
from galaxy.model.tool_shed_install import ToolShed... |
45,961 | /home/hieuvd/dung_repo/raw/stars_03/galaxyproject_galaxy/galaxy | /home/hieuvd/dung_repo/raw/stars_03/galaxyproject_galaxy/galaxy/lib/galaxy/tool_shed/tools/tool_validator.py | 80,81 | 22,113 | load_tool_from_config | ToolValidator | 81,113 | 81,113 | class ToolValidator:
def __init__(self, app: RequiredAppT):
self.app = app
self.stdtm = ShedToolDataTableManager(self.app)
def check_tool_input_params(self, repo_dir, tool_config_name, tool, sample_files):
"""
Check all of the tool's input parameters, looking for any that are dy... | class ToolValidator:
def __init__(self, app: RequiredAppT):
self.app = app
self.stdtm = ShedToolDataTableManager(self.app)
def check_tool_input_params(self, repo_dir, tool_config_name, tool, sample_files):
"""
Check all of the tool's input parameters, looking for any that are dy... | tool_source = get_tool_source(
full_path,
enable_beta_formats=getattr(self.app.config, "enable_beta_tool_formats", False),
tool_location_fetcher=ToolLocationFetcher(),
)
try:
tool = create_tool_from_source(
config_file=full_path,
... | tool_source = get_tool_source(
full_path,
enable_beta_formats=getattr(self.app.config, "enable_beta_tool_formats", False),
tool_location_fetcher=ToolLocationFetcher(),
)
try:
tool = create_tool_from_source(
config_file=full_path,
... | 101 | 922 | 357 | 1,279 | import logging
from galaxy.tool_shed.tools.data_table_manager import (
RequiredAppT,
ShedToolDataTableManager,
)
from galaxy.tool_shed.util import (
basic_util,
hg_util,
)
from galaxy.tool_util.fetcher import ToolLocationFetcher
from galaxy.tool_util.parser import get_tool_source
from galaxy.tools impo... | import logging
from galaxy.tool_shed.tools.data_table_manager import (
RequiredAppT,
ShedToolDataTableManager,
)
from galaxy.tool_shed.util import (
basic_util,
hg_util,
)
from galaxy.tool_util.fetcher import ToolLocationFetcher
from galaxy.tool_util.parser import get_tool_source
from galaxy.tools impo... |
45,962 | /home/hieuvd/dung_repo/raw/stars_03/galaxyproject_galaxy/galaxy | /home/hieuvd/dung_repo/raw/stars_03/galaxyproject_galaxy/galaxy/lib/galaxy/tool_shed/util/basic_util.py | 62,63 | 1,142 | move_file | 63,75 | 63,75 | import logging
import os
import shutil
import markupsafe
from galaxy.util import (
nice_size,
unicodify,
)
log = logging.getLogger(__name__)
CHUNK_SIZE = 2**20 # 1Mb
INSTALLATION_LOG = "INSTALLATION.log"
# Set no activity timeout to 20 minutes.
NO_OUTPUT_TIMEOUT = 3600.0
MAXDIFFSIZE = 8000
MAX_DISPLAY_SIZE... | import logging
import os
import shutil
import markupsafe
from galaxy.util import (
nice_size,
unicodify,
)
log = logging.getLogger(__name__)
CHUNK_SIZE = 2**20 # 1Mb
INSTALLATION_LOG = "INSTALLATION.log"
# Set no activity timeout to 20 minutes.
NO_OUTPUT_TIMEOUT = 3600.0
MAXDIFFSIZE = 8000
MAX_DISPLAY_SIZE... | source_path = os.path.abspath(os.path.join(current_dir, source))
destination_directory = os.path.join(destination)
if rename_to is not None:
destination_path = os.path.join(destination_directory, rename_to)
else:
source_file = os.path.basename(source_path)
destination_path = os.p... | source_path = os.path.abspath(os.path.join(current_dir, source))
destination_directory = os.path.join(destination)
if rename_to is not None:
destination_path = os.path.join(destination_directory, rename_to)
else:
source_file = os.path.basename(source_path)
destination_path = os.p... | 30 | 1,157 | 173 | 1,330 | import logging
import os
import shutil
import markupsafe
from galaxy.util import (
nice_size,
unicodify,
)
log = logging.getLogger(__name__)
CHUNK_SIZE = 2**20 # 1Mb
INSTALLATION_LOG = "INSTALLATION.log"
# Set no activity timeout to 20 minutes.
NO_OUTPUT_TIMEOUT = 3600.0
MAXDIFFSIZE = 8000
MAX_DISPLAY_SIZE... | import logging
import os
import shutil
import markupsafe
from galaxy.util import (
nice_size,
unicodify,
)
log = logging.getLogger(__name__)
CHUNK_SIZE = 2**20 # 1Mb
INSTALLATION_LOG = "INSTALLATION.log"
# Set no activity timeout to 20 minutes.
NO_OUTPUT_TIMEOUT = 3600.0
MAXDIFFSIZE = 8000
MAX_DISPLAY_SIZE... | |
45,963 | /home/hieuvd/dung_repo/raw/stars_03/galaxyproject_galaxy/galaxy | /home/hieuvd/dung_repo/raw/stars_03/galaxyproject_galaxy/galaxy/lib/galaxy/tool_shed/util/container_util.py | 31,32 | 1,59 | get_components_from_key | 36,59 | 32,59 | import logging
from typing import Union
from galaxy.util.tool_shed.common_util import remove_protocol_from_tool_shed_url
log = logging.getLogger(__name__)
# String separator
STRSEP = "__ESEP__"
def generate_repository_dependencies_key_for_repository(
toolshed_base_url: str,
repository_name: str,
reposi... | import logging
from typing import Union
from galaxy.util.tool_shed.common_util import remove_protocol_from_tool_shed_url
log = logging.getLogger(__name__)
# String separator
STRSEP = "__ESEP__"
def generate_repository_dependencies_key_for_repository(
toolshed_base_url: str,
repository_name: str,
reposi... | items = key.split(STRSEP)
toolshed_base_url = items[0]
repository_name = items[1]
repository_owner = items[2]
changeset_revision = items[3]
if len(items) == 5:
prior_installation_required = items[4]
return toolshed_base_url, repository_name, repository_owner, changeset_revision, ... | """
Assumes tool shed is current tool shed since repository dependencies across tool sheds is not
yet supported.
"""
items = key.split(STRSEP)
toolshed_base_url = items[0]
repository_name = items[1]
repository_owner = items[2]
changeset_revision = items[3]
if len(items) == 5:
... | 74 | 408 | 296 | 704 | import logging
from typing import Union
from galaxy.util.tool_shed.common_util import remove_protocol_from_tool_shed_url
log = logging.getLogger(__name__)
# String separator
STRSEP = "__ESEP__"
def generate_repository_dependencies_key_for_repository(
toolshed_base_url: str,
repository_name: str,
reposi... | import logging
from typing import Union
from galaxy.util.tool_shed.common_util import remove_protocol_from_tool_shed_url
log = logging.getLogger(__name__)
# String separator
STRSEP = "__ESEP__"
def generate_repository_dependencies_key_for_repository(
toolshed_base_url: str,
repository_name: str,
reposi... | |
45,965 | /home/hieuvd/dung_repo/raw/stars_03/galaxyproject_galaxy/galaxy | /home/hieuvd/dung_repo/raw/stars_03/galaxyproject_galaxy/galaxy/lib/galaxy/tool_shed/util/metadata_util.py | 5,6 | 1,21 | get_updated_changeset_revisions_from_tool_shed | 10,21 | 6,21 | from galaxy import util
from galaxy.util.tool_shed.common_util import get_tool_shed_url_from_tool_shed_registry
def get_updated_changeset_revisions_from_tool_shed(app, tool_shed_url, name, owner, changeset_revision):
FILL_FUNC_BODY | from galaxy import util
from galaxy.util.tool_shed.common_util import get_tool_shed_url_from_tool_shed_registry
def get_updated_changeset_revisions_from_tool_shed(app, tool_shed_url, name, owner, changeset_revision):
"""
Get all appropriate newer changeset revisions for the repository defined by
the recei... | tool_shed_url = get_tool_shed_url_from_tool_shed_registry(app, tool_shed_url)
if tool_shed_url is None or name is None or owner is None or changeset_revision is None:
message = "Unable to get updated changeset revisions from the Tool Shed because one or more of the following "
message += f"requi... | """
Get all appropriate newer changeset revisions for the repository defined by
the received tool_shed_url / name / owner combination.
"""
tool_shed_url = get_tool_shed_url_from_tool_shed_registry(app, tool_shed_url)
if tool_shed_url is None or name is None or owner is None or changeset_revision... | 75 | 126 | 261 | 387 | from galaxy import util
from galaxy.util.tool_shed.common_util import get_tool_shed_url_from_tool_shed_registry
def get_updated_changeset_revisions_from_tool_shed(app, tool_shed_url, name, owner, changeset_revision):
FILL_FUNC_BODY | from galaxy import util
from galaxy.util.tool_shed.common_util import get_tool_shed_url_from_tool_shed_registry
def get_updated_changeset_revisions_from_tool_shed(app, tool_shed_url, name, owner, changeset_revision):
"""
Get all appropriate newer changeset revisions for the repository defined by
the recei... | |
45,969 | /home/hieuvd/dung_repo/raw/stars_03/galaxyproject_galaxy/galaxy | /home/hieuvd/dung_repo/raw/stars_03/galaxyproject_galaxy/galaxy/lib/galaxy/tool_util/biotools/interface.py | 48,49 | 1,64 | simplify_edam_dicts | 49,56 | 49,56 | import re
from typing import (
Any,
Dict,
List,
Optional,
)
TERM_PATTERN = re.compile(r"https?://edamontology.org/(.*)")
class ParsedBiotoolsEntry:
"""Provide XML wrapper relevant entities from a bio.tool entry - topics and operations."""
biotoolsID: str
edam_topics: List[str]
edam_o... | import re
from typing import (
Any,
Dict,
List,
Optional,
)
TERM_PATTERN = re.compile(r"https?://edamontology.org/(.*)")
class ParsedBiotoolsEntry:
"""Provide XML wrapper relevant entities from a bio.tool entry - topics and operations."""
biotoolsID: str
edam_topics: List[str]
edam_o... | terms = []
for term in map(simplify_edam_dict, a_list):
if term:
terms.append(term)
return terms
| terms = []
for term in map(simplify_edam_dict, a_list):
if term:
terms.append(term)
return terms
| 13 | 531 | 51 | 582 | import re
from typing import (
Any,
Dict,
List,
Optional,
)
TERM_PATTERN = re.compile(r"https?://edamontology.org/(.*)")
class ParsedBiotoolsEntry:
"""Provide XML wrapper relevant entities from a bio.tool entry - topics and operations."""
biotoolsID: str
edam_topics: List[str]
edam_o... | import re
from typing import (
Any,
Dict,
List,
Optional,
)
TERM_PATTERN = re.compile(r"https?://edamontology.org/(.*)")
class ParsedBiotoolsEntry:
"""Provide XML wrapper relevant entities from a bio.tool entry - topics and operations."""
biotoolsID: str
edam_topics: List[str]
edam_o... | |
45,970 | /home/hieuvd/dung_repo/raw/stars_03/galaxyproject_galaxy/galaxy | /home/hieuvd/dung_repo/raw/stars_03/galaxyproject_galaxy/galaxy/lib/galaxy/tool_util/biotools/interface.py | 27,29 | 20,48 | from_json | BiotoolsEntry | 29,35 | 29,35 | class BiotoolsEntry:
"""Parse the RAW entries of interest for Galaxy from a bio.tools entry."""
biotoolsID: str
topic: List[dict]
function: List[dict]
@staticmethod
def from_json(from_json: Dict[str, Any]) -> "BiotoolsEntry":
FILL_FUNC_BODY @property
def edam_info(self) -> ParsedBiotool... | class BiotoolsEntry:
"""Parse the RAW entries of interest for Galaxy from a bio.tools entry."""
biotoolsID: str
topic: List[dict]
function: List[dict]
@staticmethod
def from_json(from_json: Dict[str, Any]) -> "BiotoolsEntry":
FILL_FUNC_BODY @property
def edam_info(self) -> ParsedBiotool... | entry = BiotoolsEntry()
entry.biotoolsID = from_json["biotoolsID"]
entry.topic = from_json.get("topic", [])
entry.function = from_json.get("function", [])
return entry
| entry = BiotoolsEntry()
entry.biotoolsID = from_json["biotoolsID"]
entry.topic = from_json.get("topic", [])
entry.function = from_json.get("function", [])
return entry
| 16 | 239 | 70 | 309 | import re
from typing import (
Any,
Dict,
List,
Optional,
)
TERM_PATTERN = re.compile(r"https?://edamontology.org/(.*)")
class ParsedBiotoolsEntry:
"""Provide XML wrapper relevant entities from a bio.tool entry - topics and operations."""
biotoolsID: str
edam_topics: List[str]
edam_o... | import re
from typing import (
Any,
Dict,
List,
Optional,
)
TERM_PATTERN = re.compile(r"https?://edamontology.org/(.*)")
class ParsedBiotoolsEntry:
"""Provide XML wrapper relevant entities from a bio.tool entry - topics and operations."""
biotoolsID: str
edam_topics: List[str]
edam_o... |
45,971 | /home/hieuvd/dung_repo/raw/stars_03/galaxyproject_galaxy/galaxy | /home/hieuvd/dung_repo/raw/stars_03/galaxyproject_galaxy/galaxy/lib/galaxy/tool_util/biotools/source.py | 98,99 | 1,104 | get_biotools_metadata_source | 99,104 | 99,104 | import functools
import json
import os
from typing import (
Callable,
Dict,
List,
Optional,
)
import requests
from galaxy.util import DEFAULT_SOCKET_TIMEOUT
from .interface import BiotoolsEntry
class BiotoolsMetadataSource:
def get_biotools_metadata(self, biotools_reference: str) -> Optional[Bio... | import functools
import json
import os
from typing import (
Callable,
Dict,
List,
Optional,
)
import requests
from galaxy.util import DEFAULT_SOCKET_TIMEOUT
from .interface import BiotoolsEntry
class BiotoolsMetadataSource:
def get_biotools_metadata(self, biotools_reference: str) -> Optional[Bio... | return CascadingBiotoolsMetadataSource(
use_api=metadata_source_config.use_api,
content_directory=metadata_source_config.content_directory,
cache=metadata_source_config.cache,
)
| return CascadingBiotoolsMetadataSource(
use_api=metadata_source_config.use_api,
content_directory=metadata_source_config.content_directory,
cache=metadata_source_config.cache,
)
| 6 | 992 | 64 | 1,056 | import functools
import json
import os
from typing import (
Callable,
Dict,
List,
Optional,
)
import requests
from galaxy.util import DEFAULT_SOCKET_TIMEOUT
from .interface import BiotoolsEntry
class BiotoolsMetadataSource:
def get_biotools_metadata(self, biotools_reference: str) -> Optional[Bio... | import functools
import json
import os
from typing import (
Callable,
Dict,
List,
Optional,
)
import requests
from galaxy.util import DEFAULT_SOCKET_TIMEOUT
from .interface import BiotoolsEntry
class BiotoolsMetadataSource:
def get_biotools_metadata(self, biotools_reference: str) -> Optional[Bio... | |
45,972 | /home/hieuvd/dung_repo/raw/stars_03/galaxyproject_galaxy/galaxy | /home/hieuvd/dung_repo/raw/stars_03/galaxyproject_galaxy/galaxy/lib/galaxy/tool_util/biotools/source.py | 55,56 | 49,73 | _raw_get_metadata | ApiBiotoolsMetadataSource | 56,64 | 56,64 | class ApiBiotoolsMetadataSource(BiotoolsMetadataSource):
"""Parse entries from bio.tools API."""
def __init__(self, cache=None):
self._cache = cache or InMemoryCache()
def _raw_get_metadata(self, biotools_reference) -> Optional[str]:
FILL_FUNC_BODY def get_biotools_metadata(self, biotools_refer... | class ApiBiotoolsMetadataSource(BiotoolsMetadataSource):
"""Parse entries from bio.tools API."""
def __init__(self, cache=None):
self._cache = cache or InMemoryCache()
def _raw_get_metadata(self, biotools_reference) -> Optional[str]:
FILL_FUNC_BODY def get_biotools_metadata(self, biotools_refer... | api_url = f"https://bio.tools/api/tool/{biotools_reference}?format=json"
req = requests.get(api_url, timeout=DEFAULT_SOCKET_TIMEOUT)
req.encoding = req.apparent_encoding
if req.status_code == 404:
return None
else:
return req.text
| api_url = f"https://bio.tools/api/tool/{biotools_reference}?format=json"
req = requests.get(api_url, timeout=DEFAULT_SOCKET_TIMEOUT)
req.encoding = req.apparent_encoding
if req.status_code == 404:
return None
else:
return req.text
| 19 | 203 | 101 | 304 | import functools
import json
import os
from typing import (
Callable,
Dict,
List,
Optional,
)
import requests
from galaxy.util import DEFAULT_SOCKET_TIMEOUT
from .interface import BiotoolsEntry
class BiotoolsMetadataSource:
def get_biotools_metadata(self, biotools_reference: str) -> Optional[Bio... | import functools
import json
import os
from typing import (
Callable,
Dict,
List,
Optional,
)
import requests
from galaxy.util import DEFAULT_SOCKET_TIMEOUT
from .interface import BiotoolsEntry
class BiotoolsMetadataSource:
def get_biotools_metadata(self, biotools_reference: str) -> Optional[Bio... |
45,973 | /home/hieuvd/dung_repo/raw/stars_03/galaxyproject_galaxy/galaxy | /home/hieuvd/dung_repo/raw/stars_03/galaxyproject_galaxy/galaxy/lib/galaxy/tool_util/biotools/source.py | 84,85 | 73,92 | get_biotools_metadata | CascadingBiotoolsMetadataSource | 85,92 | 85,92 | class CascadingBiotoolsMetadataSource(BiotoolsMetadataSource):
def __init__(self, use_api=False, cache=None, content_directory: Optional[str] = None):
sources: List[BiotoolsMetadataSource] = []
if content_directory:
git_content_source = GitContentBiotoolsMetadataSource(content_directory)... | class CascadingBiotoolsMetadataSource(BiotoolsMetadataSource):
def __init__(self, use_api=False, cache=None, content_directory: Optional[str] = None):
sources: List[BiotoolsMetadataSource] = []
if content_directory:
git_content_source = GitContentBiotoolsMetadataSource(content_directory)... | for source in self._sources:
entry = source.get_biotools_metadata(biotools_reference)
if entry is not None:
return entry
return None
| for source in self._sources:
entry = source.get_biotools_metadata(biotools_reference)
if entry is not None:
return entry
return None
| 16 | 186 | 54 | 240 | import functools
import json
import os
from typing import (
Callable,
Dict,
List,
Optional,
)
import requests
from galaxy.util import DEFAULT_SOCKET_TIMEOUT
from .interface import BiotoolsEntry
class BiotoolsMetadataSource:
def get_biotools_metadata(self, biotools_reference: str) -> Optional[Bio... | import functools
import json
import os
from typing import (
Callable,
Dict,
List,
Optional,
)
import requests
from galaxy.util import DEFAULT_SOCKET_TIMEOUT
from .interface import BiotoolsEntry
class BiotoolsMetadataSource:
def get_biotools_metadata(self, biotools_reference: str) -> Optional[Bio... |
45,974 | /home/hieuvd/dung_repo/raw/stars_03/galaxyproject_galaxy/galaxy | /home/hieuvd/dung_repo/raw/stars_03/galaxyproject_galaxy/galaxy/lib/galaxy/tool_util/biotools/source.py | 28,29 | 22,38 | get_biotools_metadata | GitContentBiotoolsMetadataSource | 30,38 | 29,38 | class GitContentBiotoolsMetadataSource(BiotoolsMetadataSource):
"""Parse entries from a repository clone of https://github.com/bio-tools/content."""
def __init__(self, content_directory):
self._content_directory = content_directory
def get_biotools_metadata(self, biotools_reference: str) -> Option... | class GitContentBiotoolsMetadataSource(BiotoolsMetadataSource):
"""Parse entries from a repository clone of https://github.com/bio-tools/content."""
def __init__(self, content_directory):
self._content_directory = content_directory
def get_biotools_metadata(self, biotools_reference: str) -> Option... | path = os.path.join(self._content_directory, "data", biotools_reference, f"{biotools_reference}.biotools.json")
if not os.path.exists(path):
return None
with open(path) as f:
content_json = json.load(f)
return BiotoolsEntry.from_json(content_json)
| """Return a BiotoolsEntry if available."""
path = os.path.join(self._content_directory, "data", biotools_reference, f"{biotools_reference}.biotools.json")
if not os.path.exists(path):
return None
with open(path) as f:
content_json = json.load(f)
return... | 20 | 116 | 104 | 220 | import functools
import json
import os
from typing import (
Callable,
Dict,
List,
Optional,
)
import requests
from galaxy.util import DEFAULT_SOCKET_TIMEOUT
from .interface import BiotoolsEntry
class BiotoolsMetadataSource:
def get_biotools_metadata(self, biotools_reference: str) -> Optional[Bio... | import functools
import json
import os
from typing import (
Callable,
Dict,
List,
Optional,
)
import requests
from galaxy.util import DEFAULT_SOCKET_TIMEOUT
from .interface import BiotoolsEntry
class BiotoolsMetadataSource:
def get_biotools_metadata(self, biotools_reference: str) -> Optional[Bio... |
45,975 | /home/hieuvd/dung_repo/raw/stars_03/galaxyproject_galaxy/galaxy | /home/hieuvd/dung_repo/raw/stars_03/galaxyproject_galaxy/galaxy/lib/galaxy/tool_util/biotools/source.py | 41,42 | 38,49 | get | InMemoryCache | 42,49 | 42,49 | class InMemoryCache:
backend: Dict[str, Optional[str]] = {}
def get(self, key: str, createfunc: Callable[[], Optional[str]]):
FILL_FUNC_BODY | class InMemoryCache:
backend: Dict[str, Optional[str]] = {}
def get(self, key: str, createfunc: Callable[[], Optional[str]]):
FILL_FUNC_BODY | backend = self.backend
if key not in backend:
backend[key] = createfunc()
return backend.get(key)
| backend = self.backend
if key not in backend:
backend[key] = createfunc()
return backend.get(key)
| 13 | 55 | 45 | 100 | import functools
import json
import os
from typing import (
Callable,
Dict,
List,
Optional,
)
import requests
from galaxy.util import DEFAULT_SOCKET_TIMEOUT
from .interface import BiotoolsEntry
class BiotoolsMetadataSource:
def get_biotools_metadata(self, biotools_reference: str) -> Optional[Bio... | import functools
import json
import os
from typing import (
Callable,
Dict,
List,
Optional,
)
import requests
from galaxy.util import DEFAULT_SOCKET_TIMEOUT
from .interface import BiotoolsEntry
class BiotoolsMetadataSource:
def get_biotools_metadata(self, biotools_reference: str) -> Optional[Bio... |
45,977 | /home/hieuvd/dung_repo/raw/stars_03/galaxyproject_galaxy/galaxy | /home/hieuvd/dung_repo/raw/stars_03/galaxyproject_galaxy/galaxy/lib/galaxy/tool_util/client/staging.py | 286,287 | 281,299 | _post | InteractorStaging | 287,291 | 287,291 | class InteractorStaging(StagingInterface):
def __init__(self, galaxy_interactor: "ApiTestInteractor", use_fetch_api: bool = DEFAULT_USE_FETCH_API) -> None:
self.galaxy_interactor = galaxy_interactor
self._use_fetch_api = use_fetch_api
def _post(self, api_path: str, payload: Dict[str, Any]) -> D... | class InteractorStaging(StagingInterface):
def __init__(self, galaxy_interactor: "ApiTestInteractor", use_fetch_api: bool = DEFAULT_USE_FETCH_API) -> None:
self.galaxy_interactor = galaxy_interactor
self._use_fetch_api = use_fetch_api
def _post(self, api_path: str, payload: Dict[str, Any]) -> D... | response = self.galaxy_interactor._post(api_path, payload, json=True)
assert response.status_code == 200, response.text
return response.json()
| response = self.galaxy_interactor._post(api_path, payload, json=True)
assert response.status_code == 200, response.text
return response.json()
| 12 | 196 | 52 | 248 | """Client for staging inputs for Galaxy Tools and Workflows.
Implement as a connector to serve a bridge between galactic_job_json
utility and a Galaxy API library.
"""
import abc
import json
import logging
import os
from typing import (
Any,
BinaryIO,
Dict,
List,
Optional,
Tuple,
TYPE_CHEC... | """Client for staging inputs for Galaxy Tools and Workflows.
Implement as a connector to serve a bridge between galactic_job_json
utility and a Galaxy API library.
"""
import abc
import json
import logging
import os
from typing import (
Any,
BinaryIO,
Dict,
List,
Optional,
Tuple,
TYPE_CHEC... |
45,979 | /home/hieuvd/dung_repo/raw/stars_03/galaxyproject_galaxy/galaxy | /home/hieuvd/dung_repo/raw/stars_03/galaxyproject_galaxy/galaxy/lib/galaxy/tool_util/cwl/cwltool_deps.py | 103,104 | 1,147 | ensure_cwltool_available | 108,123 | 104,123 | """Logic for dealing with cwltool as an optional dependency.
Use this as the import interface for cwltool and just call
:func:`ensure_cwltool_available` before using any of the imported
functionality at runtime.
"""
import re
import warnings
warnings.filterwarnings("ignore", message=r"[\n.]DEPRECATION: Python 2", mo... | """Logic for dealing with cwltool as an optional dependency.
Use this as the import interface for cwltool and just call
:func:`ensure_cwltool_available` before using any of the imported
functionality at runtime.
"""
import re
import warnings
warnings.filterwarnings("ignore", message=r"[\n.]DEPRECATION: Python 2", mo... | if main is None or workflow is None or shellescape is None:
message = "This feature requires cwltool and dependencies to be available, they are not."
if main is None:
message += " cwltool is not unavailable."
elif resolve_and_validate_document is None:
message += " cw... | """Assert optional dependencies proxied via this module are available at runtime.
Throw an ImportError with a description of the problem if they do not exist.
"""
if main is None or workflow is None or shellescape is None:
message = "This feature requires cwltool and dependencies to be availabl... | 85 | 1,091 | 193 | 1,284 | """Logic for dealing with cwltool as an optional dependency.
Use this as the import interface for cwltool and just call
:func:`ensure_cwltool_available` before using any of the imported
functionality at runtime.
"""
import re
import warnings
warnings.filterwarnings("ignore", message=r"[\n.]DEPRECATION: Python 2", mo... | """Logic for dealing with cwltool as an optional dependency.
Use this as the import interface for cwltool and just call
:func:`ensure_cwltool_available` before using any of the imported
functionality at runtime.
"""
import re
import warnings
warnings.filterwarnings("ignore", message=r"[\n.]DEPRECATION: Python 2", mo... | |
45,981 | /home/hieuvd/dung_repo/raw/stars_03/galaxyproject_galaxy/galaxy | /home/hieuvd/dung_repo/raw/stars_03/galaxyproject_galaxy/galaxy/lib/galaxy/tool_util/cwl/parser.py | 987,989 | 966,1014 | requirements | BaseStepProxy | 989,991 | 989,991 | class BaseStepProxy:
def __init__(self, workflow_proxy: WorkflowProxy, step, index):
self._workflow_proxy = workflow_proxy
self._step = step
self._index = index
self._uuid = str(uuid4())
cwl_inputs = self._step.tool["inputs"]
self.input_proxies = [InputProxy(self, cwl... | class BaseStepProxy:
def __init__(self, workflow_proxy: WorkflowProxy, step, index):
self._workflow_proxy = workflow_proxy
self._step = step
self._index = index
self._uuid = str(uuid4())
cwl_inputs = self._step.tool["inputs"]
self.input_proxies = [InputProxy(self, cwl... | return self._step.requirements
| return self._step.requirements
| 2 | 417 | 12 | 429 | """ This module provides proxy objects around objects from the common
workflow language reference implementation library cwltool. These proxies
adapt cwltool to Galaxy features and abstract the library away from the rest
of the framework.
"""
import copy
import json
import logging
import os
from abc import (
ABCMe... | """ This module provides proxy objects around objects from the common
workflow language reference implementation library cwltool. These proxies
adapt cwltool to Galaxy features and abstract the library away from the rest
of the framework.
"""
import copy
import json
import logging
import os
from abc import (
ABCMe... |
45,982 | /home/hieuvd/dung_repo/raw/stars_03/galaxyproject_galaxy/galaxy | /home/hieuvd/dung_repo/raw/stars_03/galaxyproject_galaxy/galaxy/lib/galaxy/tool_util/cwl/parser.py | 260,261 | 219,290 | _eval_schema | CommandLineToolProxy | 261,266 | 261,266 | class CommandLineToolProxy(ToolProxy):
_class = "CommandLineTool"
def description(self):
# Don't use description - typically too verbose.
return ""
def doc(self):
# TODO: parse multiple lines and merge - valid in cwl-1.1
doc = self._tool.tool.get("doc")
return doc
... | class CommandLineToolProxy(ToolProxy):
_class = "CommandLineTool"
def description(self):
# Don't use description - typically too verbose.
return ""
def doc(self):
# TODO: parse multiple lines and merge - valid in cwl-1.1
doc = self._tool.tool.get("doc")
return doc
... | schema_type = io_schema.get("type")
if schema_type in self._tool.schemaDefs:
io_schema = self._tool.schemaDefs[schema_type]
return io_schema
| schema_type = io_schema.get("type")
if schema_type in self._tool.schemaDefs:
io_schema = self._tool.schemaDefs[schema_type]
return io_schema
| 12 | 617 | 59 | 676 | """ This module provides proxy objects around objects from the common
workflow language reference implementation library cwltool. These proxies
adapt cwltool to Galaxy features and abstract the library away from the rest
of the framework.
"""
import copy
import json
import logging
import os
from abc import (
ABCMe... | """ This module provides proxy objects around objects from the common
workflow language reference implementation library cwltool. These proxies
adapt cwltool to Galaxy features and abstract the library away from the rest
of the framework.
"""
import copy
import json
import logging
import os
from abc import (
ABCMe... |
45,983 | /home/hieuvd/dung_repo/raw/stars_03/galaxyproject_galaxy/galaxy | /home/hieuvd/dung_repo/raw/stars_03/galaxyproject_galaxy/galaxy/lib/galaxy/tool_util/cwl/parser.py | 1186,1187 | 1179,1199 | to_dict | ConditionalInstance | 1187,1199 | 1187,1199 | class ConditionalInstance:
def __init__(self, name, case, whens):
self.input_type = INPUT_TYPE.CONDITIONAL
self.name = name
self.case = case
self.whens = whens
def to_dict(self):
FILL_FUNC_BODY | class ConditionalInstance:
def __init__(self, name, case, whens):
self.input_type = INPUT_TYPE.CONDITIONAL
self.name = name
self.case = case
self.whens = whens
def to_dict(self):
FILL_FUNC_BODY | as_dict = dict(
name=self.name,
type=INPUT_TYPE.CONDITIONAL,
test=self.case.to_dict(),
when={},
)
for value, block in self.whens:
as_dict["when"][value] = [i.to_dict() for i in block]
return as_dict
| as_dict = dict(
name=self.name,
type=INPUT_TYPE.CONDITIONAL,
test=self.case.to_dict(),
when={},
)
for value, block in self.whens:
as_dict["when"][value] = [i.to_dict() for i in block]
return as_dict
| 22 | 81 | 108 | 189 | """ This module provides proxy objects around objects from the common
workflow language reference implementation library cwltool. These proxies
adapt cwltool to Galaxy features and abstract the library away from the rest
of the framework.
"""
import copy
import json
import logging
import os
from abc import (
ABCMe... | """ This module provides proxy objects around objects from the common
workflow language reference implementation library cwltool. These proxies
adapt cwltool to Galaxy features and abstract the library away from the rest
of the framework.
"""
import copy
import json
import logging
import os
from abc import (
ABCMe... |
45,984 | /home/hieuvd/dung_repo/raw/stars_03/galaxyproject_galaxy/galaxy | /home/hieuvd/dung_repo/raw/stars_03/galaxyproject_galaxy/galaxy/lib/galaxy/tool_util/cwl/parser.py | 1236,1237 | 1219,1261 | to_dict | InputInstance | 1237,1261 | 1237,1261 | class InputInstance:
def __init__(self, name, label, description, input_type, array=False, area=False, collection_type=None):
self.input_type = input_type
self.collection_type = collection_type
self.name = name
self.label = label
self.description = description
self.re... | class InputInstance:
def __init__(self, name, label, description, input_type, array=False, area=False, collection_type=None):
self.input_type = input_type
self.collection_type = collection_type
self.name = name
self.label = label
self.description = description
self.re... | if itemwise and self.array:
return InputInstanceArrayDict(
type="repeat", name=f"{self.name}_repeat", title=f"{self.name}", blocks=[self.to_dict(itemwise=False)]
)
else:
as_dict = InputInstanceDict(
name=self.name,
label... | if itemwise and self.array:
return InputInstanceArrayDict(
type="repeat", name=f"{self.name}_repeat", title=f"{self.name}", blocks=[self.to_dict(itemwise=False)]
)
else:
as_dict = InputInstanceDict(
name=self.name,
label... | 52 | 213 | 277 | 490 | """ This module provides proxy objects around objects from the common
workflow language reference implementation library cwltool. These proxies
adapt cwltool to Galaxy features and abstract the library away from the rest
of the framework.
"""
import copy
import json
import logging
import os
from abc import (
ABCMe... | """ This module provides proxy objects around objects from the common
workflow language reference implementation library cwltool. These proxies
adapt cwltool to Galaxy features and abstract the library away from the rest
of the framework.
"""
import copy
import json
import logging
import os
from abc import (
ABCMe... |
45,985 | /home/hieuvd/dung_repo/raw/stars_03/galaxyproject_galaxy/galaxy | /home/hieuvd/dung_repo/raw/stars_03/galaxyproject_galaxy/galaxy/lib/galaxy/tool_util/cwl/parser.py | 948,949 | 918,966 | to_dict | InputProxy | 949,966 | 949,966 | class InputProxy:
def __init__(self, step_proxy, cwl_input):
self._cwl_input = cwl_input
self.step_proxy = step_proxy
self.workflow_proxy = step_proxy._workflow_proxy
cwl_input_id = cwl_input["id"]
cwl_source_id = cwl_input.get("source", None)
if cwl_source_id is Non... | class InputProxy:
def __init__(self, step_proxy, cwl_input):
self._cwl_input = cwl_input
self.step_proxy = step_proxy
self.workflow_proxy = step_proxy._workflow_proxy
cwl_input_id = cwl_input["id"]
cwl_source_id = cwl_input.get("source", None)
if cwl_source_id is Non... | as_dict = {
"name": self.input_name,
}
if "linkMerge" in self._cwl_input:
as_dict["merge_type"] = self._cwl_input["linkMerge"]
if "scatterMethod" in self.step_proxy._step.tool:
as_dict["scatter_type"] = self.step_proxy._step.tool.get("scatterMethod", "... | as_dict = {
"name": self.input_name,
}
if "linkMerge" in self._cwl_input:
as_dict["merge_type"] = self._cwl_input["linkMerge"]
if "scatterMethod" in self.step_proxy._step.tool:
as_dict["scatter_type"] = self.step_proxy._step.tool.get("scatterMethod", "... | 60 | 407 | 256 | 663 | """ This module provides proxy objects around objects from the common
workflow language reference implementation library cwltool. These proxies
adapt cwltool to Galaxy features and abstract the library away from the rest
of the framework.
"""
import copy
import json
import logging
import os
from abc import (
ABCMe... | """ This module provides proxy objects around objects from the common
workflow language reference implementation library cwltool. These proxies
adapt cwltool to Galaxy features and abstract the library away from the rest
of the framework.
"""
import copy
import json
import logging
import os
from abc import (
ABCMe... |
45,987 | /home/hieuvd/dung_repo/raw/stars_03/galaxyproject_galaxy/galaxy | /home/hieuvd/dung_repo/raw/stars_03/galaxyproject_galaxy/galaxy/lib/galaxy/tool_util/cwl/parser.py | 1207,1208 | 1199,1219 | to_dict | SelectInputInstance | 1208,1219 | 1208,1219 | class SelectInputInstance:
def __init__(self, name, label, description, options):
self.input_type = INPUT_TYPE.SELECT
self.name = name
self.label = label
self.description = description
self.options = options
def to_dict(self):
FILL_FUNC_BODY | class SelectInputInstance:
def __init__(self, name, label, description, options):
self.input_type = INPUT_TYPE.SELECT
self.name = name
self.label = label
self.description = description
self.options = options
def to_dict(self):
FILL_FUNC_BODY | # TODO: serialize options...
as_dict = dict(
name=self.name,
label=self.label or self.name,
help=self.description,
type=self.input_type,
options=self.options,
)
return as_dict
| # TODO: serialize options...
as_dict = dict(
name=self.name,
label=self.label or self.name,
help=self.description,
type=self.input_type,
options=self.options,
)
return as_dict
| 17 | 84 | 85 | 169 | """ This module provides proxy objects around objects from the common
workflow language reference implementation library cwltool. These proxies
adapt cwltool to Galaxy features and abstract the library away from the rest
of the framework.
"""
import copy
import json
import logging
import os
from abc import (
ABCMe... | """ This module provides proxy objects around objects from the common
workflow language reference implementation library cwltool. These proxies
adapt cwltool to Galaxy features and abstract the library away from the rest
of the framework.
"""
import copy
import json
import logging
import os
from abc import (
ABCMe... |
45,988 | /home/hieuvd/dung_repo/raw/stars_03/galaxyproject_galaxy/galaxy | /home/hieuvd/dung_repo/raw/stars_03/galaxyproject_galaxy/galaxy/lib/galaxy/tool_util/cwl/parser.py | 1061,1062 | 1056,1090 | to_dict | SubworkflowStepProxy | 1062,1080 | 1062,1080 | class SubworkflowStepProxy(BaseStepProxy):
def __init__(self, workflow_proxy, step, index):
super().__init__(workflow_proxy, step, index)
self._subworkflow_proxy = None
def to_dict(self, input_connections):
FILL_FUNC_BODY def tool_reference_proxies(self):
return self.subworkflow_prox... | class SubworkflowStepProxy(BaseStepProxy):
def __init__(self, workflow_proxy, step, index):
super().__init__(workflow_proxy, step, index)
self._subworkflow_proxy = None
def to_dict(self, input_connections):
FILL_FUNC_BODY def tool_reference_proxies(self):
return self.subworkflow_prox... | outputs = self.galaxy_workflow_outputs_list()
for key, input_connection_list in input_connections.items():
input_subworkflow_step_id = self.subworkflow_proxy.find_inputs_step_index(key)
for input_connection in input_connection_list:
input_connection["input_subwork... | outputs = self.galaxy_workflow_outputs_list()
for key, input_connection_list in input_connections.items():
input_subworkflow_step_id = self.subworkflow_proxy.find_inputs_step_index(key)
for input_connection in input_connection_list:
input_connection["input_subwork... | 42 | 176 | 264 | 440 | """ This module provides proxy objects around objects from the common
workflow language reference implementation library cwltool. These proxies
adapt cwltool to Galaxy features and abstract the library away from the rest
of the framework.
"""
import copy
import json
import logging
import os
from abc import (
ABCMe... | """ This module provides proxy objects around objects from the common
workflow language reference implementation library cwltool. These proxies
adapt cwltool to Galaxy features and abstract the library away from the rest
of the framework.
"""
import copy
import json
import logging
import os
from abc import (
ABCMe... |
45,989 | /home/hieuvd/dung_repo/raw/stars_03/galaxyproject_galaxy/galaxy | /home/hieuvd/dung_repo/raw/stars_03/galaxyproject_galaxy/galaxy/lib/galaxy/tool_util/cwl/parser.py | 199,200 | 108,219 | hints_or_requirements_of_class | ToolProxy | 200,203 | 200,203 | class ToolProxy(metaclass=ABCMeta):
_class: str
def __init__(self, tool, uuid, raw_process_reference=None, tool_path=None):
self._tool = tool
self.uuid = uuid
self._tool_path = tool_path
self._raw_process_reference = raw_process_reference
# remove input parameter formats... | class ToolProxy(metaclass=ABCMeta):
_class: str
def __init__(self, tool, uuid, raw_process_reference=None, tool_path=None):
self._tool = tool
self.uuid = uuid
self._tool_path = tool_path
self._raw_process_reference = raw_process_reference
# remove input parameter formats... | reqs_and_hints = self.requirements + getattr(self._tool, "hints", [])
return [hint for hint in reqs_and_hints if hint["class"] == class_name]
| reqs_and_hints = self.requirements + getattr(self._tool, "hints", [])
return [hint for hint in reqs_and_hints if hint["class"] == class_name]
| 17 | 1,157 | 58 | 1,215 | """ This module provides proxy objects around objects from the common
workflow language reference implementation library cwltool. These proxies
adapt cwltool to Galaxy features and abstract the library away from the rest
of the framework.
"""
import copy
import json
import logging
import os
from abc import (
ABCMe... | """ This module provides proxy objects around objects from the common
workflow language reference implementation library cwltool. These proxies
adapt cwltool to Galaxy features and abstract the library away from the rest
of the framework.
"""
import copy
import json
import logging
import os
from abc import (
ABCMe... |
45,990 | /home/hieuvd/dung_repo/raw/stars_03/galaxyproject_galaxy/galaxy | /home/hieuvd/dung_repo/raw/stars_03/galaxyproject_galaxy/galaxy/lib/galaxy/tool_util/cwl/parser.py | 1019,1021 | 1014,1056 | tool_proxy | ToolStepProxy | 1021,1026 | 1021,1026 | class ToolStepProxy(BaseStepProxy):
def __init__(self, workflow_proxy, step, index):
super().__init__(workflow_proxy, step, index)
self._tool_proxy = None
@property
def tool_proxy(self):
FILL_FUNC_BODY def tool_reference_proxies(self):
# Return a list so we can handle subworkflow... | class ToolStepProxy(BaseStepProxy):
def __init__(self, workflow_proxy, step, index):
super().__init__(workflow_proxy, step, index)
self._tool_proxy = None
@property
def tool_proxy(self):
FILL_FUNC_BODY def tool_reference_proxies(self):
# Return a list so we can handle subworkflow... | # Needs to be cached so UUID that is loaded matches UUID generated with to_dict.
if self._tool_proxy is None:
self._tool_proxy = _cwl_tool_object_to_proxy(self.cwl_tool_object, uuid=str(uuid4()))
return self._tool_proxy
| # Needs to be cached so UUID that is loaded matches UUID generated with to_dict.
if self._tool_proxy is None:
self._tool_proxy = _cwl_tool_object_to_proxy(self.cwl_tool_object, uuid=str(uuid4()))
return self._tool_proxy
| 25 | 407 | 83 | 490 | """ This module provides proxy objects around objects from the common
workflow language reference implementation library cwltool. These proxies
adapt cwltool to Galaxy features and abstract the library away from the rest
of the framework.
"""
import copy
import json
import logging
import os
from abc import (
ABCMe... | """ This module provides proxy objects around objects from the common
workflow language reference implementation library cwltool. These proxies
adapt cwltool to Galaxy features and abstract the library away from the rest
of the framework.
"""
import copy
import json
import logging
import os
from abc import (
ABCMe... |
45,993 | /home/hieuvd/dung_repo/raw/stars_03/galaxyproject_galaxy/galaxy | /home/hieuvd/dung_repo/raw/stars_03/galaxyproject_galaxy/galaxy/lib/galaxy/tool_util/cwl/representation.py | 66,68 | 60,71 | uses_param | TypeRepresentation | 68,71 | 68,71 | class TypeRepresentation(NamedTuple):
name: str
galaxy_param_type: Any
label: str
collection_type: Optional[str]
@property
def uses_param(self):
FILL_FUNC_BODY | class TypeRepresentation(NamedTuple):
name: str
galaxy_param_type: Any
label: str
collection_type: Optional[str]
@property
def uses_param(self):
FILL_FUNC_BODY | return self.galaxy_param_type is not NO_GALAXY_INPUT
| return self.galaxy_param_type is not NO_GALAXY_INPUT
| 5 | 64 | 27 | 91 | """ This module is responsible for converting between Galaxy's tool
input description and the CWL description for a job json. """
import json
import logging
import os
from enum import Enum
from typing import (
Any,
NamedTuple,
Optional,
)
from galaxy.exceptions import RequestParameterInvalidException
from... | """ This module is responsible for converting between Galaxy's tool
input description and the CWL description for a job json. """
import json
import logging
import os
from enum import Enum
from typing import (
Any,
NamedTuple,
Optional,
)
from galaxy.exceptions import RequestParameterInvalidException
from... |
45,994 | /home/hieuvd/dung_repo/raw/stars_03/galaxyproject_galaxy/galaxy | /home/hieuvd/dung_repo/raw/stars_03/galaxyproject_galaxy/galaxy/lib/galaxy/tool_util/cwl/runnable.py | 8,9 | 1,34 | get_outputs | 9,20 | 9,20 | """Lighter-weight variant of Planemo runnable outputs."""
from galaxy.tool_util.parser import get_tool_source
from .parser import workflow_proxy
from .util import guess_artifact_type
def get_outputs(path):
FILL_FUNC_BODYclass CwlWorkflowOutput:
def __init__(self, label):
self._label = label
def get_... | """Lighter-weight variant of Planemo runnable outputs."""
from galaxy.tool_util.parser import get_tool_source
from .parser import workflow_proxy
from .util import guess_artifact_type
def get_outputs(path):
FILL_FUNC_BODYclass CwlWorkflowOutput:
def __init__(self, label):
self._label = label
def get_... | tool_or_workflow = guess_artifact_type(path)
if tool_or_workflow == "tool":
tool_source = get_tool_source(path)
output_datasets, _ = tool_source.parse_outputs(None)
outputs = [ToolOutput(o) for o in output_datasets.values()]
return outputs
else:
workflow = workflow_pr... | tool_or_workflow = guess_artifact_type(path)
if tool_or_workflow == "tool":
tool_source = get_tool_source(path)
output_datasets, _ = tool_source.parse_outputs(None)
outputs = [ToolOutput(o) for o in output_datasets.values()]
return outputs
else:
workflow = workflow_pr... | 34 | 162 | 148 | 310 | """Lighter-weight variant of Planemo runnable outputs."""
from galaxy.tool_util.parser import get_tool_source
from .parser import workflow_proxy
from .util import guess_artifact_type
def get_outputs(path):
FILL_FUNC_BODYclass CwlWorkflowOutput:
def __init__(self, label):
self._label = label
def get_... | """Lighter-weight variant of Planemo runnable outputs."""
from galaxy.tool_util.parser import get_tool_source
from .parser import workflow_proxy
from .util import guess_artifact_type
def get_outputs(path):
FILL_FUNC_BODYclass CwlWorkflowOutput:
def __init__(self, label):
self._label = label
def get_... | |
45,995 | /home/hieuvd/dung_repo/raw/stars_03/galaxyproject_galaxy/galaxy | /home/hieuvd/dung_repo/raw/stars_03/galaxyproject_galaxy/galaxy/lib/galaxy/tool_util/cwl/runnable.py | 24,25 | 20,28 | get_id | CwlWorkflowOutput | 25,28 | 25,28 | class CwlWorkflowOutput:
def __init__(self, label):
self._label = label
def get_id(self):
FILL_FUNC_BODY | class CwlWorkflowOutput:
def __init__(self, label):
self._label = label
def get_id(self):
FILL_FUNC_BODY | return self._label
| return self._label
| 2 | 45 | 11 | 56 | """Lighter-weight variant of Planemo runnable outputs."""
from galaxy.tool_util.parser import get_tool_source
from .parser import workflow_proxy
from .util import guess_artifact_type
def get_outputs(path):
tool_or_workflow = guess_artifact_type(path)
if tool_or_workflow == "tool":
tool_source = get_t... | """Lighter-weight variant of Planemo runnable outputs."""
from galaxy.tool_util.parser import get_tool_source
from .parser import workflow_proxy
from .util import guess_artifact_type
def get_outputs(path):
tool_or_workflow = guess_artifact_type(path)
if tool_or_workflow == "tool":
tool_source = get_t... |
45,996 | /home/hieuvd/dung_repo/raw/stars_03/galaxyproject_galaxy/galaxy | /home/hieuvd/dung_repo/raw/stars_03/galaxyproject_galaxy/galaxy/lib/galaxy/tool_util/cwl/runnable.py | 32,33 | 28,34 | get_id | ToolOutput | 33,34 | 33,34 | class ToolOutput:
def __init__(self, tool_output):
self._tool_output = tool_output
def get_id(self):
FILL_FUNC_BODY | class ToolOutput:
def __init__(self, tool_output):
self._tool_output = tool_output
def get_id(self):
FILL_FUNC_BODY | return self._tool_output.name
| return self._tool_output.name
| 2 | 48 | 11 | 59 | """Lighter-weight variant of Planemo runnable outputs."""
from galaxy.tool_util.parser import get_tool_source
from .parser import workflow_proxy
from .util import guess_artifact_type
def get_outputs(path):
tool_or_workflow = guess_artifact_type(path)
if tool_or_workflow == "tool":
tool_source = get_t... | """Lighter-weight variant of Planemo runnable outputs."""
from galaxy.tool_util.parser import get_tool_source
from .parser import workflow_proxy
from .util import guess_artifact_type
def get_outputs(path):
tool_or_workflow = guess_artifact_type(path)
if tool_or_workflow == "tool":
tool_source = get_t... |
45,998 | /home/hieuvd/dung_repo/raw/stars_03/galaxyproject_galaxy/galaxy | /home/hieuvd/dung_repo/raw/stars_03/galaxyproject_galaxy/galaxy/lib/galaxy/tool_util/cwl/runtime_actions.py | 55,56 | 51,60 | write_to | LiteralFileDescription | 56,60 | 56,60 | class LiteralFileDescription:
def __init__(self, content):
self.content = content
def write_to(self, destination):
FILL_FUNC_BODY | class LiteralFileDescription:
def __init__(self, content):
self.content = content
def write_to(self, destination):
FILL_FUNC_BODY | with open(destination, "wb") as f:
f.write(self.content.encode("UTF-8"))
| with open(destination, "wb") as f:
f.write(self.content.encode("UTF-8"))
| 6 | 46 | 37 | 83 | import json
import os
import shutil
from galaxy.util import safe_makedirs
from .cwltool_deps import ref_resolver
from .parser import (
JOB_JSON_FILE,
load_job_proxy,
)
from .util import (
SECONDARY_FILES_INDEX_PATH,
STORE_SECONDARY_FILES_WITH_BASENAME,
)
def file_dict_to_description(file_dict):
o... | import json
import os
import shutil
from galaxy.util import safe_makedirs
from .cwltool_deps import ref_resolver
from .parser import (
JOB_JSON_FILE,
load_job_proxy,
)
from .util import (
SECONDARY_FILES_INDEX_PATH,
STORE_SECONDARY_FILES_WITH_BASENAME,
)
def file_dict_to_description(file_dict):
o... |
45,999 | /home/hieuvd/dung_repo/raw/stars_03/galaxyproject_galaxy/galaxy | /home/hieuvd/dung_repo/raw/stars_03/galaxyproject_galaxy/galaxy/lib/galaxy/tool_util/cwl/runtime_actions.py | 47,48 | 43,51 | write_to | PathDirectoryDescription | 48,51 | 48,51 | class PathDirectoryDescription:
def __init__(self, path):
self.path = path
def write_to(self, destination):
FILL_FUNC_BODY | class PathDirectoryDescription:
def __init__(self, path):
self.path = path
def write_to(self, destination):
FILL_FUNC_BODY | shutil.copytree(self.path, destination)
| shutil.copytree(self.path, destination)
| 2 | 45 | 19 | 64 | import json
import os
import shutil
from galaxy.util import safe_makedirs
from .cwltool_deps import ref_resolver
from .parser import (
JOB_JSON_FILE,
load_job_proxy,
)
from .util import (
SECONDARY_FILES_INDEX_PATH,
STORE_SECONDARY_FILES_WITH_BASENAME,
)
def file_dict_to_description(file_dict):
o... | import json
import os
import shutil
from galaxy.util import safe_makedirs
from .cwltool_deps import ref_resolver
from .parser import (
JOB_JSON_FILE,
load_job_proxy,
)
from .util import (
SECONDARY_FILES_INDEX_PATH,
STORE_SECONDARY_FILES_WITH_BASENAME,
)
def file_dict_to_description(file_dict):
o... |
46,000 | /home/hieuvd/dung_repo/raw/stars_03/galaxyproject_galaxy/galaxy | /home/hieuvd/dung_repo/raw/stars_03/galaxyproject_galaxy/galaxy/lib/galaxy/tool_util/cwl/runtime_actions.py | 38,39 | 34,43 | write_to | PathFileDescription | 39,43 | 39,43 | class PathFileDescription:
def __init__(self, path):
self.path = path
def write_to(self, destination):
FILL_FUNC_BODY | class PathFileDescription:
def __init__(self, path):
self.path = path
def write_to(self, destination):
FILL_FUNC_BODY | # TODO: Move if we can be sure this is in the working directory for instance...
shutil.copy(self.path, destination)
| # TODO: Move if we can be sure this is in the working directory for instance...
shutil.copy(self.path, destination)
| 18 | 45 | 39 | 84 | import json
import os
import shutil
from galaxy.util import safe_makedirs
from .cwltool_deps import ref_resolver
from .parser import (
JOB_JSON_FILE,
load_job_proxy,
)
from .util import (
SECONDARY_FILES_INDEX_PATH,
STORE_SECONDARY_FILES_WITH_BASENAME,
)
def file_dict_to_description(file_dict):
o... | import json
import os
import shutil
from galaxy.util import safe_makedirs
from .cwltool_deps import ref_resolver
from .parser import (
JOB_JSON_FILE,
load_job_proxy,
)
from .util import (
SECONDARY_FILES_INDEX_PATH,
STORE_SECONDARY_FILES_WITH_BASENAME,
)
def file_dict_to_description(file_dict):
o... |
46,001 | /home/hieuvd/dung_repo/raw/stars_03/galaxyproject_galaxy/galaxy | /home/hieuvd/dung_repo/raw/stars_03/galaxyproject_galaxy/galaxy/lib/galaxy/tool_util/cwl/schema.py | 51,52 | 32,108 | raw_process_reference | SchemaLoader | 52,72 | 52,72 | class SchemaLoader:
def __init__(self, strict=True, validate=True):
self._strict = strict
self._validate = validate
@property
def raw_document_loader(self):
ensure_cwltool_available()
return default_loader(None)
def loading_context(self):
loading_context = Loadi... | class SchemaLoader:
def __init__(self, strict=True, validate=True):
self._strict = strict
self._validate = validate
@property
def raw_document_loader(self):
ensure_cwltool_available()
return default_loader(None)
def loading_context(self):
loading_context = Loadi... | suffix = ""
if "#" in path:
path, suffix = path.split("#")
path = os.path.abspath(path)
uri = f"file://{path}"
loading_context = loading_context or self.loading_context()
with tempfile.TemporaryDirectory() as output_dir:
processed_path = os.path.jo... | suffix = ""
if "#" in path:
path, suffix = path.split("#")
path = os.path.abspath(path)
uri = f"file://{path}"
loading_context = loading_context or self.loading_context()
with tempfile.TemporaryDirectory() as output_dir:
processed_path = os.path.jo... | 89 | 602 | 341 | 943 | """Abstraction around cwltool and related libraries for loading a CWL artifact."""
import os
import tempfile
from typing import NamedTuple
from .cwltool_deps import (
CommentedMap,
default_loader,
ensure_cwltool_available,
load_tool,
LoadingContext,
resolve_and_validate_document,
)
class Raw... | """Abstraction around cwltool and related libraries for loading a CWL artifact."""
import os
import tempfile
from typing import NamedTuple
from .cwltool_deps import (
CommentedMap,
default_loader,
ensure_cwltool_available,
load_tool,
LoadingContext,
resolve_and_validate_document,
)
class Raw... |
46,003 | /home/hieuvd/dung_repo/raw/stars_03/galaxyproject_galaxy/galaxy | /home/hieuvd/dung_repo/raw/stars_03/galaxyproject_galaxy/galaxy/lib/galaxy/tool_util/data/bundles/models.py | 52,55 | 44,61 | fill_in_default_data_table_name | DataTableBundleProcessorDataTableOutputColumn | 55,61 | 55,61 | class DataTableBundleProcessorDataTableOutputColumn(BaseModel):
name: str
data_table_name: str
output_ref: Optional[str] = None
value_translations: List[DataTableBundleProcessorDataTableOutputColumnTranslation] = []
moves: List[DataTableBundleProcessorDataTableOutputColumnMove] = []
model_config... | class DataTableBundleProcessorDataTableOutputColumn(BaseModel):
name: str
data_table_name: str
output_ref: Optional[str] = None
value_translations: List[DataTableBundleProcessorDataTableOutputColumnTranslation] = []
moves: List[DataTableBundleProcessorDataTableOutputColumnMove] = []
model_config... | data_table_name = values.get("data_table_name")
if data_table_name is None:
values["data_table_name"] = values["name"]
return values
| data_table_name = values.get("data_table_name")
if data_table_name is None:
values["data_table_name"] = values["name"]
return values
| 12 | 145 | 56 | 201 | import os
from typing import (
Callable,
Dict,
Iterator,
List,
Optional,
Tuple,
Union,
)
from pydantic import (
BaseModel,
ConfigDict,
model_validator,
)
from galaxy.util import (
asbool,
Element,
)
DEFAULT_VALUE_TRANSLATION_TYPE = "template"
VALUE_TRANSLATION_FUNCTION... | import os
from typing import (
Callable,
Dict,
Iterator,
List,
Optional,
Tuple,
Union,
)
from pydantic import (
BaseModel,
ConfigDict,
model_validator,
)
from galaxy.util import (
asbool,
Element,
)
DEFAULT_VALUE_TRANSLATION_TYPE = "template"
VALUE_TRANSLATION_FUNCTION... |
46,004 | /home/hieuvd/dung_repo/raw/stars_03/galaxyproject_galaxy/galaxy | /home/hieuvd/dung_repo/raw/stars_03/galaxyproject_galaxy/galaxy/lib/galaxy/tool_util/data/bundles/models.py | 117,119 | 72,144 | value_translation_by_data_table_column | DataTableBundleProcessorDescription | 119,144 | 119,144 | class DataTableBundleProcessorDescription(BaseModel):
undeclared_tables: bool = False
data_tables: List[DataTableBundleProcessorDataTable]
model_config = ConfigDict(extra="forbid")
@property
def data_table_names(self) -> List[str]:
names = []
for data_table in self.data_tables:
... | class DataTableBundleProcessorDescription(BaseModel):
undeclared_tables: bool = False
data_tables: List[DataTableBundleProcessorDataTable]
model_config = ConfigDict(extra="forbid")
@property
def data_table_names(self) -> List[str]:
names = []
for data_table in self.data_tables:
... | by_column: Dict[str, Dict[str, List[Union[str, Callable]]]] = {}
for data_table_name, column in self._walk_columns():
data_table_column_name = column.data_table_name
for value_translation_model in column.value_translations:
value_translation_str = value_translatio... | by_column: Dict[str, Dict[str, List[Union[str, Callable]]]] = {}
for data_table_name, column in self._walk_columns():
data_table_column_name = column.data_table_name
for value_translation_model in column.value_translations:
value_translation_str = value_translatio... | 80 | 615 | 396 | 1,011 | import os
from typing import (
Callable,
Dict,
Iterator,
List,
Optional,
Tuple,
Union,
)
from pydantic import (
BaseModel,
ConfigDict,
model_validator,
)
from galaxy.util import (
asbool,
Element,
)
DEFAULT_VALUE_TRANSLATION_TYPE = "template"
VALUE_TRANSLATION_FUNCTION... | import os
from typing import (
Callable,
Dict,
Iterator,
List,
Optional,
Tuple,
Union,
)
from pydantic import (
BaseModel,
ConfigDict,
model_validator,
)
from galaxy.util import (
asbool,
Element,
)
DEFAULT_VALUE_TRANSLATION_TYPE = "template"
VALUE_TRANSLATION_FUNCTION... |
46,006 | /home/hieuvd/dung_repo/raw/stars_03/galaxyproject_galaxy/galaxy | /home/hieuvd/dung_repo/raw/stars_03/galaxyproject_galaxy/galaxy/lib/galaxy/tool_util/deps/brew_exts.py | 400,401 | 370,410 | to_statements | EnvAction | 401,410 | 401,410 | class EnvAction:
def __init__(self, keg_root, action_description):
self.variable = action_description["variable"]
self.action = action_description["action"]
self.value = string.Template(action_description["value"]).safe_substitute(
{
"KEG_ROOT": keg_root,
... | class EnvAction:
def __init__(self, keg_root, action_description):
self.variable = action_description["variable"]
self.action = action_description["action"]
self.value = string.Template(action_description["value"]).safe_substitute(
{
"KEG_ROOT": keg_root,
... | if self.action == "set":
template = '''${variable}="${value}"'''
elif self.action == "prepend":
template = '''${variable}="${value}:$$${variable}"'''
else:
template = '''${variable}="$$${variable}:${value}"'''
return [self.__eval(template), f"export {s... | if self.action == "set":
template = '''${variable}="${value}"'''
elif self.action == "prepend":
template = '''${variable}="${value}:$$${variable}"'''
else:
template = '''${variable}="$$${variable}:${value}"'''
return [self.__eval(template), f"export {s... | 22 | 350 | 116 | 466 | #!/usr/bin/env python
# % brew vinstall samtools 1.0
# % brew vinstall samtools 0.1.19
# % brew vinstall samtools 1.1
# % brew env samtools 1.1
# PATH=/home/john/.linuxbrew/Cellar/htslib/1.1/bin:/home/john/.linuxbrew/Cellar/samtools/1.1/bin:$PATH
# export PATH
# LD_LIBRARY_PATH=/home/john/.linuxbrew/Cellar/htslib/1.1/... | #!/usr/bin/env python
# % brew vinstall samtools 1.0
# % brew vinstall samtools 0.1.19
# % brew vinstall samtools 1.1
# % brew env samtools 1.1
# PATH=/home/john/.linuxbrew/Cellar/htslib/1.1/bin:/home/john/.linuxbrew/Cellar/samtools/1.1/bin:$PATH
# export PATH
# LD_LIBRARY_PATH=/home/john/.linuxbrew/Cellar/htslib/1.1/... |
46,007 | /home/hieuvd/dung_repo/raw/stars_03/galaxyproject_galaxy/galaxy | /home/hieuvd/dung_repo/raw/stars_03/galaxyproject_galaxy/galaxy/lib/galaxy/tool_util/deps/brew_exts.py | 86,87 | 68,109 | __tap_path | RecipeContext | 87,109 | 87,109 | class RecipeContext:
@staticmethod
def from_args(args, brew_context=None):
return RecipeContext(args.recipe, args.version, brew_context)
def __init__(self, recipe, version, brew_context=None):
self.recipe = recipe
self.version = version
self.brew_context = brew_context or Br... | class RecipeContext:
@staticmethod
def from_args(args, brew_context=None):
return RecipeContext(args.recipe, args.version, brew_context)
def __init__(self, recipe, version, brew_context=None):
self.recipe = recipe
self.version = version
self.brew_context = brew_context or Br... | parts = recipe.split("/")
if len(parts) == 1:
info = brew_info(self.recipe)
from_url = info["from_url"]
if not from_url:
raise Exception(CANNOT_DETERMINE_TAP_ERROR_MESSAGE)
from_url_parts = from_url.split("/")
blob_index = from_... | parts = recipe.split("/")
if len(parts) == 1:
info = brew_info(self.recipe)
from_url = info["from_url"]
if not from_url:
raise Exception(CANNOT_DETERMINE_TAP_ERROR_MESSAGE)
from_url_parts = from_url.split("/")
blob_index = from_... | 67 | 222 | 272 | 494 | #!/usr/bin/env python
# % brew vinstall samtools 1.0
# % brew vinstall samtools 0.1.19
# % brew vinstall samtools 1.1
# % brew env samtools 1.1
# PATH=/home/john/.linuxbrew/Cellar/htslib/1.1/bin:/home/john/.linuxbrew/Cellar/samtools/1.1/bin:$PATH
# export PATH
# LD_LIBRARY_PATH=/home/john/.linuxbrew/Cellar/htslib/1.1/... | #!/usr/bin/env python
# % brew vinstall samtools 1.0
# % brew vinstall samtools 0.1.19
# % brew vinstall samtools 1.1
# % brew env samtools 1.1
# PATH=/home/john/.linuxbrew/Cellar/htslib/1.1/bin:/home/john/.linuxbrew/Cellar/samtools/1.1/bin:$PATH
# export PATH
# LD_LIBRARY_PATH=/home/john/.linuxbrew/Cellar/htslib/1.1/... |
46,008 | /home/hieuvd/dung_repo/raw/stars_03/galaxyproject_galaxy/galaxy | /home/hieuvd/dung_repo/raw/stars_03/galaxyproject_galaxy/galaxy/lib/galaxy/tool_util/deps/brew_util.py | 22,23 | 1,37 | requirement_to_recipe | 23,32 | 23,32 | """ brew_exts defines generic extensions to Homebrew this file
builds on those abstraction and provides Galaxy specific functionality
not useful to the brew external commands.
"""
from . import brew_exts
DEFAULT_TAP = "homebrew/science"
class HomebrewRecipe:
def __init__(self, recipe, version, tap):
sel... | """ brew_exts defines generic extensions to Homebrew this file
builds on those abstraction and provides Galaxy specific functionality
not useful to the brew external commands.
"""
from . import brew_exts
DEFAULT_TAP = "homebrew/science"
class HomebrewRecipe:
def __init__(self, recipe, version, tap):
sel... | if requirement.type != "package":
return None
# TOOD: Allow requirements to annotate optionalbrew specific
# adaptions.
recipe_name = requirement.name
recipe_version = requirement.version
return HomebrewRecipe(recipe_name, recipe_version, tap=DEFAULT_TAP)
| if requirement.type != "package":
return None
# TOOD: Allow requirements to annotate optionalbrew specific
# adaptions.
recipe_name = requirement.name
recipe_version = requirement.version
return HomebrewRecipe(recipe_name, recipe_version, tap=DEFAULT_TAP)
| 26 | 253 | 88 | 341 | """ brew_exts defines generic extensions to Homebrew this file
builds on those abstraction and provides Galaxy specific functionality
not useful to the brew external commands.
"""
from . import brew_exts
DEFAULT_TAP = "homebrew/science"
class HomebrewRecipe:
def __init__(self, recipe, version, tap):
sel... | """ brew_exts defines generic extensions to Homebrew this file
builds on those abstraction and provides Galaxy specific functionality
not useful to the brew external commands.
"""
from . import brew_exts
DEFAULT_TAP = "homebrew/science"
class HomebrewRecipe:
def __init__(self, recipe, version, tap):
sel... | |
46,009 | /home/hieuvd/dung_repo/raw/stars_03/galaxyproject_galaxy/galaxy | /home/hieuvd/dung_repo/raw/stars_03/galaxyproject_galaxy/galaxy/lib/galaxy/tool_util/deps/conda_compat.py | 47,48 | 1,110 | _render_jinja2 | 49,60 | 48,60 | """Compat. layer with conda_build/verify if Galaxy/galaxy-lib not installed through conda.
In general there are utilities available for Conda building and parsing that are high-quality
and should be utilized when available but that are only available in conda channels and not in
PyPI. This module serves as a PyPI capa... | """Compat. layer with conda_build/verify if Galaxy/galaxy-lib not installed through conda.
In general there are utilities available for Conda building and parsing that are high-quality
and should be utilized when available but that are only available in conda channels and not in
PyPI. This module serves as a PyPI capa... | try:
import jinja2
except ImportError:
raise Exception("Failed to import jinja2 for evaluating Conda recipe templates.")
loaders = [jinja2.FileSystemLoader(recipe_dir)]
env = jinja2.Environment(loader=jinja2.ChoiceLoader(loaders))
template = env.get_or_select_template("meta.yaml")
... | """Evaluate Conda recipe as a jinja template."""
try:
import jinja2
except ImportError:
raise Exception("Failed to import jinja2 for evaluating Conda recipe templates.")
loaders = [jinja2.FileSystemLoader(recipe_dir)]
env = jinja2.Environment(loader=jinja2.ChoiceLoader(loaders))
... | 26 | 747 | 125 | 872 | """Compat. layer with conda_build/verify if Galaxy/galaxy-lib not installed through conda.
In general there are utilities available for Conda building and parsing that are high-quality
and should be utilized when available but that are only available in conda channels and not in
PyPI. This module serves as a PyPI capa... | """Compat. layer with conda_build/verify if Galaxy/galaxy-lib not installed through conda.
In general there are utilities available for Conda building and parsing that are high-quality
and should be utilized when available but that are only available in conda channels and not in
PyPI. This module serves as a PyPI capa... | |
46,010 | /home/hieuvd/dung_repo/raw/stars_03/galaxyproject_galaxy/galaxy | /home/hieuvd/dung_repo/raw/stars_03/galaxyproject_galaxy/galaxy/lib/galaxy/tool_util/deps/conda_compat.py | 91,92 | 87,103 | get_value | _MetaData | 93,103 | 92,103 | class _MetaData:
def __init__(self, input_dir):
self.meta = raw_metadata(input_dir)
def get_value(self, field, default=None):
FILL_FUNC_BODY | class _MetaData:
def __init__(self, input_dir):
self.meta = raw_metadata(input_dir)
def get_value(self, field, default=None):
"""Get nested field value or supplied default is not present."""
FILL_FUNC_BODY | section, key = field.split("/")
submeta = self.meta.get(section)
if submeta is None:
submeta = {}
res = submeta.get(key)
if res is None:
res = default
return res
| """Get nested field value or supplied default is not present."""
section, key = field.split("/")
submeta = self.meta.get(section)
if submeta is None:
submeta = {}
res = submeta.get(key)
if res is None:
res = default
return res
| 26 | 72 | 77 | 149 | """Compat. layer with conda_build/verify if Galaxy/galaxy-lib not installed through conda.
In general there are utilities available for Conda building and parsing that are high-quality
and should be utilized when available but that are only available in conda channels and not in
PyPI. This module serves as a PyPI capa... | """Compat. layer with conda_build/verify if Galaxy/galaxy-lib not installed through conda.
In general there are utilities available for Conda building and parsing that are high-quality
and should be utilized when available but that are only available in conda channels and not in
PyPI. This module serves as a PyPI capa... |
46,013 | /home/hieuvd/dung_repo/raw/stars_03/galaxyproject_galaxy/galaxy | /home/hieuvd/dung_repo/raw/stars_03/galaxyproject_galaxy/galaxy/lib/galaxy/tool_util/deps/conda_util.py | 492,494 | 436,517 | capitalized_install_environment | CondaTarget | 498,503 | 494,503 | class CondaTarget:
def __init__(
self, package: str, version: Optional[str] = None, build: Optional[str] = None, channel: Optional[str] = None
) -> None:
if SHELL_UNSAFE_PATTERN.search(package) is not None:
raise ValueError(f"Invalid package [{package}] encountered.")
self.ca... | class CondaTarget:
def __init__(
self, package: str, version: Optional[str] = None, build: Optional[str] = None, channel: Optional[str] = None
) -> None:
if SHELL_UNSAFE_PATTERN.search(package) is not None:
raise ValueError(f"Invalid package [{package}] encountered.")
self.ca... | if self.version:
return f"__{self.capitalized_package}@{self.version}"
else:
return f"__{self.capitalized_package}@_uv_"
| """Same as install_environment() but using the original capitalized
package name for backward compatibility with environments created before
Galaxy 23.1 .
"""
if self.version:
return f"__{self.capitalized_package}@{self.version}"
else:
return f"__{... | 7 | 792 | 54 | 846 | import functools
import hashlib
import json
import logging
import os
import platform
import re
import shutil
import sys
import tempfile
from typing import (
Any,
Callable,
Dict,
Iterable,
Iterator,
List,
Optional,
Tuple,
TYPE_CHECKING,
Union,
)
from packaging.version import Vers... | import functools
import hashlib
import json
import logging
import os
import platform
import re
import shutil
import sys
import tempfile
from typing import (
Any,
Callable,
Dict,
Iterable,
Iterator,
List,
Optional,
Tuple,
TYPE_CHECKING,
Union,
)
from packaging.version import Vers... |
46,014 | /home/hieuvd/dung_repo/raw/stars_03/galaxyproject_galaxy/galaxy | /home/hieuvd/dung_repo/raw/stars_03/galaxyproject_galaxy/galaxy/lib/galaxy/tool_util/deps/container_resolvers/explicit.py | 141,142 | 136,150 | _container_description | BaseAdminConfiguredContainerResolver | 142,150 | 142,150 | class BaseAdminConfiguredContainerResolver(ContainerResolver):
def __init__(self, app_info: "AppInfo", shell: str = DEFAULT_SHELL, **kwds) -> None:
super().__init__(app_info=app_info, **kwds)
self.shell = shell
def _container_description(self, identifier: str, container_type: str) -> ContainerD... | class BaseAdminConfiguredContainerResolver(ContainerResolver):
def __init__(self, app_info: "AppInfo", shell: str = DEFAULT_SHELL, **kwds) -> None:
super().__init__(app_info=app_info, **kwds)
self.shell = shell
def _container_description(self, identifier: str, container_type: str) -> ContainerD... | container_description = ContainerDescription(
identifier,
type=container_type,
shell=self.shell,
)
return container_description
| container_description = ContainerDescription(
identifier,
type=container_type,
shell=self.shell,
)
return container_description
| 9 | 110 | 49 | 159 | """This module describes the :class:`ExplicitContainerResolver` ContainerResolver plugin."""
import copy
import logging
import os
from typing import (
cast,
Container,
Optional,
TYPE_CHECKING,
)
from galaxy.util.commands import shell
from . import ContainerResolver
from .mulled import CliContainerReso... | """This module describes the :class:`ExplicitContainerResolver` ContainerResolver plugin."""
import copy
import logging
import os
from typing import (
cast,
Container,
Optional,
TYPE_CHECKING,
)
from galaxy.util.commands import shell
from . import ContainerResolver
from .mulled import CliContainerReso... |
46,015 | /home/hieuvd/dung_repo/raw/stars_03/galaxyproject_galaxy/galaxy | /home/hieuvd/dung_repo/raw/stars_03/galaxyproject_galaxy/galaxy/lib/galaxy/tool_util/deps/container_resolvers/explicit.py | 91,94 | 77,136 | resolve | CachedExplicitSingularityContainerResolver | 100,132 | 94,132 | class CachedExplicitSingularityContainerResolver(CliContainerResolver):
resolver_type = "cached_explicit_singularity"
container_type = "singularity"
cli = "singularity"
def __init__(self, app_info: "AppInfo", **kwargs) -> None:
super().__init__(app_info=app_info, **kwargs)
cache_directo... | class CachedExplicitSingularityContainerResolver(CliContainerResolver):
resolver_type = "cached_explicit_singularity"
container_type = "singularity"
cli = "singularity"
def __init__(self, app_info: "AppInfo", **kwargs) -> None:
super().__init__(app_info=app_info, **kwargs)
cache_directo... | for container_description in tool_info.container_descriptions: # type: ContainerDescription
container_description = copy.copy(container_description)
if container_description.type == "docker":
container_description.type = self.container_type
container_desc... | """Find a container explicitly mentioned in tool description.
This ignores the tool requirements and assumes the tool author crafted
a correct container. We use singularity here to fetch docker containers,
hence the container_description hack here.
"""
for container_desc... | 91 | 370 | 431 | 801 | """This module describes the :class:`ExplicitContainerResolver` ContainerResolver plugin."""
import copy
import logging
import os
from typing import (
cast,
Container,
Optional,
TYPE_CHECKING,
)
from galaxy.util.commands import shell
from . import ContainerResolver
from .mulled import CliContainerReso... | """This module describes the :class:`ExplicitContainerResolver` ContainerResolver plugin."""
import copy
import logging
import os
from typing import (
cast,
Container,
Optional,
TYPE_CHECKING,
)
from galaxy.util.commands import shell
from . import ContainerResolver
from .mulled import CliContainerReso... |
46,016 | /home/hieuvd/dung_repo/raw/stars_03/galaxyproject_galaxy/galaxy | /home/hieuvd/dung_repo/raw/stars_03/galaxyproject_galaxy/galaxy/lib/galaxy/tool_util/deps/container_resolvers/explicit.py | 35,38 | 30,51 | resolve | ExplicitContainerResolver | 43,51 | 38,51 | class ExplicitContainerResolver(ContainerResolver):
"""Find explicit containers referenced in the tool description (e.g. tool XML file) if present."""
resolver_type = "explicit"
def resolve(
self, enabled_container_types: Container[str], tool_info: "ToolInfo", **kwds
) -> Optional[ContainerDes... | class ExplicitContainerResolver(ContainerResolver):
"""Find explicit containers referenced in the tool description (e.g. tool XML file) if present."""
resolver_type = "explicit"
def resolve(
self, enabled_container_types: Container[str], tool_info: "ToolInfo", **kwds
) -> Optional[ContainerDes... | for container_description in tool_info.container_descriptions:
if self._container_type_enabled(container_description, enabled_container_types):
container_description.explicit = True
return container_description
return None
| """Find a container explicitly mentioned in tool description.
This ignores the tool requirements and assumes the tool author crafted
a correct container.
"""
for container_description in tool_info.container_descriptions:
if self._container_type_enabled(container_desc... | 14 | 134 | 69 | 203 | """This module describes the :class:`ExplicitContainerResolver` ContainerResolver plugin."""
import copy
import logging
import os
from typing import (
cast,
Container,
Optional,
TYPE_CHECKING,
)
from galaxy.util.commands import shell
from . import ContainerResolver
from .mulled import CliContainerReso... | """This module describes the :class:`ExplicitContainerResolver` ContainerResolver plugin."""
import copy
import logging
import os
from typing import (
cast,
Container,
Optional,
TYPE_CHECKING,
)
from galaxy.util.commands import shell
from . import ContainerResolver
from .mulled import CliContainerReso... |
46,017 | /home/hieuvd/dung_repo/raw/stars_03/galaxyproject_galaxy/galaxy | /home/hieuvd/dung_repo/raw/stars_03/galaxyproject_galaxy/galaxy/lib/galaxy/tool_util/deps/container_resolvers/explicit.py | 55,58 | 51,77 | resolve | ExplicitSingularityContainerResolver | 64,77 | 58,77 | class ExplicitSingularityContainerResolver(ExplicitContainerResolver):
resolver_type = "explicit_singularity"
container_type = "singularity"
def resolve(
self, enabled_container_types: Container[str], tool_info: "ToolInfo", **kwds
) -> Optional[ContainerDescription]:
FILL_FUNC_BODY | class ExplicitSingularityContainerResolver(ExplicitContainerResolver):
resolver_type = "explicit_singularity"
container_type = "singularity"
def resolve(
self, enabled_container_types: Container[str], tool_info: "ToolInfo", **kwds
) -> Optional[ContainerDescription]:
"""Find a container... | for container_description in tool_info.container_descriptions:
if container_description.type == "docker":
desc_dict = container_description.to_dict()
desc_dict["type"] = self.container_type
desc_dict["identifier"] = f"docker://{container_description.id... | """Find a container explicitly mentioned in tool description.
This ignores the tool requirements and assumes the tool author crafted
a correct container. We use singularity here to fetch docker containers,
hence the container_description hack here.
"""
for container_desc... | 34 | 150 | 158 | 308 | """This module describes the :class:`ExplicitContainerResolver` ContainerResolver plugin."""
import copy
import logging
import os
from typing import (
cast,
Container,
Optional,
TYPE_CHECKING,
)
from galaxy.util.commands import shell
from . import ContainerResolver
from .mulled import CliContainerReso... | """This module describes the :class:`ExplicitContainerResolver` ContainerResolver plugin."""
import copy
import logging
import os
from typing import (
cast,
Container,
Optional,
TYPE_CHECKING,
)
from galaxy.util.commands import shell
from . import ContainerResolver
from .mulled import CliContainerReso... |
46,018 | /home/hieuvd/dung_repo/raw/stars_03/galaxyproject_galaxy/galaxy | /home/hieuvd/dung_repo/raw/stars_03/galaxyproject_galaxy/galaxy/lib/galaxy/tool_util/deps/container_resolvers/explicit.py | 171,174 | 150,180 | resolve | FallbackContainerResolver | 174,180 | 174,180 | class FallbackContainerResolver(BaseAdminConfiguredContainerResolver):
"""Specify an explicit, identified container as a Docker container resolver."""
resolver_type = "fallback"
container_type = "docker"
def __init__(self, app_info: "AppInfo", identifier: str = "", **kwds) -> None:
super().__i... | class FallbackContainerResolver(BaseAdminConfiguredContainerResolver):
"""Specify an explicit, identified container as a Docker container resolver."""
resolver_type = "fallback"
container_type = "docker"
def __init__(self, app_info: "AppInfo", identifier: str = "", **kwds) -> None:
super().__i... | container_description = self._container_description(self.identifier, self.container_type)
if self._match(enabled_container_types, tool_info, container_description):
return container_description
return None
| container_description = self._container_description(self.identifier, self.container_type)
if self._match(enabled_container_types, tool_info, container_description):
return container_description
return None
| 12 | 262 | 61 | 323 | """This module describes the :class:`ExplicitContainerResolver` ContainerResolver plugin."""
import copy
import logging
import os
from typing import (
cast,
Container,
Optional,
TYPE_CHECKING,
)
from galaxy.util.commands import shell
from . import ContainerResolver
from .mulled import CliContainerReso... | """This module describes the :class:`ExplicitContainerResolver` ContainerResolver plugin."""
import copy
import logging
import os
from typing import (
cast,
Container,
Optional,
TYPE_CHECKING,
)
from galaxy.util.commands import shell
from . import ContainerResolver
from .mulled import CliContainerReso... |
46,019 | /home/hieuvd/dung_repo/raw/stars_03/galaxyproject_galaxy/galaxy | /home/hieuvd/dung_repo/raw/stars_03/galaxyproject_galaxy/galaxy/lib/galaxy/tool_util/deps/container_resolvers/explicit.py | 190,196 | 187,200 | _match | FallbackNoRequirementsContainerResolver | 196,200 | 196,200 | class FallbackNoRequirementsContainerResolver(FallbackContainerResolver):
resolver_type = "fallback_no_requirements"
def _match(
self,
enabled_container_types: Container[str],
tool_info: "ToolInfo",
container_description: ContainerDescription,
) -> bool:
FILL_FUNC_BODY | class FallbackNoRequirementsContainerResolver(FallbackContainerResolver):
resolver_type = "fallback_no_requirements"
def _match(
self,
enabled_container_types: Container[str],
tool_info: "ToolInfo",
container_description: ContainerDescription,
) -> bool:
FILL_FUNC_BODY | type_matches = super()._match(enabled_container_types, tool_info, container_description)
return type_matches and (tool_info.requirements is None or len(tool_info.requirements) == 0)
| type_matches = super()._match(enabled_container_types, tool_info, container_description)
return type_matches and (tool_info.requirements is None or len(tool_info.requirements) == 0)
| 15 | 93 | 62 | 155 | """This module describes the :class:`ExplicitContainerResolver` ContainerResolver plugin."""
import copy
import logging
import os
from typing import (
cast,
Container,
Optional,
TYPE_CHECKING,
)
from galaxy.util.commands import shell
from . import ContainerResolver
from .mulled import CliContainerReso... | """This module describes the :class:`ExplicitContainerResolver` ContainerResolver plugin."""
import copy
import logging
import os
from typing import (
cast,
Container,
Optional,
TYPE_CHECKING,
)
from galaxy.util.commands import shell
from . import ContainerResolver
from .mulled import CliContainerReso... |
46,020 | /home/hieuvd/dung_repo/raw/stars_03/galaxyproject_galaxy/galaxy | /home/hieuvd/dung_repo/raw/stars_03/galaxyproject_galaxy/galaxy/lib/galaxy/tool_util/deps/container_resolvers/explicit.py | 232,235 | 223,257 | resolve | MappingContainerResolver | 235,257 | 235,257 | class MappingContainerResolver(BaseAdminConfiguredContainerResolver):
resolver_type = "mapping"
def __init__(self, app_info: "AppInfo", **kwds) -> None:
super().__init__(app_info=app_info, **kwds)
mappings = self.resolver_kwds["mappings"]
assert isinstance(mappings, list), "mapping cont... | class MappingContainerResolver(BaseAdminConfiguredContainerResolver):
resolver_type = "mapping"
def __init__(self, app_info: "AppInfo", **kwds) -> None:
super().__init__(app_info=app_info, **kwds)
mappings = self.resolver_kwds["mappings"]
assert isinstance(mappings, list), "mapping cont... | tool_id = tool_info.tool_id
# If resolving against dependencies and not a specific tool, skip over this resolver
if not tool_id:
return None
tool_version = tool_info.tool_version
for mapping in self.mappings:
if mapping.get("tool_id") != tool_id:
... | tool_id = tool_info.tool_id
# If resolving against dependencies and not a specific tool, skip over this resolver
if not tool_id:
return None
tool_version = tool_info.tool_version
for mapping in self.mappings:
if mapping.get("tool_id") != tool_id:
... | 60 | 169 | 216 | 385 | """This module describes the :class:`ExplicitContainerResolver` ContainerResolver plugin."""
import copy
import logging
import os
from typing import (
cast,
Container,
Optional,
TYPE_CHECKING,
)
from galaxy.util.commands import shell
from . import ContainerResolver
from .mulled import CliContainerReso... | """This module describes the :class:`ExplicitContainerResolver` ContainerResolver plugin."""
import copy
import logging
import os
from typing import (
cast,
Container,
Optional,
TYPE_CHECKING,
)
from galaxy.util.commands import shell
from . import ContainerResolver
from .mulled import CliContainerReso... |
46,021 | /home/hieuvd/dung_repo/raw/stars_03/galaxyproject_galaxy/galaxy | /home/hieuvd/dung_repo/raw/stars_03/galaxyproject_galaxy/galaxy/lib/galaxy/tool_util/deps/container_resolvers/explicit.py | 208,214 | 205,218 | _match | RequiresGalaxyEnvironmentContainerResolver | 214,218 | 214,218 | class RequiresGalaxyEnvironmentContainerResolver(FallbackContainerResolver):
resolver_type = "requires_galaxy_environment"
def _match(
self,
enabled_container_types: Container[str],
tool_info: "ToolInfo",
container_description: ContainerDescription,
) -> bool:
FILL_FUNC_BODY | class RequiresGalaxyEnvironmentContainerResolver(FallbackContainerResolver):
resolver_type = "requires_galaxy_environment"
def _match(
self,
enabled_container_types: Container[str],
tool_info: "ToolInfo",
container_description: ContainerDescription,
) -> bool:
FILL_FUNC_BODY | type_matches = super()._match(enabled_container_types, tool_info, container_description)
return type_matches and tool_info.requires_galaxy_python_environment
| type_matches = super()._match(enabled_container_types, tool_info, container_description)
return type_matches and tool_info.requires_galaxy_python_environment
| 9 | 93 | 53 | 146 | """This module describes the :class:`ExplicitContainerResolver` ContainerResolver plugin."""
import copy
import logging
import os
from typing import (
cast,
Container,
Optional,
TYPE_CHECKING,
)
from galaxy.util.commands import shell
from . import ContainerResolver
from .mulled import CliContainerReso... | """This module describes the :class:`ExplicitContainerResolver` ContainerResolver plugin."""
import copy
import logging
import os
from typing import (
cast,
Container,
Optional,
TYPE_CHECKING,
)
from galaxy.util.commands import shell
from . import ContainerResolver
from .mulled import CliContainerReso... |
46,023 | /home/hieuvd/dung_repo/raw/stars_03/galaxyproject_galaxy/galaxy | /home/hieuvd/dung_repo/raw/stars_03/galaxyproject_galaxy/galaxy/lib/galaxy/tool_util/deps/container_resolvers/mulled.py | 750,753 | 717,768 | resolve | BuildMulledDockerContainerResolver | 753,764 | 753,764 | class BuildMulledDockerContainerResolver(CliContainerResolver):
"""Build for Docker mulled images matching tool dependencies."""
resolver_type = "build_mulled"
shell = "/bin/bash"
builds_on_resolution = True
def __init__(
self,
app_info: "AppInfo",
namespace: str = "local",... | class BuildMulledDockerContainerResolver(CliContainerResolver):
"""Build for Docker mulled images matching tool dependencies."""
resolver_type = "build_mulled"
shell = "/bin/bash"
builds_on_resolution = True
def __init__(
self,
app_info: "AppInfo",
namespace: str = "local",... | if tool_info.requires_galaxy_python_environment or self.container_type not in enabled_container_types:
return None
targets = mulled_targets(tool_info)
log.debug(f"Image name for tool {tool_info.tool_id}: {image_name(targets, self.hash_func)}")
if len(targets) == 0:
... | if tool_info.requires_galaxy_python_environment or self.container_type not in enabled_container_types:
return None
targets = mulled_targets(tool_info)
log.debug(f"Image name for tool {tool_info.tool_id}: {image_name(targets, self.hash_func)}")
if len(targets) == 0:
... | 37 | 519 | 195 | 714 | """This module describes the :class:`MulledContainerResolver` ContainerResolver plugin."""
import logging
import os
import subprocess
from abc import (
ABCMeta,
abstractmethod,
)
from typing import (
Callable,
Container as TypingContainer,
Dict,
List,
NamedTuple,
Optional,
Type,
... | """This module describes the :class:`MulledContainerResolver` ContainerResolver plugin."""
import logging
import os
import subprocess
from abc import (
ABCMeta,
abstractmethod,
)
from typing import (
Callable,
Container as TypingContainer,
Dict,
List,
NamedTuple,
Optional,
Type,
... |
46,024 | /home/hieuvd/dung_repo/raw/stars_03/galaxyproject_galaxy/galaxy | /home/hieuvd/dung_repo/raw/stars_03/galaxyproject_galaxy/galaxy/lib/galaxy/tool_util/deps/container_resolvers/mulled.py | 798,801 | 768,819 | resolve | BuildMulledSingularityContainerResolver | 801,815 | 801,815 | class BuildMulledSingularityContainerResolver(SingularityCliContainerResolver):
"""Build for Singularity mulled images matching tool dependencies."""
resolver_type = "build_mulled_singularity"
shell = "/bin/bash"
builds_on_resolution = True
def __init__(
self,
app_info: "AppInfo",
... | class BuildMulledSingularityContainerResolver(SingularityCliContainerResolver):
"""Build for Singularity mulled images matching tool dependencies."""
resolver_type = "build_mulled_singularity"
shell = "/bin/bash"
builds_on_resolution = True
def __init__(
self,
app_info: "AppInfo",
... | if tool_info.requires_galaxy_python_environment or self.container_type not in enabled_container_types:
return None
targets = mulled_targets(tool_info)
log.debug(f"Image name for tool {tool_info.tool_id}: {image_name(targets, self.hash_func)}")
if len(targets) == 0:
... | if tool_info.requires_galaxy_python_environment or self.container_type not in enabled_container_types:
return None
targets = mulled_targets(tool_info)
log.debug(f"Image name for tool {tool_info.tool_id}: {image_name(targets, self.hash_func)}")
if len(targets) == 0:
... | 39 | 514 | 205 | 719 | """This module describes the :class:`MulledContainerResolver` ContainerResolver plugin."""
import logging
import os
import subprocess
from abc import (
ABCMeta,
abstractmethod,
)
from typing import (
Callable,
Container as TypingContainer,
Dict,
List,
NamedTuple,
Optional,
Type,
... | """This module describes the :class:`MulledContainerResolver` ContainerResolver plugin."""
import logging
import os
import subprocess
from abc import (
ABCMeta,
abstractmethod,
)
from typing import (
Callable,
Container as TypingContainer,
Dict,
List,
NamedTuple,
Optional,
Type,
... |
46,025 | /home/hieuvd/dung_repo/raw/stars_03/galaxyproject_galaxy/galaxy | /home/hieuvd/dung_repo/raw/stars_03/galaxyproject_galaxy/galaxy/lib/galaxy/tool_util/deps/container_resolvers/mulled.py | 111,112 | 106,126 | _list_cached_mulled_images_from_path | CacheDirectory | 112,117 | 112,117 | class CacheDirectory(metaclass=ABCMeta):
def __init__(self, path: str, hash_func: Literal["v1", "v2"] = "v2") -> None:
self.path = path
self.hash_func = hash_func
def _list_cached_mulled_images_from_path(self) -> List[CachedTarget]:
FILL_FUNC_BODY @abstractmethod
def list_cached_mulled_i... | class CacheDirectory(metaclass=ABCMeta):
def __init__(self, path: str, hash_func: Literal["v1", "v2"] = "v2") -> None:
self.path = path
self.hash_func = hash_func
def _list_cached_mulled_images_from_path(self) -> List[CachedTarget]:
FILL_FUNC_BODY @abstractmethod
def list_cached_mulled_i... | contents = os.listdir(self.path)
sorted_images = version_sorted(contents)
raw_images = (identifier_to_cached_target(name, self.hash_func) for name in sorted_images)
return [i for i in raw_images if i is not None]
| contents = os.listdir(self.path)
sorted_images = version_sorted(contents)
raw_images = (identifier_to_cached_target(name, self.hash_func) for name in sorted_images)
return [i for i in raw_images if i is not None]
| 25 | 189 | 80 | 269 | """This module describes the :class:`MulledContainerResolver` ContainerResolver plugin."""
import logging
import os
import subprocess
from abc import (
ABCMeta,
abstractmethod,
)
from typing import (
Callable,
Container as TypingContainer,
Dict,
List,
NamedTuple,
Optional,
Type,
... | """This module describes the :class:`MulledContainerResolver` ContainerResolver plugin."""
import logging
import os
import subprocess
from abc import (
ABCMeta,
abstractmethod,
)
from typing import (
Callable,
Container as TypingContainer,
Dict,
List,
NamedTuple,
Optional,
Type,
... |
46,026 | /home/hieuvd/dung_repo/raw/stars_03/galaxyproject_galaxy/galaxy | /home/hieuvd/dung_repo/raw/stars_03/galaxyproject_galaxy/galaxy/lib/galaxy/tool_util/deps/container_resolvers/mulled.py | 514,517 | 503,535 | resolve | CachedMulledDockerContainerResolver | 517,531 | 517,531 | class CachedMulledDockerContainerResolver(CliContainerResolver):
resolver_type = "cached_mulled"
shell = "/bin/bash"
def __init__(
self, app_info: "AppInfo", namespace: str = "biocontainers", hash_func: Literal["v1", "v2"] = "v2", **kwds
):
super().__init__(app_info=app_info, **kwds)
... | class CachedMulledDockerContainerResolver(CliContainerResolver):
resolver_type = "cached_mulled"
shell = "/bin/bash"
def __init__(
self, app_info: "AppInfo", namespace: str = "biocontainers", hash_func: Literal["v1", "v2"] = "v2", **kwds
):
super().__init__(app_info=app_info, **kwds)
... | if (
not self.cli_available
or tool_info.requires_galaxy_python_environment
or self.container_type not in enabled_container_types
):
return None
targets = mulled_targets(tool_info)
log.debug(f"Image name for tool {tool_info.tool_id}: {imag... | if (
not self.cli_available
or tool_info.requires_galaxy_python_environment
or self.container_type not in enabled_container_types
):
return None
targets = mulled_targets(tool_info)
log.debug(f"Image name for tool {tool_info.tool_id}: {imag... | 35 | 220 | 180 | 400 | """This module describes the :class:`MulledContainerResolver` ContainerResolver plugin."""
import logging
import os
import subprocess
from abc import (
ABCMeta,
abstractmethod,
)
from typing import (
Callable,
Container as TypingContainer,
Dict,
List,
NamedTuple,
Optional,
Type,
... | """This module describes the :class:`MulledContainerResolver` ContainerResolver plugin."""
import logging
import os
import subprocess
from abc import (
ABCMeta,
abstractmethod,
)
from typing import (
Callable,
Container as TypingContainer,
Dict,
List,
NamedTuple,
Optional,
Type,
... |
46,027 | /home/hieuvd/dung_repo/raw/stars_03/galaxyproject_galaxy/galaxy | /home/hieuvd/dung_repo/raw/stars_03/galaxyproject_galaxy/galaxy/lib/galaxy/tool_util/deps/container_resolvers/mulled.py | 539,542 | 535,555 | resolve | CachedMulledSingularityContainerResolver | 542,551 | 542,551 | class CachedMulledSingularityContainerResolver(SingularityCliContainerResolver):
resolver_type = "cached_mulled_singularity"
shell = "/bin/bash"
def resolve(
self, enabled_container_types: TypingContainer[str], tool_info: "ToolInfo", **kwds
) -> Optional[ContainerDescription]:
FILL_FUNC_BODY ... | class CachedMulledSingularityContainerResolver(SingularityCliContainerResolver):
resolver_type = "cached_mulled_singularity"
shell = "/bin/bash"
def resolve(
self, enabled_container_types: TypingContainer[str], tool_info: "ToolInfo", **kwds
) -> Optional[ContainerDescription]:
FILL_FUNC_BODY ... | if tool_info.requires_galaxy_python_environment or self.container_type not in enabled_container_types:
return None
targets = mulled_targets(tool_info)
log.debug(f"Image name for tool {tool_info.tool_id}: {image_name(targets, self.hash_func)}")
return singularity_cached_conta... | if tool_info.requires_galaxy_python_environment or self.container_type not in enabled_container_types:
return None
targets = mulled_targets(tool_info)
log.debug(f"Image name for tool {tool_info.tool_id}: {image_name(targets, self.hash_func)}")
return singularity_cached_conta... | 26 | 146 | 137 | 283 | """This module describes the :class:`MulledContainerResolver` ContainerResolver plugin."""
import logging
import os
import subprocess
from abc import (
ABCMeta,
abstractmethod,
)
from typing import (
Callable,
Container as TypingContainer,
Dict,
List,
NamedTuple,
Optional,
Type,
... | """This module describes the :class:`MulledContainerResolver` ContainerResolver plugin."""
import logging
import os
import subprocess
from abc import (
ABCMeta,
abstractmethod,
)
from typing import (
Callable,
Container as TypingContainer,
Dict,
List,
NamedTuple,
Optional,
Type,
... |
46,028 | /home/hieuvd/dung_repo/raw/stars_03/galaxyproject_galaxy/galaxy | /home/hieuvd/dung_repo/raw/stars_03/galaxyproject_galaxy/galaxy/lib/galaxy/tool_util/deps/container_resolvers/mulled.py | 92,94 | 86,103 | package_hash | CachedV2MulledImageMultiTarget | 94,103 | 94,103 | class CachedV2MulledImageMultiTarget(NamedTuple):
image_name: str
version_hash: Optional[str]
build: Optional[str]
image_identifier: str
@property
def package_hash(self) -> str:
FILL_FUNC_BODY | class CachedV2MulledImageMultiTarget(NamedTuple):
image_name: str
version_hash: Optional[str]
build: Optional[str]
image_identifier: str
@property
def package_hash(self) -> str:
FILL_FUNC_BODY | # Make this work for Singularity file name or fully qualified Docker repository
# image names.
image_name = self.image_name
if "/" not in image_name:
return image_name
else:
return image_name.rsplit("/")[-1]
| # Make this work for Singularity file name or fully qualified Docker repository
# image names.
image_name = self.image_name
if "/" not in image_name:
return image_name
else:
return image_name.rsplit("/")[-1]
| 29 | 77 | 81 | 158 | """This module describes the :class:`MulledContainerResolver` ContainerResolver plugin."""
import logging
import os
import subprocess
from abc import (
ABCMeta,
abstractmethod,
)
from typing import (
Callable,
Container as TypingContainer,
Dict,
List,
NamedTuple,
Optional,
Type,
... | """This module describes the :class:`MulledContainerResolver` ContainerResolver plugin."""
import logging
import os
import subprocess
from abc import (
ABCMeta,
abstractmethod,
)
from typing import (
Callable,
Container as TypingContainer,
Dict,
List,
NamedTuple,
Optional,
Type,
... |
46,029 | /home/hieuvd/dung_repo/raw/stars_03/galaxyproject_galaxy/galaxy | /home/hieuvd/dung_repo/raw/stars_03/galaxyproject_galaxy/galaxy/lib/galaxy/tool_util/deps/container_resolvers/mulled.py | 477,479 | 465,486 | cli_available | CliContainerResolver | 479,486 | 479,486 | class CliContainerResolver(ContainerResolver):
container_type = "docker"
cli = "docker"
def __init__(self, app_info: "AppInfo", **kwargs) -> None:
super().__init__(app_info=app_info, **kwargs)
self._cli_available = bool(which(self.cli))
@property
def cli_available(self) -> bool:
... | class CliContainerResolver(ContainerResolver):
container_type = "docker"
cli = "docker"
def __init__(self, app_info: "AppInfo", **kwargs) -> None:
super().__init__(app_info=app_info, **kwargs)
self._cli_available = bool(which(self.cli))
@property
def cli_available(self) -> bool:
... | if not value:
log.info(
f"{self.cli} CLI not available, cannot list or pull images in Galaxy process. Does not impact kubernetes."
)
self._cli_available = value
| if not value:
log.info(
f"{self.cli} CLI not available, cannot list or pull images in Galaxy process. Does not impact kubernetes."
)
self._cli_available = value
| 24 | 150 | 63 | 213 | """This module describes the :class:`MulledContainerResolver` ContainerResolver plugin."""
import logging
import os
import subprocess
from abc import (
ABCMeta,
abstractmethod,
)
from typing import (
Callable,
Container as TypingContainer,
Dict,
List,
NamedTuple,
Optional,
Type,
... | """This module describes the :class:`MulledContainerResolver` ContainerResolver plugin."""
import logging
import os
import subprocess
from abc import (
ABCMeta,
abstractmethod,
)
from typing import (
Callable,
Container as TypingContainer,
Dict,
List,
NamedTuple,
Optional,
Type,
... |
46,030 | /home/hieuvd/dung_repo/raw/stars_03/galaxyproject_galaxy/galaxy | /home/hieuvd/dung_repo/raw/stars_03/galaxyproject_galaxy/galaxy/lib/galaxy/tool_util/deps/container_resolvers/mulled.py | 166,167 | 138,171 | invalidate_cache | DirMtimeCacheDirectory | 167,171 | 167,171 | class DirMtimeCacheDirectory(CacheDirectory):
cacher_type = "dir_mtime"
def __init__(self, path: str, **kwargs):
super().__init__(path, **kwargs)
self.invalidate_cache()
def __get_mtime(self) -> float:
return os.stat(self.path).st_mtime
def __cache(self) -> None:
self.... | class DirMtimeCacheDirectory(CacheDirectory):
cacher_type = "dir_mtime"
def __init__(self, path: str, **kwargs):
super().__init__(path, **kwargs)
self.invalidate_cache()
def __get_mtime(self) -> float:
return os.stat(self.path).st_mtime
def __cache(self) -> None:
self.... | self.__mtime = -1.0
self.__contents = []
| self.__mtime = -1.0
self.__contents = []
| 6 | 334 | 24 | 358 | """This module describes the :class:`MulledContainerResolver` ContainerResolver plugin."""
import logging
import os
import subprocess
from abc import (
ABCMeta,
abstractmethod,
)
from typing import (
Callable,
Container as TypingContainer,
Dict,
List,
NamedTuple,
Optional,
Type,
... | """This module describes the :class:`MulledContainerResolver` ContainerResolver plugin."""
import logging
import os
import subprocess
from abc import (
ABCMeta,
abstractmethod,
)
from typing import (
Callable,
Container as TypingContainer,
Dict,
List,
NamedTuple,
Optional,
Type,
... |
46,031 | /home/hieuvd/dung_repo/raw/stars_03/galaxyproject_galaxy/galaxy | /home/hieuvd/dung_repo/raw/stars_03/galaxyproject_galaxy/galaxy/lib/galaxy/tool_util/deps/container_resolvers/mulled.py | 575,582 | 555,672 | cached_container_description | MulledDockerContainerResolver | 582,592 | 582,592 | class MulledDockerContainerResolver(CliContainerResolver):
"""Look for mulled images matching tool dependencies."""
resolver_type = "mulled"
shell = "/bin/bash"
protocol: Optional[str] = None
def __init__(
self,
app_info: "AppInfo",
namespace: str = "biocontainers",
... | class MulledDockerContainerResolver(CliContainerResolver):
"""Look for mulled images matching tool dependencies."""
resolver_type = "mulled"
shell = "/bin/bash"
protocol: Optional[str] = None
def __init__(
self,
app_info: "AppInfo",
namespace: str = "biocontainers",
... | try:
return docker_cached_container_description(
targets, namespace, hash_func=hash_func, resolution_cache=resolution_cache
)
except subprocess.CalledProcessError:
# We should only get here if a docker binary is available, but command quits with a non-... | try:
return docker_cached_container_description(
targets, namespace, hash_func=hash_func, resolution_cache=resolution_cache
)
except subprocess.CalledProcessError:
# We should only get here if a docker binary is available, but command quits with a non-... | 56 | 1,008 | 134 | 1,142 | """This module describes the :class:`MulledContainerResolver` ContainerResolver plugin."""
import logging
import os
import subprocess
from abc import (
ABCMeta,
abstractmethod,
)
from typing import (
Callable,
Container as TypingContainer,
Dict,
List,
NamedTuple,
Optional,
Type,
... | """This module describes the :class:`MulledContainerResolver` ContainerResolver plugin."""
import logging
import os
import subprocess
from abc import (
ABCMeta,
abstractmethod,
)
from typing import (
Callable,
Container as TypingContainer,
Dict,
List,
NamedTuple,
Optional,
Type,
... |
46,032 | /home/hieuvd/dung_repo/raw/stars_03/galaxyproject_galaxy/galaxy | /home/hieuvd/dung_repo/raw/stars_03/galaxyproject_galaxy/galaxy/lib/galaxy/tool_util/deps/container_resolvers/mulled.py | 699,701 | 672,717 | can_list_containers | MulledSingularityContainerResolver | 701,704 | 701,704 | class MulledSingularityContainerResolver(SingularityCliContainerResolver, MulledDockerContainerResolver):
resolver_type = "mulled_singularity"
protocol = "docker://"
def __init__(
self,
app_info: "AppInfo",
hash_func: Literal["v1", "v2"] = "v2",
namespace: str = "biocontaine... | class MulledSingularityContainerResolver(SingularityCliContainerResolver, MulledDockerContainerResolver):
resolver_type = "mulled_singularity"
protocol = "docker://"
def __init__(
self,
app_info: "AppInfo",
hash_func: Literal["v1", "v2"] = "v2",
namespace: str = "biocontaine... | # Only needs access to path, doesn't require CLI
return True
| # Only needs access to path, doesn't require CLI
return True
| 11 | 461 | 23 | 484 | """This module describes the :class:`MulledContainerResolver` ContainerResolver plugin."""
import logging
import os
import subprocess
from abc import (
ABCMeta,
abstractmethod,
)
from typing import (
Callable,
Container as TypingContainer,
Dict,
List,
NamedTuple,
Optional,
Type,
... | """This module describes the :class:`MulledContainerResolver` ContainerResolver plugin."""
import logging
import os
import subprocess
from abc import (
ABCMeta,
abstractmethod,
)
from typing import (
Callable,
Container as TypingContainer,
Dict,
List,
NamedTuple,
Optional,
Type,
... |
46,033 | /home/hieuvd/dung_repo/raw/stars_03/galaxyproject_galaxy/galaxy | /home/hieuvd/dung_repo/raw/stars_03/galaxyproject_galaxy/galaxy/lib/galaxy/tool_util/deps/container_resolvers/mulled.py | 129,132 | 126,138 | list_cached_mulled_images_from_path | UncachedCacheDirectory | 132,134 | 132,134 | class UncachedCacheDirectory(CacheDirectory):
cacher_type = "uncached"
def list_cached_mulled_images_from_path(
self,
) -> List[CachedTarget]:
FILL_FUNC_BODY def invalidate_cache(self) -> None:
pass
| class UncachedCacheDirectory(CacheDirectory):
cacher_type = "uncached"
def list_cached_mulled_images_from_path(
self,
) -> List[CachedTarget]:
FILL_FUNC_BODY def invalidate_cache(self) -> None:
pass
| return self._list_cached_mulled_images_from_path()
| return self._list_cached_mulled_images_from_path()
| 2 | 84 | 23 | 107 | """This module describes the :class:`MulledContainerResolver` ContainerResolver plugin."""
import logging
import os
import subprocess
from abc import (
ABCMeta,
abstractmethod,
)
from typing import (
Callable,
Container as TypingContainer,
Dict,
List,
NamedTuple,
Optional,
Type,
... | """This module describes the :class:`MulledContainerResolver` ContainerResolver plugin."""
import logging
import os
import subprocess
from abc import (
ABCMeta,
abstractmethod,
)
from typing import (
Callable,
Container as TypingContainer,
Dict,
List,
NamedTuple,
Optional,
Type,
... |
46,034 | /home/hieuvd/dung_repo/raw/stars_03/galaxyproject_galaxy/galaxy | /home/hieuvd/dung_repo/raw/stars_03/galaxyproject_galaxy/galaxy/lib/galaxy/tool_util/deps/container_resolvers/test.py | 23,26 | 14,29 | resolve | NullContainerResolver | 26,29 | 26,29 | class NullContainerResolver(ContainerResolver):
"""
helper ContainerResolver that does not resolve ever
for testing
"""
resolver_type = "null"
def resolve(
self, enabled_container_types: Container[str], tool_info: "ToolInfo", **kwds
) -> Optional["ContainerDescription"]:
FILL_FUNC... | class NullContainerResolver(ContainerResolver):
"""
helper ContainerResolver that does not resolve ever
for testing
"""
resolver_type = "null"
def resolve(
self, enabled_container_types: Container[str], tool_info: "ToolInfo", **kwds
) -> Optional["ContainerDescription"]:
FILL_FUNC... | return None
| return None
| 2 | 95 | 9 | 104 | from typing import (
Container,
Optional,
TYPE_CHECKING,
)
from . import ContainerResolver
if TYPE_CHECKING:
from ..dependencies import ToolInfo
from ..requirements import ContainerDescription
class NullContainerResolver(ContainerResolver):
"""
helper ContainerResolver that does not reso... | from typing import (
Container,
Optional,
TYPE_CHECKING,
)
from . import ContainerResolver
if TYPE_CHECKING:
from ..dependencies import ToolInfo
from ..requirements import ContainerDescription
class NullContainerResolver(ContainerResolver):
"""
helper ContainerResolver that does not reso... |
46,036 | /home/hieuvd/dung_repo/raw/stars_03/galaxyproject_galaxy/galaxy | /home/hieuvd/dung_repo/raw/stars_03/galaxyproject_galaxy/galaxy/lib/galaxy/tool_util/deps/containers.py | 287,290 | 272,405 | __build_container_resolvers | ContainerRegistry | 290,315 | 290,315 | class ContainerRegistry:
"""Loop through enabled ContainerResolver plugins and find first match."""
def __init__(
self,
app_info: "AppInfo",
destination_info: Optional[Dict[str, Any]] = None,
mulled_resolution_cache: Optional["Cache"] = None,
) -> None:
self.resolver... | class ContainerRegistry:
"""Loop through enabled ContainerResolver plugins and find first match."""
def __init__(
self,
app_info: "AppInfo",
destination_info: Optional[Dict[str, Any]] = None,
mulled_resolution_cache: Optional["Cache"] = None,
) -> None:
self.resolver... | app_conf_file = getattr(app_info, "container_resolvers_config_file", None)
app_conf_dict = getattr(app_info, "container_resolvers_config_dict", None)
if destination_info is not None and (
"container_resolvers" in destination_info or "container_resolvers_config_file" in destination_i... | app_conf_file = getattr(app_info, "container_resolvers_config_file", None)
app_conf_dict = getattr(app_info, "container_resolvers_config_dict", None)
if destination_info is not None and (
"container_resolvers" in destination_info or "container_resolvers_config_file" in destination_i... | 86 | 1,400 | 366 | 1,766 | import collections
import logging
import os
from typing import (
Any,
Container as TypingContainer,
Dict,
List,
Optional,
Type,
TYPE_CHECKING,
)
from requests import Session
from typing_extensions import Literal
from galaxy.util import (
asbool,
plugin_config,
)
from .container_cla... | import collections
import logging
import os
from typing import (
Any,
Container as TypingContainer,
Dict,
List,
Optional,
Type,
TYPE_CHECKING,
)
from requests import Session
from typing_extensions import Literal
from galaxy.util import (
asbool,
plugin_config,
)
from .container_cla... |
46,037 | /home/hieuvd/dung_repo/raw/stars_03/galaxyproject_galaxy/galaxy | /home/hieuvd/dung_repo/raw/stars_03/galaxyproject_galaxy/galaxy/lib/galaxy/tool_util/deps/containers.py | 268,269 | 267,272 | find_container | NullContainerFinder | 269,272 | 269,272 | class NullContainerFinder:
def find_container(self, tool_info: "ToolInfo", destination_info: Dict[str, Any], job_info: "JobInfo") -> None:
FILL_FUNC_BODY | class NullContainerFinder:
def find_container(self, tool_info: "ToolInfo", destination_info: Dict[str, Any], job_info: "JobInfo") -> None:
FILL_FUNC_BODY | return None
| return None
| 2 | 57 | 9 | 66 | import collections
import logging
import os
from typing import (
Any,
Container as TypingContainer,
Dict,
List,
Optional,
Type,
TYPE_CHECKING,
)
from requests import Session
from typing_extensions import Literal
from galaxy.util import (
asbool,
plugin_config,
)
from .container_cla... | import collections
import logging
import os
from typing import (
Any,
Container as TypingContainer,
Dict,
List,
Optional,
Type,
TYPE_CHECKING,
)
from requests import Session
from typing_extensions import Literal
from galaxy.util import (
asbool,
plugin_config,
)
from .container_cla... |
46,038 | /home/hieuvd/dung_repo/raw/stars_03/galaxyproject_galaxy/galaxy | /home/hieuvd/dung_repo/raw/stars_03/galaxyproject_galaxy/galaxy/lib/galaxy/tool_util/deps/dependencies.py | 131,133 | 105,173 | from_dict | DependenciesDescription | 133,144 | 133,144 | class DependenciesDescription:
"""Capture (in a readily serializable way) context related a tool
dependencies - both the tool's listed requirements and the tool shed
related context required to resolve dependencies via the
ToolShedPackageDependencyResolver.
This is meant to enable remote resolution... | class DependenciesDescription:
"""Capture (in a readily serializable way) context related a tool
dependencies - both the tool's listed requirements and the tool shed
related context required to resolve dependencies via the
ToolShedPackageDependencyResolver.
This is meant to enable remote resolution... | if as_dict is None:
return None
requirements_dicts = as_dict.get("requirements", [])
requirements = ToolRequirements.from_list(requirements_dicts)
installed_tool_dependencies_dicts = as_dict.get("installed_tool_dependencies", [])
installed_tool_dependencies = list(
... | if as_dict is None:
return None
requirements_dicts = as_dict.get("requirements", [])
requirements = ToolRequirements.from_list(requirements_dicts)
installed_tool_dependencies_dicts = as_dict.get("installed_tool_dependencies", [])
installed_tool_dependencies = list(
... | 26 | 613 | 156 | 769 | from typing import (
Any,
Dict,
List,
Optional,
Union,
)
from galaxy.tool_util.deps.requirements import (
ContainerDescription,
ToolRequirement,
ToolRequirements,
)
from galaxy.util import bunch
from .mulled.mulled_build import DEFAULT_CHANNELS
class AppInfo:
def __init__(
... | from typing import (
Any,
Dict,
List,
Optional,
Union,
)
from galaxy.tool_util.deps.requirements import (
ContainerDescription,
ToolRequirement,
ToolRequirements,
)
from galaxy.util import bunch
from .mulled.mulled_build import DEFAULT_CHANNELS
class AppInfo:
def __init__(
... |
46,040 | /home/hieuvd/dung_repo/raw/stars_03/galaxyproject_galaxy/galaxy | /home/hieuvd/dung_repo/raw/stars_03/galaxyproject_galaxy/galaxy/lib/galaxy/tool_util/deps/dockerfiles.py | 22,23 | 1,70 | dockerfile_build | 23,58 | 23,58 | import logging
import os
from galaxy.tool_util.deps import docker_util
from galaxy.tool_util.deps.container_classes import docker_cache_path
from galaxy.tool_util.deps.requirements import parse_requirements_from_xml
from galaxy.tool_util.loader_directory import load_tool_elements_from_path
from galaxy.util import comm... | import logging
import os
from galaxy.tool_util.deps import docker_util
from galaxy.tool_util.deps.container_classes import docker_cache_path
from galaxy.tool_util.deps.requirements import parse_requirements_from_xml
from galaxy.tool_util.loader_directory import load_tool_elements_from_path
from galaxy.util import comm... | expected_container_names = set()
tool_directories = set()
for tool_path, tool_xml in load_tool_elements_from_path(path):
requirements, containers = parse_requirements_from_xml(tool_xml)
for container in containers:
if container.type == "docker":
expected_container... | expected_container_names = set()
tool_directories = set()
for tool_path, tool_xml in load_tool_elements_from_path(path):
requirements, containers = parse_requirements_from_xml(tool_xml)
for container in containers:
if container.type == "docker":
expected_container... | 93 | 347 | 466 | 813 | import logging
import os
from galaxy.tool_util.deps import docker_util
from galaxy.tool_util.deps.container_classes import docker_cache_path
from galaxy.tool_util.deps.requirements import parse_requirements_from_xml
from galaxy.tool_util.loader_directory import load_tool_elements_from_path
from galaxy.util import comm... | import logging
import os
from galaxy.tool_util.deps import docker_util
from galaxy.tool_util.deps.container_classes import docker_cache_path
from galaxy.tool_util.deps.requirements import parse_requirements_from_xml
from galaxy.tool_util.loader_directory import load_tool_elements_from_path
from galaxy.util import comm... | |
46,041 | /home/hieuvd/dung_repo/raw/stars_03/galaxyproject_galaxy/galaxy | /home/hieuvd/dung_repo/raw/stars_03/galaxyproject_galaxy/galaxy/lib/galaxy/tool_util/deps/installable.py | 37,38 | 1,73 | ensure_installed | 39,73 | 38,73 | """Abstractions for installing local software managed and required by Galaxy/galaxy-lib."""
import abc
import logging
import os
from galaxy.util.filelock import (
FileLock,
FileLockException,
)
log = logging.getLogger(__name__)
class InstallableContext(metaclass=abc.ABCMeta):
"""Represent a directory/c... | """Abstractions for installing local software managed and required by Galaxy/galaxy-lib."""
import abc
import logging
import os
from galaxy.util.filelock import (
FileLock,
FileLockException,
)
log = logging.getLogger(__name__)
class InstallableContext(metaclass=abc.ABCMeta):
"""Represent a directory/c... | parent_path = installable_context.parent_path
desc = installable_context.installable_description
def _check():
if not installable_context.is_installed():
if auto_init:
if installable_context.can_install():
if install_func(installable_context):
... | """Make sure target is installed - handle multiple processes potentially attempting installation."""
parent_path = installable_context.parent_path
desc = installable_context.installable_description
def _check():
if not installable_context.is_installed():
if auto_init:
... | 92 | 280 | 359 | 639 | """Abstractions for installing local software managed and required by Galaxy/galaxy-lib."""
import abc
import logging
import os
from galaxy.util.filelock import (
FileLock,
FileLockException,
)
log = logging.getLogger(__name__)
class InstallableContext(metaclass=abc.ABCMeta):
"""Represent a directory/c... | """Abstractions for installing local software managed and required by Galaxy/galaxy-lib."""
import abc
import logging
import os
from galaxy.util.filelock import (
FileLock,
FileLockException,
)
log = logging.getLogger(__name__)
class InstallableContext(metaclass=abc.ABCMeta):
"""Represent a directory/c... | |
46,042 | /home/hieuvd/dung_repo/raw/stars_03/galaxyproject_galaxy/galaxy | /home/hieuvd/dung_repo/raw/stars_03/galaxyproject_galaxy/galaxy/lib/galaxy/tool_util/deps/mulled/_cli.py | 6,7 | 1,19 | arg_parser | 8,18 | 7,18 | """CLI helpers for mulled command-line tools."""
import argparse
def arg_parser(argv, globals):
FILL_FUNC_BODY__all__ = ("arg_parser",)
| """CLI helpers for mulled command-line tools."""
import argparse
def arg_parser(argv, globals):
"""Build an argparser for this CLI tool."""
FILL_FUNC_BODY__all__ = ("arg_parser",)
| doc = globals["__doc__"]
description, epilog = doc.split("\n", 1)
parser = argparse.ArgumentParser(
description=description,
epilog=epilog,
formatter_class=argparse.RawTextHelpFormatter,
)
return parser
| """Build an argparser for this CLI tool."""
doc = globals["__doc__"]
description, epilog = doc.split("\n", 1)
parser = argparse.ArgumentParser(
description=description,
epilog=epilog,
formatter_class=argparse.RawTextHelpFormatter,
)
return parser
| 17 | 68 | 89 | 157 | """CLI helpers for mulled command-line tools."""
import argparse
def arg_parser(argv, globals):
FILL_FUNC_BODY__all__ = ("arg_parser",)
| """CLI helpers for mulled command-line tools."""
import argparse
def arg_parser(argv, globals):
"""Build an argparser for this CLI tool."""
FILL_FUNC_BODY__all__ = ("arg_parser",)
| |
46,045 | /home/hieuvd/dung_repo/raw/stars_03/galaxyproject_galaxy/galaxy | /home/hieuvd/dung_repo/raw/stars_03/galaxyproject_galaxy/galaxy/lib/galaxy/tool_util/deps/mulled/mulled_build.py | 432,434 | 394,437 | parent_path | InvolucroContext | 434,437 | 434,437 | class InvolucroContext(installable.InstallableContext):
installable_description = "Involucro"
def __init__(self, involucro_bin=None, shell_exec=None, verbose="3"):
if involucro_bin is None:
if os.path.exists("./involucro"):
self.involucro_bin = "./involucro"
else... | class InvolucroContext(installable.InstallableContext):
installable_description = "Involucro"
def __init__(self, involucro_bin=None, shell_exec=None, verbose="3"):
if involucro_bin is None:
if os.path.exists("./involucro"):
self.involucro_bin = "./involucro"
else... | return os.path.dirname(os.path.abspath(self.involucro_bin))
| return os.path.dirname(os.path.abspath(self.involucro_bin))
| 2 | 424 | 32 | 456 | #!/usr/bin/env python
"""Build a mulled image for specified conda targets.
Examples
Build a mulled image with:
mulled-build build 'samtools=1.3.1--4,bedtools=2.22'
"""
import json
import logging
import os
import shutil
import stat
import string
import subprocess
import sys
from sys import platform as _platform... | #!/usr/bin/env python
"""Build a mulled image for specified conda targets.
Examples
Build a mulled image with:
mulled-build build 'samtools=1.3.1--4,bedtools=2.22'
"""
import json
import logging
import os
import shutil
import stat
import string
import subprocess
import sys
from sys import platform as _platform... |
46,046 | /home/hieuvd/dung_repo/raw/stars_03/galaxyproject_galaxy/galaxy | /home/hieuvd/dung_repo/raw/stars_03/galaxyproject_galaxy/galaxy/lib/galaxy/tool_util/deps/mulled/mulled_build_channel.py | 94,95 | 1,141 | add_channel_arguments | 96,114 | 95,114 | #!/usr/bin/env python
"""Build a mulled images for all recent conda recipe updates that don't have existing images.
Examples:
Build mulled images for recent bioconda changes with:
mulled-build-channel build
Build, test, and publish images with the follow command:
mulled-build-channel all
See recent change... | #!/usr/bin/env python
"""Build a mulled images for all recent conda recipe updates that don't have existing images.
Examples:
Build mulled images for recent bioconda changes with:
mulled-build-channel build
Build, test, and publish images with the follow command:
mulled-build-channel all
See recent change... | parser.add_argument(
"--repo-data",
dest="repo_data",
required=True,
help='Published repository data. If you want to build all containers for bioconda, this parameter needs to be set to "bioconda"',
)
parser.add_argument(
"--diff-hours",
dest="diff_hours",
... | """Add arguments only used if running mulled over a whole conda channel."""
parser.add_argument(
"--repo-data",
dest="repo_data",
required=True,
help='Published repository data. If you want to build all containers for bioconda, this parameter needs to be set to "bioconda"',
)... | 55 | 1,115 | 221 | 1,336 | #!/usr/bin/env python
"""Build a mulled images for all recent conda recipe updates that don't have existing images.
Examples:
Build mulled images for recent bioconda changes with:
mulled-build-channel build
Build, test, and publish images with the follow command:
mulled-build-channel all
See recent change... | #!/usr/bin/env python
"""Build a mulled images for all recent conda recipe updates that don't have existing images.
Examples:
Build mulled images for recent bioconda changes with:
mulled-build-channel build
Build, test, and publish images with the follow command:
mulled-build-channel all
See recent change... | |
46,047 | /home/hieuvd/dung_repo/raw/stars_03/galaxyproject_galaxy/galaxy | /home/hieuvd/dung_repo/raw/stars_03/galaxyproject_galaxy/galaxy/lib/galaxy/tool_util/deps/mulled/mulled_build_files.py | 84,85 | 1,113 | tuple_from_header | 85,95 | 85,95 | """Build all composite mulled recipes discovered in TSV files.
Use mulled-build-channel to build images for single recipes for a whole conda
channel. This script instead builds images for combinations of recipes. This
script can be given a single TSV file or a directory of TSV files to process.
Examples:
Build all r... | """Build all composite mulled recipes discovered in TSV files.
Use mulled-build-channel to build images for single recipes for a whole conda
channel. This script instead builds images for combinations of recipes. This
script can be given a single TSV file or a directory of TSV files to process.
Examples:
Build all r... | fields = header[1:].split("\t")
for field in fields:
assert field in KNOWN_FIELDS, f"'{field}' is not one of {KNOWN_FIELDS}"
# Make sure tuple contains all fields
for field in KNOWN_FIELDS:
if field not in fields:
fields.append(field)
return collections.namedtuple("_Line"... | fields = header[1:].split("\t")
for field in fields:
assert field in KNOWN_FIELDS, f"'{field}' is not one of {KNOWN_FIELDS}"
# Make sure tuple contains all fields
for field in KNOWN_FIELDS:
if field not in fields:
fields.append(field)
return collections.namedtuple("_Line"... | 38 | 1,049 | 122 | 1,171 | """Build all composite mulled recipes discovered in TSV files.
Use mulled-build-channel to build images for single recipes for a whole conda
channel. This script instead builds images for combinations of recipes. This
script can be given a single TSV file or a directory of TSV files to process.
Examples:
Build all r... | """Build all composite mulled recipes discovered in TSV files.
Use mulled-build-channel to build images for single recipes for a whole conda
channel. This script instead builds images for combinations of recipes. This
script can be given a single TSV file or a directory of TSV files to process.
Examples:
Build all r... | |
46,048 | /home/hieuvd/dung_repo/raw/stars_03/galaxyproject_galaxy/galaxy | /home/hieuvd/dung_repo/raw/stars_03/galaxyproject_galaxy/galaxy/lib/galaxy/tool_util/deps/mulled/mulled_build_tool.py | 30,31 | 1,60 | main | 32,45 | 31,45 | #!/usr/bin/env python
"""Build a mulled images for a tool source (Galaxy or CWL tool).
Examples:
Build mulled images for requirements defined in a tool:
mulled-build-tool build path/to/tool_file.xml
"""
from typing import (
List,
TYPE_CHECKING,
)
from galaxy.tool_util.parser import get_tool_source
from... | #!/usr/bin/env python
"""Build a mulled images for a tool source (Galaxy or CWL tool).
Examples:
Build mulled images for requirements defined in a tool:
mulled-build-tool build path/to/tool_file.xml
"""
from typing import (
List,
TYPE_CHECKING,
)
from galaxy.tool_util.parser import get_tool_source
from... | parser = arg_parser(argv, globals())
add_build_arguments(parser)
add_single_image_arguments(parser)
parser.add_argument("command", metavar="COMMAND", help="Command (build-and-test, build, all)")
parser.add_argument("tool", metavar="TOOL", default=None, help="Path to tool to build mulled image for.")... | """Main entry-point for the CLI tool."""
parser = arg_parser(argv, globals())
add_build_arguments(parser)
add_single_image_arguments(parser)
parser.add_argument("command", metavar="COMMAND", help="Command (build-and-test, build, all)")
parser.add_argument("tool", metavar="TOOL", default=None, he... | 41 | 387 | 222 | 609 | #!/usr/bin/env python
"""Build a mulled images for a tool source (Galaxy or CWL tool).
Examples:
Build mulled images for requirements defined in a tool:
mulled-build-tool build path/to/tool_file.xml
"""
from typing import (
List,
TYPE_CHECKING,
)
from galaxy.tool_util.parser import get_tool_source
from... | #!/usr/bin/env python
"""Build a mulled images for a tool source (Galaxy or CWL tool).
Examples:
Build mulled images for requirements defined in a tool:
mulled-build-tool build path/to/tool_file.xml
"""
from typing import (
List,
TYPE_CHECKING,
)
from galaxy.tool_util.parser import get_tool_source
from... | |
46,049 | /home/hieuvd/dung_repo/raw/stars_03/galaxyproject_galaxy/galaxy | /home/hieuvd/dung_repo/raw/stars_03/galaxyproject_galaxy/galaxy/lib/galaxy/tool_util/deps/mulled/mulled_hash.py | 19,20 | 1,36 | main | 21,32 | 20,32 | #!/usr/bin/env python
"""Produce a mulled hash for specified conda targets.
Examples
Produce a mulled hash with:
mulled-hash samtools=1.3.1,bedtools=2.22
"""
from ._cli import arg_parser
from .mulled_build import target_str_to_targets
from .util import (
v1_image_name,
v2_image_name,
)
def main(argv=N... | #!/usr/bin/env python
"""Produce a mulled hash for specified conda targets.
Examples
Produce a mulled hash with:
mulled-hash samtools=1.3.1,bedtools=2.22
"""
from ._cli import arg_parser
from .mulled_build import target_str_to_targets
from .util import (
v1_image_name,
v2_image_name,
)
def main(argv=N... | parser = arg_parser(argv, globals())
parser.add_argument(
"targets", metavar="TARGETS", default=None, help="Comma-separated packages for calculating the mulled hash."
)
parser.add_argument("--hash", dest="hash", choices=["v1", "v2"], default="v2")
args = parser.parse_args()
targets = tar... | """Main entry-point for the CLI tool."""
parser = arg_parser(argv, globals())
parser.add_argument(
"targets", metavar="TARGETS", default=None, help="Comma-separated packages for calculating the mulled hash."
)
parser.add_argument("--hash", dest="hash", choices=["v1", "v2"], default="v2")
... | 37 | 176 | 174 | 350 | #!/usr/bin/env python
"""Produce a mulled hash for specified conda targets.
Examples
Produce a mulled hash with:
mulled-hash samtools=1.3.1,bedtools=2.22
"""
from ._cli import arg_parser
from .mulled_build import target_str_to_targets
from .util import (
v1_image_name,
v2_image_name,
)
def main(argv=N... | #!/usr/bin/env python
"""Produce a mulled hash for specified conda targets.
Examples
Produce a mulled hash with:
mulled-hash samtools=1.3.1,bedtools=2.22
"""
from ._cli import arg_parser
from .mulled_build import target_str_to_targets
from .util import (
v1_image_name,
v2_image_name,
)
def main(argv=N... | |
46,050 | /home/hieuvd/dung_repo/raw/stars_03/galaxyproject_galaxy/galaxy | /home/hieuvd/dung_repo/raw/stars_03/galaxyproject_galaxy/galaxy/lib/galaxy/tool_util/deps/mulled/mulled_list.py | 91,92 | 1,156 | main | 92,154 | 92,154 | #!/usr/bin/env python
import argparse
import logging
from glob import glob
from html.parser import HTMLParser
import requests
from .util import MULLED_SOCKET_TIMEOUT
QUAY_API_ENDPOINT = "https://quay.io/api/v1/repository"
def get_quay_containers(repository="biocontainers"):
"""
Get all quay containers in ... | #!/usr/bin/env python
import argparse
import logging
from glob import glob
from html.parser import HTMLParser
import requests
from .util import MULLED_SOCKET_TIMEOUT
QUAY_API_ENDPOINT = "https://quay.io/api/v1/repository"
def get_quay_containers(repository="biocontainers"):
"""
Get all quay containers in ... | parser = argparse.ArgumentParser(
description="Returns list of Docker containers in the quay.io biocontainers repository."
)
parser.add_argument("--source", "-s", help="Docker, Singularity or Conda.")
parser.add_argument(
"--not-singularity",
dest="not_singularity",
actio... | parser = argparse.ArgumentParser(
description="Returns list of Docker containers in the quay.io biocontainers repository."
)
parser.add_argument("--source", "-s", help="Docker, Singularity or Conda.")
parser.add_argument(
"--not-singularity",
dest="not_singularity",
actio... | 176 | 926 | 693 | 1,619 | #!/usr/bin/env python
import argparse
import logging
from glob import glob
from html.parser import HTMLParser
import requests
from .util import MULLED_SOCKET_TIMEOUT
QUAY_API_ENDPOINT = "https://quay.io/api/v1/repository"
def get_quay_containers(repository="biocontainers"):
"""
Get all quay containers in ... | #!/usr/bin/env python
import argparse
import logging
from glob import glob
from html.parser import HTMLParser
import requests
from .util import MULLED_SOCKET_TIMEOUT
QUAY_API_ENDPOINT = "https://quay.io/api/v1/repository"
def get_quay_containers(repository="biocontainers"):
"""
Get all quay containers in ... | |
46,051 | /home/hieuvd/dung_repo/raw/stars_03/galaxyproject_galaxy/galaxy | /home/hieuvd/dung_repo/raw/stars_03/galaxyproject_galaxy/galaxy/lib/galaxy/tool_util/deps/mulled/mulled_list.py | 47,48 | 42,55 | handle_starttag | GetContainerNames | 48,55 | 48,55 | class GetContainerNames(HTMLParser): # small parser which gets list of containers
def __init__(self):
HTMLParser.__init__(self)
self.containers = []
def handle_starttag(self, tag, attrs):
FILL_FUNC_BODY | class GetContainerNames(HTMLParser): # small parser which gets list of containers
def __init__(self):
HTMLParser.__init__(self)
self.containers = []
def handle_starttag(self, tag, attrs):
FILL_FUNC_BODY | try:
for attr in attrs:
if attr[0] == "href" and attr[1] != "../":
self.containers.append(attr[1].replace("%3A", ":"))
except IndexError:
pass
| try:
for attr in attrs:
if attr[0] == "href" and attr[1] != "../":
self.containers.append(attr[1].replace("%3A", ":"))
except IndexError:
pass
| 18 | 70 | 71 | 141 | #!/usr/bin/env python
import argparse
import logging
from glob import glob
from html.parser import HTMLParser
import requests
from .util import MULLED_SOCKET_TIMEOUT
QUAY_API_ENDPOINT = "https://quay.io/api/v1/repository"
def get_quay_containers(repository="biocontainers"):
"""
Get all quay containers in ... | #!/usr/bin/env python
import argparse
import logging
from glob import glob
from html.parser import HTMLParser
import requests
from .util import MULLED_SOCKET_TIMEOUT
QUAY_API_ENDPOINT = "https://quay.io/api/v1/repository"
def get_quay_containers(repository="biocontainers"):
"""
Get all quay containers in ... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.