index
int64
0
50.7k
project_path
stringclasses
279 values
completion_path
stringlengths
57
199
signature_postion
stringlengths
3
11
class_position
stringlengths
3
11
function_name
stringlengths
1
62
class_name
stringlengths
0
55
body_position
stringlengths
3
11
body_position_with_comments
stringlengths
3
11
masked_class
stringlengths
14
8.32k
masked_class_with_comment
stringlengths
14
8.32k
func_body
stringlengths
9
6.72k
func_body_with_comment
stringlengths
9
6.72k
len_func_body
int64
1
643
len_input
int64
10
2.02k
len_output
int64
4
1.9k
total
int64
20
2.05k
file_code
stringlengths
14
442k
file_code_with_comment
stringlengths
14
442k
46,505
/home/hieuvd/dung_repo/raw/stars_03/galaxyproject_galaxy/galaxy
/home/hieuvd/dung_repo/raw/stars_03/galaxyproject_galaxy/galaxy/lib/galaxy/webapps/reports/controllers/home.py
21,23
20,126
run_stats
HomePage
23,126
23,126
class HomePage(BaseUIController, ReportQueryBuilder): @web.expose def run_stats(self, trans, **kwd): FILL_FUNC_BODY
class HomePage(BaseUIController, ReportQueryBuilder): @web.expose def run_stats(self, trans, **kwd): FILL_FUNC_BODY
message = "" end_date = datetime.utcnow() end_date = datetime(end_date.year, end_date.month, end_date.day, end_date.hour) end_date_buffer = datetime(end_date.year, end_date.month, end_date.day, end_date.hour + 1) start_hours = end_date - timedelta(1) start_days = end_date...
message = "" end_date = datetime.utcnow() end_date = datetime(end_date.year, end_date.month, end_date.day, end_date.hour) end_date_buffer = datetime(end_date.year, end_date.month, end_date.day, end_date.hour + 1) start_hours = end_date - timedelta(1) start_days = end_date...
363
45
1,329
1,374
import calendar import logging from datetime import ( datetime, timedelta, ) import sqlalchemy as sa from galaxy import model from galaxy.webapps.base.controller import ( BaseUIController, web, ) from galaxy.webapps.reports.controllers.query import ReportQueryBuilder log = logging.getLogger(__name__)...
import calendar import logging from datetime import ( datetime, timedelta, ) import sqlalchemy as sa from galaxy import model from galaxy.webapps.base.controller import ( BaseUIController, web, ) from galaxy.webapps.reports.controllers.query import ReportQueryBuilder log = logging.getLogger(__name__)...
46,506
/home/hieuvd/dung_repo/raw/stars_03/galaxyproject_galaxy/galaxy
/home/hieuvd/dung_repo/raw/stars_03/galaxyproject_galaxy/galaxy/lib/galaxy/webapps/reports/controllers/root.py
12,14
11,15
index
Report
14,15
14,15
class Report(BaseUIController): @web.expose def index(self, trans, **kwd): FILL_FUNC_BODY
class Report(BaseUIController): @web.expose def index(self, trans, **kwd): FILL_FUNC_BODY
return trans.fill_template("/webapps/reports/index.mako")
return trans.fill_template("/webapps/reports/index.mako")
2
38
21
59
import logging from galaxy.webapps.base.controller import ( BaseUIController, web, ) log = logging.getLogger(__name__) class Report(BaseUIController): @web.expose def index(self, trans, **kwd): FILL_FUNC_BODY
import logging from galaxy.webapps.base.controller import ( BaseUIController, web, ) log = logging.getLogger(__name__) class Report(BaseUIController): @web.expose def index(self, trans, **kwd): FILL_FUNC_BODY
46,509
/home/hieuvd/dung_repo/raw/stars_03/galaxyproject_galaxy/galaxy
/home/hieuvd/dung_repo/raw/stars_03/galaxyproject_galaxy/galaxy/lib/galaxy/webapps/reports/fast_app.py
11,12
1,28
initialize_fast_app
12,28
12,28
from a2wsgi import WSGIMiddleware from fastapi import FastAPI from galaxy.webapps.base.api import ( add_exception_handler, add_request_id_middleware, include_all_package_routers, ) def initialize_fast_app(gx_webapp): FILL_FUNC_BODY
from a2wsgi import WSGIMiddleware from fastapi import FastAPI from galaxy.webapps.base.api import ( add_exception_handler, add_request_id_middleware, include_all_package_routers, ) def initialize_fast_app(gx_webapp): FILL_FUNC_BODY
app = FastAPI( title="Galaxy Reports API", description=( "This API will give you insights into the Galaxy instance's usage and load. " "It aims to provide data about users, jobs, workflows, disk space, and much more." ), docs_url="/api/docs", redoc_url...
app = FastAPI( title="Galaxy Reports API", description=( "This API will give you insights into the Galaxy instance's usage and load. " "It aims to provide data about users, jobs, workflows, disk space, and much more." ), docs_url="/api/docs", redoc_url...
55
92
234
326
from a2wsgi import WSGIMiddleware from fastapi import FastAPI from galaxy.webapps.base.api import ( add_exception_handler, add_request_id_middleware, include_all_package_routers, ) def initialize_fast_app(gx_webapp): FILL_FUNC_BODY
from a2wsgi import WSGIMiddleware from fastapi import FastAPI from galaxy.webapps.base.api import ( add_exception_handler, add_request_id_middleware, include_all_package_routers, ) def initialize_fast_app(gx_webapp): FILL_FUNC_BODY
46,510
/home/hieuvd/dung_repo/raw/stars_03/galaxyproject_galaxy/galaxy
/home/hieuvd/dung_repo/raw/stars_03/galaxyproject_galaxy/galaxy/lib/galaxy/webapps/reports/fast_factory.py
45,46
1,57
factory
46,57
46,57
"""Module containing factory class for building uvicorn app for the Galaxy Tool Shed. Information on uvicorn, its various settings, and how to invoke it can be found at https://www.uvicorn.org/. The Galaxy Tool Shed can be launched with uvicorn using the following invocation: :: uvicorn --app-dir lib --factory ...
"""Module containing factory class for building uvicorn app for the Galaxy Tool Shed. Information on uvicorn, its various settings, and how to invoke it can be found at https://www.uvicorn.org/. The Galaxy Tool Shed can be launched with uvicorn using the following invocation: :: uvicorn --app-dir lib --factory ...
props = WebappSetupProps( app_name="reports", default_section_name="reports", env_config_file="GALAXY_REPORTS_CONFIG", ) config_provider = WebappConfigResolver(props) config = config_provider.resolve_config() gx_webapp = app_factory( global_conf=config.global_conf, lo...
props = WebappSetupProps( app_name="reports", default_section_name="reports", env_config_file="GALAXY_REPORTS_CONFIG", ) config_provider = WebappConfigResolver(props) config = config_provider.resolve_config() gx_webapp = app_factory( global_conf=config.global_conf, lo...
22
425
164
589
"""Module containing factory class for building uvicorn app for the Galaxy Tool Shed. Information on uvicorn, its various settings, and how to invoke it can be found at https://www.uvicorn.org/. The Galaxy Tool Shed can be launched with uvicorn using the following invocation: :: uvicorn --app-dir lib --factory ...
"""Module containing factory class for building uvicorn app for the Galaxy Tool Shed. Information on uvicorn, its various settings, and how to invoke it can be found at https://www.uvicorn.org/. The Galaxy Tool Shed can be launched with uvicorn using the following invocation: :: uvicorn --app-dir lib --factory ...
46,511
/home/hieuvd/dung_repo/raw/stars_03/galaxyproject_galaxy/galaxy
/home/hieuvd/dung_repo/raw/stars_03/galaxyproject_galaxy/galaxy/lib/galaxy/webapps/util.py
35,36
1,78
wrap_if_allowed_or_fail
43,54
36,54
import logging import mako.exceptions from galaxy.util import unicodify log = logging.getLogger(__name__) class MiddlewareWrapUnsupported(Exception): pass def build_template_error_formatters(): """ Build a list of template error formatters for WebError. When an error occurs, WebError pass the exc...
import logging import mako.exceptions from galaxy.util import unicodify log = logging.getLogger(__name__) class MiddlewareWrapUnsupported(Exception): pass def build_template_error_formatters(): """ Build a list of template error formatters for WebError. When an error occurs, WebError pass the exc...
name = name or wrap.__name__ if not stack.allowed_middleware(wrap): raise MiddlewareWrapUnsupported( f"'{name}' is enabled in your configuration but the {stack.name} application stack does not support it, this middleware has been disabled" ) args = args or [] kwargs = kwargs ...
""" Wrap the application with the given method if the application stack allows for it. Arguments are the same as for :func:`wrap_if_allowed`. Raises py:class:`MiddlewareWrapUnsupported` if the stack does not allow the middleware. """ name = name or wrap.__name__ if not stack.allowed_middle...
49
749
128
877
import logging import mako.exceptions from galaxy.util import unicodify log = logging.getLogger(__name__) class MiddlewareWrapUnsupported(Exception): pass def build_template_error_formatters(): """ Build a list of template error formatters for WebError. When an error occurs, WebError pass the exc...
import logging import mako.exceptions from galaxy.util import unicodify log = logging.getLogger(__name__) class MiddlewareWrapUnsupported(Exception): pass def build_template_error_formatters(): """ Build a list of template error formatters for WebError. When an error occurs, WebError pass the exc...
46,512
/home/hieuvd/dung_repo/raw/stars_03/galaxyproject_galaxy/galaxy
/home/hieuvd/dung_repo/raw/stars_03/galaxyproject_galaxy/galaxy/lib/galaxy/work/context.py
172,175
1,189
proxy_work_context_for_history
181,189
175,189
import abc from typing import ( Any, Dict, List, Optional, Tuple, ) from typing_extensions import Literal from galaxy.managers.context import ProvidesHistoryContext from galaxy.model import ( GalaxySession, History, Role, ) from galaxy.model.base import transaction class WorkRequestC...
import abc from typing import ( Any, Dict, List, Optional, Tuple, ) from typing_extensions import Literal from galaxy.managers.context import ProvidesHistoryContext from galaxy.model import ( GalaxySession, History, Role, ) from galaxy.model.base import transaction class WorkRequestC...
return WorkRequestContext( app=trans.app, user=trans.user, history=history or trans.history, url_builder=trans.url_builder, workflow_building_mode=workflow_building_mode, galaxy_session=trans.galaxy_session, )
"""Create a WorkContext for supplied context with potentially different history. This provides semi-structured access to a transaction/work context with a supplied target history that is different from the user's current history (which also might change during the request). """ return WorkReque...
11
1,476
84
1,560
import abc from typing import ( Any, Dict, List, Optional, Tuple, ) from typing_extensions import Literal from galaxy.managers.context import ProvidesHistoryContext from galaxy.model import ( GalaxySession, History, Role, ) from galaxy.model.base import transaction class WorkRequestC...
import abc from typing import ( Any, Dict, List, Optional, Tuple, ) from typing_extensions import Literal from galaxy.managers.context import ProvidesHistoryContext from galaxy.model import ( GalaxySession, History, Role, ) from galaxy.model.base import transaction class WorkRequestC...
46,513
/home/hieuvd/dung_repo/raw/stars_03/galaxyproject_galaxy/galaxy
/home/hieuvd/dung_repo/raw/stars_03/galaxyproject_galaxy/galaxy/lib/galaxy/work/context.py
116,117
109,141
set_content_type
GalaxyAbstractResponse
120,122
117,122
class GalaxyAbstractResponse: """Abstract interface to provide access to some response utilities.""" @abc.abstractproperty def headers(self) -> dict: """The response headers.""" def set_content_type(self, content_type: str): FILL_FUNC_BODY def get_content_type(self): return self.hea...
class GalaxyAbstractResponse: """Abstract interface to provide access to some response utilities.""" @abc.abstractproperty def headers(self) -> dict: """The response headers.""" def set_content_type(self, content_type: str): """ Sets the Content-Type header """ FILL_FUN...
self.headers["content-type"] = content_type
""" Sets the Content-Type header """ self.headers["content-type"] = content_type
3
252
17
269
import abc from typing import ( Any, Dict, List, Optional, Tuple, ) from typing_extensions import Literal from galaxy.managers.context import ProvidesHistoryContext from galaxy.model import ( GalaxySession, History, Role, ) from galaxy.model.base import transaction class WorkRequestC...
import abc from typing import ( Any, Dict, List, Optional, Tuple, ) from typing_extensions import Literal from galaxy.managers.context import ProvidesHistoryContext from galaxy.model import ( GalaxySession, History, Role, ) from galaxy.model.base import transaction class WorkRequestC...
46,514
/home/hieuvd/dung_repo/raw/stars_03/galaxyproject_galaxy/galaxy
/home/hieuvd/dung_repo/raw/stars_03/galaxyproject_galaxy/galaxy/lib/galaxy/work/context.py
153,155
141,172
request
SessionRequestContext
155,157
155,157
class SessionRequestContext(WorkRequestContext): """Like WorkRequestContext, but provides access to request.""" def __init__(self, **kwargs): self.__request: GalaxyAbstractRequest = kwargs.pop("request") self.__response: GalaxyAbstractResponse = kwargs.pop("response") super().__init__(*...
class SessionRequestContext(WorkRequestContext): """Like WorkRequestContext, but provides access to request.""" def __init__(self, **kwargs): self.__request: GalaxyAbstractRequest = kwargs.pop("request") self.__response: GalaxyAbstractResponse = kwargs.pop("response") super().__init__(*...
return self.__request
return self.__request
2
259
9
268
import abc from typing import ( Any, Dict, List, Optional, Tuple, ) from typing_extensions import Literal from galaxy.managers.context import ProvidesHistoryContext from galaxy.model import ( GalaxySession, History, Role, ) from galaxy.model.base import transaction class WorkRequestC...
import abc from typing import ( Any, Dict, List, Optional, Tuple, ) from typing_extensions import Literal from galaxy.managers.context import ProvidesHistoryContext from galaxy.model import ( GalaxySession, History, Role, ) from galaxy.model.base import transaction class WorkRequestC...
46,515
/home/hieuvd/dung_repo/raw/stars_03/galaxyproject_galaxy/galaxy
/home/hieuvd/dung_repo/raw/stars_03/galaxyproject_galaxy/galaxy/lib/galaxy/work/context.py
55,56
21,89
get_cache_value
WorkRequestContext
56,58
56,58
class WorkRequestContext(ProvidesHistoryContext): """Stripped down implementation of Galaxy web transaction god object for work request handling outside of web threads - uses mix-ins shared with GalaxyWebTransaction to provide app, user, and history context convenience methods - but nothing related to H...
class WorkRequestContext(ProvidesHistoryContext): """Stripped down implementation of Galaxy web transaction god object for work request handling outside of web threads - uses mix-ins shared with GalaxyWebTransaction to provide app, user, and history context convenience methods - but nothing related to H...
return self._short_term_cache.get(args, default)
return self._short_term_cache.get(args, default)
3
616
20
636
import abc from typing import ( Any, Dict, List, Optional, Tuple, ) from typing_extensions import Literal from galaxy.managers.context import ProvidesHistoryContext from galaxy.model import ( GalaxySession, History, Role, ) from galaxy.model.base import transaction class WorkRequestC...
import abc from typing import ( Any, Dict, List, Optional, Tuple, ) from typing_extensions import Literal from galaxy.managers.context import ProvidesHistoryContext from galaxy.model import ( GalaxySession, History, Role, ) from galaxy.model.base import transaction class WorkRequestC...
46,518
/home/hieuvd/dung_repo/raw/stars_03/galaxyproject_galaxy/galaxy
/home/hieuvd/dung_repo/raw/stars_03/galaxyproject_galaxy/galaxy/lib/galaxy/workflow/refactor/schema.py
87,89
80,99
return_action
Action
89,99
89,99
class Action(BaseAction): action_type: str @classmethod def __get_validators__(cls): yield cls.return_action @classmethod def return_action(cls, values): FILL_FUNC_BODY
class Action(BaseAction): action_type: str @classmethod def __get_validators__(cls): yield cls.return_action @classmethod def return_action(cls, values): FILL_FUNC_BODY
try: action_type = values["action_type"] except KeyError: raise ValueError(f"Missing required 'action_type' field for refactoring action: {values}") try: return ACTION_CLASSES_BY_TYPE[action_type](**values) except KeyError: raise ValueError...
try: action_type = values["action_type"] except KeyError: raise ValueError(f"Missing required 'action_type' field for refactoring action: {values}") try: return ACTION_CLASSES_BY_TYPE[action_type](**values) except KeyError: raise ValueError...
25
67
112
179
from enum import Enum from typing import ( Any, Dict, List, Optional, Union, ) from pydantic import ( BaseModel, Field, ) from typing_extensions import ( Annotated, Literal, ) LABEL_DESCRIPTION = "The unique label of the step being referenced." INPUT_NAME_DESCRIPTION = "The input n...
from enum import Enum from typing import ( Any, Dict, List, Optional, Union, ) from pydantic import ( BaseModel, Field, ) from typing_extensions import ( Annotated, Literal, ) LABEL_DESCRIPTION = "The unique label of the step being referenced." INPUT_NAME_DESCRIPTION = "The input n...
46,519
/home/hieuvd/dung_repo/raw/stars_03/galaxyproject_galaxy/galaxy
/home/hieuvd/dung_repo/raw/stars_03/galaxyproject_galaxy/galaxy/lib/galaxy/workflow/refactor/schema.py
68,69
64,76
to_dict
Position
69,76
69,76
class Position(BaseModel): left: float top: float def to_dict(self): FILL_FUNC_BODY
class Position(BaseModel): left: float top: float def to_dict(self): FILL_FUNC_BODY
position = { "left": self.left, "top": self.top, } return position
position = { "left": self.left, "top": self.top, } return position
10
37
39
76
from enum import Enum from typing import ( Any, Dict, List, Optional, Union, ) from pydantic import ( BaseModel, Field, ) from typing_extensions import ( Annotated, Literal, ) LABEL_DESCRIPTION = "The unique label of the step being referenced." INPUT_NAME_DESCRIPTION = "The input n...
from enum import Enum from typing import ( Any, Dict, List, Optional, Union, ) from pydantic import ( BaseModel, Field, ) from typing_extensions import ( Annotated, Literal, ) LABEL_DESCRIPTION = "The unique label of the step being referenced." INPUT_NAME_DESCRIPTION = "The input n...
46,520
/home/hieuvd/dung_repo/raw/stars_03/galaxyproject_galaxy/galaxy
/home/hieuvd/dung_repo/raw/stars_03/galaxyproject_galaxy/galaxy/lib/galaxy/workflow/reports/generators/markdown.py
34,35
31,47
_generate_report_markdown
MarkdownWorkflowMarkdownReportGeneratorPlugin
35,47
35,47
class MarkdownWorkflowMarkdownReportGeneratorPlugin(WorkflowMarkdownGeneratorPlugin): plugin_type = "markdown" def _generate_report_markdown(self, trans, invocation, runtime_report_config_json=None): FILL_FUNC_BODY
class MarkdownWorkflowMarkdownReportGeneratorPlugin(WorkflowMarkdownGeneratorPlugin): plugin_type = "markdown" def _generate_report_markdown(self, trans, invocation, runtime_report_config_json=None): FILL_FUNC_BODY
reports_config = (invocation.workflow.reports_config or {}).copy() # TODO: more intelligent merge here. reports_config.update(runtime_report_config_json or {}) title = reports_config.get("title", f"Workflow Execution Summary of {invocation.workflow.stored_workflow.name}") markdow...
reports_config = (invocation.workflow.reports_config or {}).copy() # TODO: more intelligent merge here. reports_config.update(runtime_report_config_json or {}) title = reports_config.get("title", f"Workflow Execution Summary of {invocation.workflow.stored_workflow.name}") markdow...
38
68
167
235
"""The class defines the default stock Galaxy workflow reporting plugin """ import logging import string from . import WorkflowMarkdownGeneratorPlugin log = logging.getLogger(__name__) DEFAULT_MARKDOWN = """ # ${title} ## Workflow Inputs ```galaxy invocation_inputs() ``` ## Workflow Outputs ```galaxy invocation_o...
"""The class defines the default stock Galaxy workflow reporting plugin """ import logging import string from . import WorkflowMarkdownGeneratorPlugin log = logging.getLogger(__name__) DEFAULT_MARKDOWN = """ # ${title} ## Workflow Inputs ```galaxy invocation_inputs() ``` ## Workflow Outputs ```galaxy invocation_o...
46,521
/home/hieuvd/dung_repo/raw/stars_03/galaxyproject_galaxy/galaxy
/home/hieuvd/dung_repo/raw/stars_03/galaxyproject_galaxy/galaxy/lib/galaxy/workflow/resources/example.py.sample
5,6
1,23
admin_mapping
13,23
6,23
import logging log = logging.getLogger( __name__ ) def admin_mapping(trans, stored_workflow, **kwds): FILL_FUNC_BODY
import logging log = logging.getLogger( __name__ ) def admin_mapping(trans, stored_workflow, **kwds): """ This example workflow resource parameter mapping simply provides admins the ability to specify priorities for workflows. To enable this setup ``workflow_resource_params_file`` in the Galaxy config...
workflow_resource_params = kwds["workflow_resource_params"] if trans.user_is_admin: priority_attrib = workflow_resource_params.get("priority").attrib priority_attrib['data'] = [] for child in workflow_resource_params.get('priority').getchildren(): priority_attrib['data'].appe...
""" This example workflow resource parameter mapping simply provides admins the ability to specify priorities for workflows. To enable this setup ``workflow_resource_params_file`` in the Galaxy configuration with a priority definition input called "priority" (such as in the example), copy this file ...
24
155
145
300
import logging log = logging.getLogger( __name__ ) def admin_mapping(trans, stored_workflow, **kwds): FILL_FUNC_BODY
import logging log = logging.getLogger( __name__ ) def admin_mapping(trans, stored_workflow, **kwds): """ This example workflow resource parameter mapping simply provides admins the ability to specify priorities for workflows. To enable this setup ``workflow_resource_params_file`` in the Galaxy config...
46,522
/home/hieuvd/dung_repo/raw/stars_03/galaxyproject_galaxy/galaxy
/home/hieuvd/dung_repo/raw/stars_03/galaxyproject_galaxy/galaxy/lib/galaxy/workflow/schedulers/core.py
28,29
22,49
startup
CoreWorkflowSchedulingPlugin
29,31
29,31
class CoreWorkflowSchedulingPlugin(ActiveWorkflowSchedulingPlugin): plugin_type = "core" def __init__(self, **kwds): pass def startup(self, app): FILL_FUNC_BODY def shutdown(self): pass def schedule(self, workflow_invocation: "WorkflowInvocation") -> None: workflow = workfl...
class CoreWorkflowSchedulingPlugin(ActiveWorkflowSchedulingPlugin): plugin_type = "core" def __init__(self, **kwds): pass def startup(self, app): FILL_FUNC_BODY def shutdown(self): pass def schedule(self, workflow_invocation: "WorkflowInvocation") -> None: workflow = workfl...
self.app = app
self.app = app
3
245
10
255
""" The class defines the stock Galaxy workflow scheduling plugin - currently it simply schedules the whole workflow up front when offered. """ import logging from typing import TYPE_CHECKING from galaxy.work import context from galaxy.workflow import ( run, run_request, ) from . import ActiveWorkflowScheduli...
""" The class defines the stock Galaxy workflow scheduling plugin - currently it simply schedules the whole workflow up front when offered. """ import logging from typing import TYPE_CHECKING from galaxy.work import context from galaxy.workflow import ( run, run_request, ) from . import ActiveWorkflowScheduli...
46,523
/home/hieuvd/dung_repo/raw/stars_03/galaxyproject_galaxy/galaxy
/home/hieuvd/dung_repo/raw/stars_03/galaxyproject_galaxy/galaxy/lib/galaxy/workflow/scheduling_manager.py
329,330
278,373
__attempt_schedule
WorkflowRequestMonitor
330,360
330,360
class WorkflowRequestMonitor(Monitors): def __init__(self, app, workflow_scheduling_manager): self.app = app self.workflow_scheduling_manager = workflow_scheduling_manager self._init_monitor_thread( name="WorkflowRequestMonitor.monitor_thread", target=self.__monitor, config=app.c...
class WorkflowRequestMonitor(Monitors): def __init__(self, app, workflow_scheduling_manager): self.app = app self.workflow_scheduling_manager = workflow_scheduling_manager self._init_monitor_thread( name="WorkflowRequestMonitor.monitor_thread", target=self.__monitor, config=app.c...
with self.app.model.context() as session: workflow_invocation = session.get(model.WorkflowInvocation, invocation_id) try: if workflow_invocation.state == workflow_invocation.states.CANCELLING: workflow_invocation.cancel_invocation_steps() ...
with self.app.model.context() as session: workflow_invocation = session.get(model.WorkflowInvocation, invocation_id) try: if workflow_invocation.state == workflow_invocation.states.CANCELLING: workflow_invocation.cancel_invocation_steps() ...
101
817
347
1,164
import os from functools import partial import galaxy.workflow.schedulers from galaxy import model from galaxy.exceptions import HandlerAssignmentError from galaxy.jobs.handler import InvocationGrabber from galaxy.model.base import transaction from galaxy.util import plugin_config from galaxy.util.custom_logging impor...
import os from functools import partial import galaxy.workflow.schedulers from galaxy import model from galaxy.exceptions import HandlerAssignmentError from galaxy.jobs.handler import InvocationGrabber from galaxy.model.base import transaction from galaxy.util import plugin_config from galaxy.util.custom_logging impor...
46,525
/home/hieuvd/dung_repo/raw/stars_03/galaxyproject_galaxy/galaxy
/home/hieuvd/dung_repo/raw/stars_03/galaxyproject_galaxy/galaxy/lib/galaxy_ext/expressions/handle_job.py
28,29
1,57
run
29,57
29,57
""" Execute an external process to evaluate expressions for Galaxy jobs. Galaxy should be importable on sys.path . """ import json import logging import os import sys import warnings # insert *this* galaxy before all others on sys.path sys.path.insert(1, os.path.abspath(os.path.join(os.path.dirname(__file__), os.par...
""" Execute an external process to evaluate expressions for Galaxy jobs. Galaxy should be importable on sys.path . """ import json import logging import os import sys import warnings # insert *this* galaxy before all others on sys.path sys.path.insert(1, os.path.abspath(os.path.join(os.path.dirname(__file__), os.par...
if expression is None: raise Exception("Python library cwltool must be available to evaluate expressions.") if environment_path is None: environment_path = os.environ.get("GALAXY_EXPRESSION_INPUTS") with open(environment_path) as f: raw_inputs = json.load(f) outputs = raw_input...
if expression is None: raise Exception("Python library cwltool must be available to evaluate expressions.") if environment_path is None: environment_path = os.environ.get("GALAXY_EXPRESSION_INPUTS") with open(environment_path) as f: raw_inputs = json.load(f) outputs = raw_input...
105
220
331
551
""" Execute an external process to evaluate expressions for Galaxy jobs. Galaxy should be importable on sys.path . """ import json import logging import os import sys import warnings # insert *this* galaxy before all others on sys.path sys.path.insert(1, os.path.abspath(os.path.join(os.path.dirname(__file__), os.par...
""" Execute an external process to evaluate expressions for Galaxy jobs. Galaxy should be importable on sys.path . """ import json import logging import os import sys import warnings # insert *this* galaxy before all others on sys.path sys.path.insert(1, os.path.abspath(os.path.join(os.path.dirname(__file__), os.par...
46,526
/home/hieuvd/dung_repo/raw/stars_03/galaxyproject_galaxy/galaxy
/home/hieuvd/dung_repo/raw/stars_03/galaxyproject_galaxy/galaxy/lib/tool_shed/context.py
35,37
20,49
sa_session
ProvidesAppContext
41,43
37,43
class ProvidesAppContext(Protocol): """For transaction-like objects to provide the shed convenience layer for database and event handling. Mixed in class must provide `app` property. """ @abc.abstractproperty def app(self) -> ToolShedApp: """Provide access to the shed ``app`` object.""...
class ProvidesAppContext(Protocol): """For transaction-like objects to provide the shed convenience layer for database and event handling. Mixed in class must provide `app` property. """ @abc.abstractproperty def app(self) -> ToolShedApp: """Provide access to the shed ``app`` object.""...
return self.model.session
"""Provide access to Galaxy's SQLAlchemy session. :rtype: galaxy.model.scoped_session.galaxy_scoped_session """ return self.model.session
2
229
11
240
import abc from typing import Optional from sqlalchemy.orm import scoped_session from typing_extensions import Protocol from galaxy.security.idencoding import IdEncodingHelper from galaxy.work.context import ( GalaxyAbstractRequest, GalaxyAbstractResponse, ) from tool_shed.structured_app import ToolShedApp fr...
import abc from typing import Optional from sqlalchemy.orm import scoped_session from typing_extensions import Protocol from galaxy.security.idencoding import IdEncodingHelper from galaxy.work.context import ( GalaxyAbstractRequest, GalaxyAbstractResponse, ) from tool_shed.structured_app import ToolShedApp fr...
46,527
/home/hieuvd/dung_repo/raw/stars_03/galaxyproject_galaxy/galaxy
/home/hieuvd/dung_repo/raw/stars_03/galaxyproject_galaxy/galaxy/lib/tool_shed/context.py
69,71
49,76
user_is_bootstrap_admin
ProvidesUserContext
72,76
71,76
class ProvidesUserContext(ProvidesAppContext, Protocol): """For transaction-like objects to provide Galaxy convenience layer for reasoning about users. Mixed in class must provide `user` and `app` properties. """ @abc.abstractproperty def user(self) -> Optional[User]: """Provide ac...
class ProvidesUserContext(ProvidesAppContext, Protocol): """For transaction-like objects to provide Galaxy convenience layer for reasoning about users. Mixed in class must provide `user` and `app` properties. """ @abc.abstractproperty def user(self) -> Optional[User]: """Provide ac...
user = self.user return not self.anonymous and user is not None and user.bootstrap_admin_user
"""Master key provided so there is no real user""" user = self.user return not self.anonymous and user is not None and user.bootstrap_admin_user
13
199
34
233
import abc from typing import Optional from sqlalchemy.orm import scoped_session from typing_extensions import Protocol from galaxy.security.idencoding import IdEncodingHelper from galaxy.work.context import ( GalaxyAbstractRequest, GalaxyAbstractResponse, ) from tool_shed.structured_app import ToolShedApp fr...
import abc from typing import Optional from sqlalchemy.orm import scoped_session from typing_extensions import Protocol from galaxy.security.idencoding import IdEncodingHelper from galaxy.work.context import ( GalaxyAbstractRequest, GalaxyAbstractResponse, ) from tool_shed.structured_app import ToolShedApp fr...
46,528
/home/hieuvd/dung_repo/raw/stars_03/galaxyproject_galaxy/galaxy
/home/hieuvd/dung_repo/raw/stars_03/galaxyproject_galaxy/galaxy/lib/tool_shed/context.py
89,90
82,102
request
SessionRequestContext
90,91
90,91
class SessionRequestContext(ProvidesRepositoriesContext, Protocol): @abc.abstractmethod def get_galaxy_session(self) -> Optional[GalaxySession]: ... @abc.abstractmethod def set_galaxy_session(self, galaxy_session: GalaxySession): ... @abc.abstractproperty FILL_FUNC_BODY @abc.abstractproperty ...
class SessionRequestContext(ProvidesRepositoriesContext, Protocol): @abc.abstractmethod def get_galaxy_session(self) -> Optional[GalaxySession]: ... @abc.abstractmethod def set_galaxy_session(self, galaxy_session: GalaxySession): ... @abc.abstractproperty FILL_FUNC_BODY @abc.abstractproperty ...
def request(self) -> GalaxyAbstractRequest: ...
def request(self) -> GalaxyAbstractRequest: ...
5
164
15
179
import abc from typing import Optional from sqlalchemy.orm import scoped_session from typing_extensions import Protocol from galaxy.security.idencoding import IdEncodingHelper from galaxy.work.context import ( GalaxyAbstractRequest, GalaxyAbstractResponse, ) from tool_shed.structured_app import ToolShedApp fr...
import abc from typing import Optional from sqlalchemy.orm import scoped_session from typing_extensions import Protocol from galaxy.security.idencoding import IdEncodingHelper from galaxy.work.context import ( GalaxyAbstractRequest, GalaxyAbstractResponse, ) from tool_shed.structured_app import ToolShedApp fr...
46,529
/home/hieuvd/dung_repo/raw/stars_03/galaxyproject_galaxy/galaxy
/home/hieuvd/dung_repo/raw/stars_03/galaxyproject_galaxy/galaxy/lib/tool_shed/context.py
143,145
102,173
repositories_hostname
SessionRequestContextImpl
145,147
145,147
class SessionRequestContextImpl(SessionRequestContext): _app: ToolShedApp _user: Optional[User] _galaxy_session: Optional[GalaxySession] def __init__( self, app: ToolShedApp, request: GalaxyAbstractRequest, response: GalaxyAbstractResponse, user: Optional[User] =...
class SessionRequestContextImpl(SessionRequestContext): _app: ToolShedApp _user: Optional[User] _galaxy_session: Optional[GalaxySession] def __init__( self, app: ToolShedApp, request: GalaxyAbstractRequest, response: GalaxyAbstractResponse, user: Optional[User] =...
return str(self.request.base).rstrip("/")
return str(self.request.base).rstrip("/")
2
540
18
558
import abc from typing import Optional from sqlalchemy.orm import scoped_session from typing_extensions import Protocol from galaxy.security.idencoding import IdEncodingHelper from galaxy.work.context import ( GalaxyAbstractRequest, GalaxyAbstractResponse, ) from tool_shed.structured_app import ToolShedApp fr...
import abc from typing import Optional from sqlalchemy.orm import scoped_session from typing_extensions import Protocol from galaxy.security.idencoding import IdEncodingHelper from galaxy.work.context import ( GalaxyAbstractRequest, GalaxyAbstractResponse, ) from tool_shed.structured_app import ToolShedApp fr...
46,530
/home/hieuvd/dung_repo/raw/stars_03/galaxyproject_galaxy/galaxy
/home/hieuvd/dung_repo/raw/stars_03/galaxyproject_galaxy/galaxy/lib/tool_shed/grids/repository_grid_filter_manager.py
45,46
8,52
set_filter
RepositoryGridFilterManager
46,52
46,52
class RepositoryGridFilterManager: """Provides filtered views of the many Tool SHed repository grids.""" filters = Bunch( CERTIFIED_LEVEL_ONE="certified_level_one", CERTIFIED_LEVEL_TWO="certified_level_two", CERTIFIED_LEVEL_ONE_SUITES="certified_level_one_suites", CERTIFIED_LEVE...
class RepositoryGridFilterManager: """Provides filtered views of the many Tool SHed repository grids.""" filters = Bunch( CERTIFIED_LEVEL_ONE="certified_level_one", CERTIFIED_LEVEL_TWO="certified_level_two", CERTIFIED_LEVEL_ONE_SUITES="certified_level_one_suites", CERTIFIED_LEVE...
# Set a session cookie value with the selected filter. filter = kwd.get("filter", None) if filter is not None and self.is_valid_filter(filter): trans.set_cookie(value=filter, name="toolshedrepogridfilter") # if the filter is not valid, expire the cookie. trans.set_coo...
# Set a session cookie value with the selected filter. filter = kwd.get("filter", None) if filter is not None and self.is_valid_filter(filter): trans.set_cookie(value=filter, name="toolshedrepogridfilter") # if the filter is not valid, expire the cookie. trans.set_coo...
36
514
116
630
import logging from galaxy.util.bunch import Bunch log = logging.getLogger(__name__) class RepositoryGridFilterManager: """Provides filtered views of the many Tool SHed repository grids.""" filters = Bunch( CERTIFIED_LEVEL_ONE="certified_level_one", CERTIFIED_LEVEL_TWO="certified_level_two"...
import logging from galaxy.util.bunch import Bunch log = logging.getLogger(__name__) class RepositoryGridFilterManager: """Provides filtered views of the many Tool SHed repository grids.""" filters = Bunch( CERTIFIED_LEVEL_ONE="certified_level_one", CERTIFIED_LEVEL_TWO="certified_level_two"...
46,531
/home/hieuvd/dung_repo/raw/stars_03/galaxyproject_galaxy/galaxy
/home/hieuvd/dung_repo/raw/stars_03/galaxyproject_galaxy/galaxy/lib/tool_shed/grids/util.py
80,81
1,161
get_latest_downloadable_repository_metadata
86,111
81,111
import logging from galaxy.web.form_builder import SelectField from tool_shed.util import ( hg_util, metadata_util, ) log = logging.getLogger(__name__) def build_changeset_revision_select_field( trans, repository, selected_value=None, add_id_to_name=True, downloadable=False, ): """ ...
import logging from galaxy.web.form_builder import SelectField from tool_shed.util import ( hg_util, metadata_util, ) log = logging.getLogger(__name__) def build_changeset_revision_select_field( trans, repository, selected_value=None, add_id_to_name=True, downloadable=False, ): """ ...
encoded_repository_id = trans.security.encode_id(repository.id) repo = repository.hg_repo tip_ctx = str(repo[repo.changelog.tip()]) repository_metadata = None try: repository_metadata = metadata_util.get_repository_metadata_by_changeset_revision( trans.app, encoded_repository_id,...
""" Return the latest downloadable repository_metadata record for the received repository. This will return repositories of type unrestricted as well as types repository_suite_definition and tool_dependency_definition. """ encoded_repository_id = trans.security.encode_id(repository.id) repo...
65
1,572
310
1,882
import logging from galaxy.web.form_builder import SelectField from tool_shed.util import ( hg_util, metadata_util, ) log = logging.getLogger(__name__) def build_changeset_revision_select_field( trans, repository, selected_value=None, add_id_to_name=True, downloadable=False, ): """ ...
import logging from galaxy.web.form_builder import SelectField from tool_shed.util import ( hg_util, metadata_util, ) log = logging.getLogger(__name__) def build_changeset_revision_select_field( trans, repository, selected_value=None, add_id_to_name=True, downloadable=False, ): """ ...
46,532
/home/hieuvd/dung_repo/raw/stars_03/galaxyproject_galaxy/galaxy
/home/hieuvd/dung_repo/raw/stars_03/galaxyproject_galaxy/galaxy/lib/tool_shed/managers/categories.py
81,82
1,89
get_value_mapper
82,86
82,86
from typing import ( Any, Callable, Dict, List, ) from sqlalchemy import select import tool_shed.util.shed_util_common as suc from galaxy import ( exceptions, web, ) from galaxy.model.base import transaction from tool_shed.context import ProvidesUserContext from tool_shed.structured_app import...
from typing import ( Any, Callable, Dict, List, ) from sqlalchemy import select import tool_shed.util.shed_util_common as suc from galaxy import ( exceptions, web, ) from galaxy.model.base import transaction from tool_shed.context import ProvidesUserContext from tool_shed.structured_app import...
value_mapper = {"id": app.security.encode_id} return value_mapper
value_mapper = {"id": app.security.encode_id} return value_mapper
6
912
31
943
from typing import ( Any, Callable, Dict, List, ) from sqlalchemy import select import tool_shed.util.shed_util_common as suc from galaxy import ( exceptions, web, ) from galaxy.model.base import transaction from tool_shed.context import ProvidesUserContext from tool_shed.structured_app import...
from typing import ( Any, Callable, Dict, List, ) from sqlalchemy import select import tool_shed.util.shed_util_common as suc from galaxy import ( exceptions, web, ) from galaxy.model.base import transaction from tool_shed.context import ProvidesUserContext from tool_shed.structured_app import...
46,533
/home/hieuvd/dung_repo/raw/stars_03/galaxyproject_galaxy/galaxy
/home/hieuvd/dung_repo/raw/stars_03/galaxyproject_galaxy/galaxy/lib/tool_shed/managers/categories.py
32,33
25,81
create
CategoryManager
33,48
33,48
class CategoryManager: def __init__(self, app: ToolShedApp): self.app = app def get(self, encoded_category_id: str) -> Category: return suc.get_category(self.app, encoded_category_id) def create(self, trans: ProvidesUserContext, category_request: CreateCategoryRequest) -> Category: FILL_FU...
class CategoryManager: def __init__(self, app: ToolShedApp): self.app = app def get(self, encoded_category_id: str) -> Category: return suc.get_category(self.app, encoded_category_id) def create(self, trans: ProvidesUserContext, category_request: CreateCategoryRequest) -> Category: FILL_FU...
name = category_request.name description = category_request.description or name if name: if suc.get_category_by_name(self.app, name): raise exceptions.Conflict("A category with that name already exists.") else: # Create the category ...
name = category_request.name description = category_request.description or name if name: if suc.get_category_by_name(self.app, name): raise exceptions.Conflict("A category with that name already exists.") else: # Create the category ...
42
538
164
702
from typing import ( Any, Callable, Dict, List, ) from sqlalchemy import select import tool_shed.util.shed_util_common as suc from galaxy import ( exceptions, web, ) from galaxy.model.base import transaction from tool_shed.context import ProvidesUserContext from tool_shed.structured_app import...
from typing import ( Any, Callable, Dict, List, ) from sqlalchemy import select import tool_shed.util.shed_util_common as suc from galaxy import ( exceptions, web, ) from galaxy.model.base import transaction from tool_shed.context import ProvidesUserContext from tool_shed.structured_app import...
46,534
/home/hieuvd/dung_repo/raw/stars_03/galaxyproject_galaxy/galaxy
/home/hieuvd/dung_repo/raw/stars_03/galaxyproject_galaxy/galaxy/lib/tool_shed/managers/groups.py
139,140
1,142
get_group_by_name
140,142
140,142
""" Manager and Serializer for TS groups. """ import logging from sqlalchemy import ( false, select, true, ) from sqlalchemy.exc import ( MultipleResultsFound, NoResultFound, ) from galaxy.exceptions import ( Conflict, InconsistentDatabase, InternalServerError, ItemAccessibilityEx...
""" Manager and Serializer for TS groups. """ import logging from sqlalchemy import ( false, select, true, ) from sqlalchemy.exc import ( MultipleResultsFound, NoResultFound, ) from galaxy.exceptions import ( Conflict, InconsistentDatabase, InternalServerError, ItemAccessibilityEx...
stmt = select(group_model).where(group_model.name == name) return session.execute(stmt).scalar_one()
stmt = select(group_model).where(group_model.name == name) return session.execute(stmt).scalar_one()
7
1,155
37
1,192
""" Manager and Serializer for TS groups. """ import logging from sqlalchemy import ( false, select, true, ) from sqlalchemy.exc import ( MultipleResultsFound, NoResultFound, ) from galaxy.exceptions import ( Conflict, InconsistentDatabase, InternalServerError, ItemAccessibilityEx...
""" Manager and Serializer for TS groups. """ import logging from sqlalchemy import ( false, select, true, ) from sqlalchemy.exc import ( MultipleResultsFound, NoResultFound, ) from galaxy.exceptions import ( Conflict, InconsistentDatabase, InternalServerError, ItemAccessibilityEx...
46,535
/home/hieuvd/dung_repo/raw/stars_03/galaxyproject_galaxy/galaxy
/home/hieuvd/dung_repo/raw/stars_03/galaxyproject_galaxy/galaxy/lib/tool_shed/managers/groups.py
81,82
31,139
update
GroupManager
85,102
82,102
class GroupManager: """ Interface/service object for interacting with TS groups. """ def __init__(self, *args, **kwargs): super().__init__(*args, **kwargs) def get(self, trans, decoded_group_id=None, name=None): """ Get the group from the DB based on its ID or name. ...
class GroupManager: """ Interface/service object for interacting with TS groups. """ def __init__(self, *args, **kwargs): super().__init__(*args, **kwargs) def get(self, trans, decoded_group_id=None, name=None): """ Get the group from the DB based on its ID or name. ...
changed = False if not trans.user_is_admin: raise ItemAccessibilityException("Only administrators can update groups.") if group.deleted: raise RequestParameterInvalidException("You cannot modify a deleted group. Undelete it first.") if name is not None: ...
""" Update the given group """ changed = False if not trans.user_is_admin: raise ItemAccessibilityException("Only administrators can update groups.") if group.deleted: raise RequestParameterInvalidException("You cannot modify a deleted group. Undel...
54
853
161
1,014
""" Manager and Serializer for TS groups. """ import logging from sqlalchemy import ( false, select, true, ) from sqlalchemy.exc import ( MultipleResultsFound, NoResultFound, ) from galaxy.exceptions import ( Conflict, InconsistentDatabase, InternalServerError, ItemAccessibilityEx...
""" Manager and Serializer for TS groups. """ import logging from sqlalchemy import ( false, select, true, ) from sqlalchemy.exc import ( MultipleResultsFound, NoResultFound, ) from galaxy.exceptions import ( Conflict, InconsistentDatabase, InternalServerError, ItemAccessibilityEx...
46,536
/home/hieuvd/dung_repo/raw/stars_03/galaxyproject_galaxy/galaxy
/home/hieuvd/dung_repo/raw/stars_03/galaxyproject_galaxy/galaxy/lib/tool_shed/managers/tools.py
8,9
1,45
search
16,45
9,45
from collections import namedtuple from galaxy import exceptions from tool_shed.context import SessionRequestContext from tool_shed.webapp.search.tool_search import ToolSearch def search(trans: SessionRequestContext, q: str, page: int = 1, page_size: int = 10) -> dict: FILL_FUNC_BODY
from collections import namedtuple from galaxy import exceptions from tool_shed.context import SessionRequestContext from tool_shed.webapp.search.tool_search import ToolSearch def search(trans: SessionRequestContext, q: str, page: int = 1, page_size: int = 10) -> dict: """ Perform the search over TS tools in...
app = trans.app conf = app.config if not conf.toolshed_search_on: raise exceptions.ConfigDoesNotAllowException( "Searching the TS through the API is turned off for this instance." ) if not conf.whoosh_index_dir: raise exceptions.ConfigDoesNotAllowException( ...
""" Perform the search over TS tools index. Note that search works over the Whoosh index which you have to pre-create with scripts/tool_shed/build_ts_whoosh_index.sh manually. Also TS config option toolshed_search_on has to be True and whoosh_index_dir has to be specified. """ app = tran...
98
175
379
554
from collections import namedtuple from galaxy import exceptions from tool_shed.context import SessionRequestContext from tool_shed.webapp.search.tool_search import ToolSearch def search(trans: SessionRequestContext, q: str, page: int = 1, page_size: int = 10) -> dict: FILL_FUNC_BODY
from collections import namedtuple from galaxy import exceptions from tool_shed.context import SessionRequestContext from tool_shed.webapp.search.tool_search import ToolSearch def search(trans: SessionRequestContext, q: str, page: int = 1, page_size: int = 10) -> dict: """ Perform the search over TS tools in...
46,537
/home/hieuvd/dung_repo/raw/stars_03/galaxyproject_galaxy/galaxy
/home/hieuvd/dung_repo/raw/stars_03/galaxyproject_galaxy/galaxy/lib/tool_shed/managers/users.py
28,29
1,83
create_user
29,47
29,47
from typing import List from sqlalchemy import select from galaxy.exceptions import RequestParameterInvalidException from galaxy.model.base import transaction from galaxy.security.validate_user_input import ( validate_email, validate_password, validate_publicname, ) from tool_shed.context import ProvidesU...
from typing import List from sqlalchemy import select from galaxy.exceptions import RequestParameterInvalidException from galaxy.model.base import transaction from galaxy.security.validate_user_input import ( validate_email, validate_password, validate_publicname, ) from tool_shed.context import ProvidesU...
if username == "repos": raise RequestParameterInvalidException("Cannot create a tool shed user with the username repos") sa_session = app.model.context user = User(email=email) user.set_password_cleartext(password) user.username = username # API was doing this but mypy doesn't think user...
if username == "repos": raise RequestParameterInvalidException("Cannot create a tool shed user with the username repos") sa_session = app.model.context user = User(email=email) user.set_password_cleartext(password) user.username = username # API was doing this but mypy doesn't think user...
71
668
214
882
from typing import List from sqlalchemy import select from galaxy.exceptions import RequestParameterInvalidException from galaxy.model.base import transaction from galaxy.security.validate_user_input import ( validate_email, validate_password, validate_publicname, ) from tool_shed.context import ProvidesU...
from typing import List from sqlalchemy import select from galaxy.exceptions import RequestParameterInvalidException from galaxy.model.base import transaction from galaxy.security.validate_user_input import ( validate_email, validate_password, validate_publicname, ) from tool_shed.context import ProvidesU...
46,540
/home/hieuvd/dung_repo/raw/stars_03/galaxyproject_galaxy/galaxy
/home/hieuvd/dung_repo/raw/stars_03/galaxyproject_galaxy/galaxy/lib/tool_shed/repository_types/metadata.py
10,11
6,18
get_changesets_for_setting_metadata
Metadata
11,14
11,14
class Metadata: def __init__(self): self.type = None def get_changesets_for_setting_metadata(self, app, repository): FILL_FUNC_BODY def is_valid_for_type(self, repository, revisions_to_check=None): raise Exception("Unimplemented Method")
class Metadata: def __init__(self): self.type = None def get_changesets_for_setting_metadata(self, app, repository): FILL_FUNC_BODY def is_valid_for_type(self, repository, revisions_to_check=None): raise Exception("Unimplemented Method")
repo = repository.hg_repo return repo.changelog
repo = repository.hg_repo return repo.changelog
5
88
22
110
import logging log = logging.getLogger(__name__) class Metadata: def __init__(self): self.type = None def get_changesets_for_setting_metadata(self, app, repository): FILL_FUNC_BODY def is_valid_for_type(self, repository, revisions_to_check=None): raise Exception("Unimplemented Method") ...
import logging log = logging.getLogger(__name__) class Metadata: def __init__(self): self.type = None def get_changesets_for_setting_metadata(self, app, repository): FILL_FUNC_BODY def is_valid_for_type(self, repository, revisions_to_check=None): raise Exception("Unimplemented Method") ...
46,541
/home/hieuvd/dung_repo/raw/stars_03/galaxyproject_galaxy/galaxy
/home/hieuvd/dung_repo/raw/stars_03/galaxyproject_galaxy/galaxy/lib/tool_shed/repository_types/metadata.py
22,23
18,25
get_changesets_for_setting_metadata
TipOnly
23,25
23,25
class TipOnly(Metadata): def __init__(self): self.type = None def get_changesets_for_setting_metadata(self, app, repository): FILL_FUNC_BODY
class TipOnly(Metadata): def __init__(self): self.type = None def get_changesets_for_setting_metadata(self, app, repository): FILL_FUNC_BODY
repo = repository.hg_repo return [repo.changelog.tip()]
repo = repository.hg_repo return [repo.changelog.tip()]
5
53
25
78
import logging log = logging.getLogger(__name__) class Metadata: def __init__(self): self.type = None def get_changesets_for_setting_metadata(self, app, repository): repo = repository.hg_repo return repo.changelog def is_valid_for_type(self, repository, revisions_to_check=None):...
import logging log = logging.getLogger(__name__) class Metadata: def __init__(self): self.type = None def get_changesets_for_setting_metadata(self, app, repository): repo = repository.hg_repo return repo.changelog def is_valid_for_type(self, repository, revisions_to_check=None):...
46,542
/home/hieuvd/dung_repo/raw/stars_03/galaxyproject_galaxy/galaxy
/home/hieuvd/dung_repo/raw/stars_03/galaxyproject_galaxy/galaxy/lib/tool_shed/repository_types/registry.py
23,24
12,25
get_class_by_label
Registry
24,25
24,25
class Registry: def __init__(self): self.repository_types_by_label = {} self.repository_types_by_label["unrestricted"] = unrestricted.Unrestricted() self.repository_types_by_label["repository_suite_definition"] = ( repository_suite_definition.RepositorySuiteDefinition() )...
class Registry: def __init__(self): self.repository_types_by_label = {} self.repository_types_by_label["unrestricted"] = unrestricted.Unrestricted() self.repository_types_by_label["repository_suite_definition"] = ( repository_suite_definition.RepositorySuiteDefinition() )...
return self.repository_types_by_label.get(label, None)
return self.repository_types_by_label.get(label, None)
3
147
20
167
import logging from . import ( repository_suite_definition, tool_dependency_definition, unrestricted, ) log = logging.getLogger(__name__) class Registry: def __init__(self): self.repository_types_by_label = {} self.repository_types_by_label["unrestricted"] = unrestricted.Unrestricted...
import logging from . import ( repository_suite_definition, tool_dependency_definition, unrestricted, ) log = logging.getLogger(__name__) class Registry: def __init__(self): self.repository_types_by_label = {} self.repository_types_by_label["unrestricted"] = unrestricted.Unrestricted...
46,543
/home/hieuvd/dung_repo/raw/stars_03/galaxyproject_galaxy/galaxy
/home/hieuvd/dung_repo/raw/stars_03/galaxyproject_galaxy/galaxy/lib/tool_shed/repository_types/repository_suite_definition.py
17,18
11,38
is_valid_for_type
RepositorySuiteDefinition
23,38
18,38
class RepositorySuiteDefinition(TipOnly): def __init__(self): self.type = rt_util.REPOSITORY_SUITE_DEFINITION self.label = "Repository suite definition" self.valid_file_names = ["repository_dependencies.xml"] def is_valid_for_type(self, repository, revisions_to_check=None): FILL_FUNC_BO...
class RepositorySuiteDefinition(TipOnly): def __init__(self): self.type = rt_util.REPOSITORY_SUITE_DEFINITION self.label = "Repository suite definition" self.valid_file_names = ["repository_dependencies.xml"] def is_valid_for_type(self, repository, revisions_to_check=None): """ ...
repo = repository.hg_repo if revisions_to_check: changeset_revisions = revisions_to_check else: changeset_revisions = repo.changelog for changeset in changeset_revisions: ctx = repo[changeset] # Inspect all files in the changeset (in sorted...
""" Inspect the received repository's contents to determine if they abide by the rules defined for the contents of this type. If the received revisions_to_check is a list of changeset revisions, then inspection will be restricted to the revisions in the list. """ repo = ...
61
174
204
378
import logging import tool_shed.repository_types.util as rt_util from galaxy.util import unicodify from tool_shed.repository_types.metadata import TipOnly from tool_shed.util import basic_util log = logging.getLogger(__name__) class RepositorySuiteDefinition(TipOnly): def __init__(self): self.type = rt_...
import logging import tool_shed.repository_types.util as rt_util from galaxy.util import unicodify from tool_shed.repository_types.metadata import TipOnly from tool_shed.util import basic_util log = logging.getLogger(__name__) class RepositorySuiteDefinition(TipOnly): def __init__(self): self.type = rt_...
46,544
/home/hieuvd/dung_repo/raw/stars_03/galaxyproject_galaxy/galaxy
/home/hieuvd/dung_repo/raw/stars_03/galaxyproject_galaxy/galaxy/lib/tool_shed/repository_types/tool_dependency_definition.py
17,18
11,37
is_valid_for_type
ToolDependencyDefinition
23,37
18,37
class ToolDependencyDefinition(TipOnly): def __init__(self): self.type = rt_util.TOOL_DEPENDENCY_DEFINITION self.label = "Tool dependency definition" self.valid_file_names = ["tool_dependencies.xml"] def is_valid_for_type(self, repository, revisions_to_check=None): FILL_FUNC_BODY
class ToolDependencyDefinition(TipOnly): def __init__(self): self.type = rt_util.TOOL_DEPENDENCY_DEFINITION self.label = "Tool dependency definition" self.valid_file_names = ["tool_dependencies.xml"] def is_valid_for_type(self, repository, revisions_to_check=None): """ I...
repo = repository.hg_repo if revisions_to_check: changeset_revisions = revisions_to_check else: changeset_revisions = repo.changelog for changeset in changeset_revisions: ctx = repo[changeset] # Inspect all files in the changeset (in sorted...
""" Inspect the received repository's contents to determine if they abide by the rules defined for the contents of this type. If the received revisions_to_check is a list of changeset revisions, then inspection will be restricted to the revisions in the list. """ repo = r...
60
172
200
372
import logging import tool_shed.repository_types.util as rt_util from galaxy.util import unicodify from tool_shed.repository_types.metadata import TipOnly from tool_shed.util import basic_util log = logging.getLogger(__name__) class ToolDependencyDefinition(TipOnly): def __init__(self): self.type = rt_u...
import logging import tool_shed.repository_types.util as rt_util from galaxy.util import unicodify from tool_shed.repository_types.metadata import TipOnly from tool_shed.util import basic_util log = logging.getLogger(__name__) class ToolDependencyDefinition(TipOnly): def __init__(self): self.type = rt_u...
46,545
/home/hieuvd/dung_repo/raw/stars_03/galaxyproject_galaxy/galaxy
/home/hieuvd/dung_repo/raw/stars_03/galaxyproject_galaxy/galaxy/lib/tool_shed/repository_types/unrestricted.py
14,15
9,21
is_valid_for_type
Unrestricted
16,21
15,21
class Unrestricted(Metadata): def __init__(self): self.type = rt_util.UNRESTRICTED self.label = "Unrestricted" def is_valid_for_type(self, repository, revisions_to_check=None): FILL_FUNC_BODY
class Unrestricted(Metadata): def __init__(self): self.type = rt_util.UNRESTRICTED self.label = "Unrestricted" def is_valid_for_type(self, repository, revisions_to_check=None): """A repository's type can only be changed to the unrestricted type if it is new or has never been installed."...
if repository.is_new(): return True if repository.times_downloaded == 0: return True return False
"""A repository's type can only be changed to the unrestricted type if it is new or has never been installed.""" if repository.is_new(): return True if repository.times_downloaded == 0: return True return False
12
104
38
142
import logging import tool_shed.repository_types.util as rt_util from tool_shed.repository_types.metadata import Metadata log = logging.getLogger(__name__) class Unrestricted(Metadata): def __init__(self): self.type = rt_util.UNRESTRICTED self.label = "Unrestricted" def is_valid_for_type(se...
import logging import tool_shed.repository_types.util as rt_util from tool_shed.repository_types.metadata import Metadata log = logging.getLogger(__name__) class Unrestricted(Metadata): def __init__(self): self.type = rt_util.UNRESTRICTED self.label = "Unrestricted" def is_valid_for_type(se...
46,546
/home/hieuvd/dung_repo/raw/stars_03/galaxyproject_galaxy/galaxy
/home/hieuvd/dung_repo/raw/stars_03/galaxyproject_galaxy/galaxy/lib/tool_shed/repository_types/util.py
16,17
1,72
build_repository_type_select_field
18,40
17,40
import logging from galaxy.tool_shed.repository_type import ( REPOSITORY_DEPENDENCY_DEFINITION_FILENAME, REPOSITORY_SUITE_DEFINITION, TOOL_DEPENDENCY_DEFINITION, TOOL_DEPENDENCY_DEFINITION_FILENAME, types, UNRESTRICTED, ) from galaxy.web.form_builder import SelectField log = logging.getLogger(...
import logging from galaxy.tool_shed.repository_type import ( REPOSITORY_DEPENDENCY_DEFINITION_FILENAME, REPOSITORY_SUITE_DEFINITION, TOOL_DEPENDENCY_DEFINITION, TOOL_DEPENDENCY_DEFINITION_FILENAME, types, UNRESTRICTED, ) from galaxy.web.form_builder import SelectField log = logging.getLogger(...
if repository: selected_type = str(repository.type) else: selected_type = None repository_type_select_field = SelectField(name=name) for type_class in trans.app.repository_types_registry.repository_types_by_label.values(): option_label = str(type_class.label) option_value...
"""Called from the Tool Shed to generate the current list of supported repository types.""" if repository: selected_type = str(repository.type) else: selected_type = None repository_type_select_field = SelectField(name=name) for type_class in trans.app.repository_types_registry.repos...
55
691
279
970
import logging from galaxy.tool_shed.repository_type import ( REPOSITORY_DEPENDENCY_DEFINITION_FILENAME, REPOSITORY_SUITE_DEFINITION, TOOL_DEPENDENCY_DEFINITION, TOOL_DEPENDENCY_DEFINITION_FILENAME, types, UNRESTRICTED, ) from galaxy.web.form_builder import SelectField log = logging.getLogger(...
import logging from galaxy.tool_shed.repository_type import ( REPOSITORY_DEPENDENCY_DEFINITION_FILENAME, REPOSITORY_SUITE_DEFINITION, TOOL_DEPENDENCY_DEFINITION, TOOL_DEPENDENCY_DEFINITION_FILENAME, types, UNRESTRICTED, ) from galaxy.web.form_builder import SelectField log = logging.getLogger(...
46,548
/home/hieuvd/dung_repo/raw/stars_03/galaxyproject_galaxy/galaxy
/home/hieuvd/dung_repo/raw/stars_03/galaxyproject_galaxy/galaxy/lib/tool_shed/tools/tool_version_manager.py
16,17
12,51
get_version_lineage_for_tool
ToolVersionManager
22,51
17,51
class ToolVersionManager: def __init__(self, app): self.app = app def get_version_lineage_for_tool(self, repository_id, repository_metadata, guid): FILL_FUNC_BODY
class ToolVersionManager: def __init__(self, app): self.app = app def get_version_lineage_for_tool(self, repository_id, repository_metadata, guid): """ Return the tool version lineage chain in descendant order for the received guid contained in the received repsitory_metadata.to...
repository = repository_util.get_repository_by_id(self.app, repository_id) repo = repository.hg_repo # Initialize the tool lineage version_lineage = [guid] # Get all ancestor guids of the received guid. current_child_guid = guid for changeset in hg_util.reversed_u...
""" Return the tool version lineage chain in descendant order for the received guid contained in the received repsitory_metadata.tool_versions. This function is called only from the Tool Shed. """ repository = repository_util.get_repository_by_id(self.app, repository_id)...
102
113
452
565
import logging from tool_shed.util import ( hg_util, metadata_util, repository_util, ) log = logging.getLogger(__name__) class ToolVersionManager: def __init__(self, app): self.app = app def get_version_lineage_for_tool(self, repository_id, repository_metadata, guid): FILL_FUNC_BODY
import logging from tool_shed.util import ( hg_util, metadata_util, repository_util, ) log = logging.getLogger(__name__) class ToolVersionManager: def __init__(self, app): self.app = app def get_version_lineage_for_tool(self, repository_id, repository_metadata, guid): """ ...
46,550
/home/hieuvd/dung_repo/raw/stars_03/galaxyproject_galaxy/galaxy
/home/hieuvd/dung_repo/raw/stars_03/galaxyproject_galaxy/galaxy/lib/tool_shed/util/common_util.py
39,42
1,66
generate_clone_url_for_repository_in_tool_shed
43,47
42,47
from typing import ( Optional, TYPE_CHECKING, ) from routes import url_for from galaxy.util.tool_shed.common_util import ( accumulate_tool_dependencies, check_tool_tag_set, generate_clone_url_for_installed_repository, generate_clone_url_from_repo_info_tup, get_protocol_from_tool_shed_url, ...
from typing import ( Optional, TYPE_CHECKING, ) from routes import url_for from galaxy.util.tool_shed.common_util import ( accumulate_tool_dependencies, check_tool_tag_set, generate_clone_url_for_installed_repository, generate_clone_url_from_repo_info_tup, get_protocol_from_tool_shed_url, ...
base_url = hostname or url_for("/", qualified=True).rstrip("/") return f"{base_url}/repos/{repository.user.username}/{repository.name}"
"""Generate the URL for cloning a repository that is in the tool shed.""" base_url = hostname or url_for("/", qualified=True).rstrip("/") return f"{base_url}/repos/{repository.user.username}/{repository.name}"
8
726
52
778
from typing import ( Optional, TYPE_CHECKING, ) from routes import url_for from galaxy.util.tool_shed.common_util import ( accumulate_tool_dependencies, check_tool_tag_set, generate_clone_url_for_installed_repository, generate_clone_url_from_repo_info_tup, get_protocol_from_tool_shed_url, ...
from typing import ( Optional, TYPE_CHECKING, ) from routes import url_for from galaxy.util.tool_shed.common_util import ( accumulate_tool_dependencies, check_tool_tag_set, generate_clone_url_for_installed_repository, generate_clone_url_from_repo_info_tup, get_protocol_from_tool_shed_url, ...
46,551
/home/hieuvd/dung_repo/raw/stars_03/galaxyproject_galaxy/galaxy
/home/hieuvd/dung_repo/raw/stars_03/galaxyproject_galaxy/galaxy/lib/tool_shed/util/hgweb_config.py
74,76
18,108
hgweb_config
HgWebConfigManager
76,88
76,88
class HgWebConfigManager: def __init__(self): self.hgweb_config_dir = None self.in_memory_config = None def add_entry(self, lhs, rhs): """Add an entry in the hgweb.config file for a new repository.""" lock = threading.Lock() lock.acquire(True) try: # ...
class HgWebConfigManager: def __init__(self): self.hgweb_config_dir = None self.in_memory_config = None def add_entry(self, lhs, rhs): """Add an entry in the hgweb.config file for a new repository.""" lock = threading.Lock() lock.acquire(True) try: # ...
hgweb_config = os.path.join(self.hgweb_config_dir, "hgweb.config") if not os.path.exists(hgweb_config): # We used to raise an exception here... # raise Exception( "Required file %s does not exist - check config setting for hgweb_config_dir." % hgweb_config ) # ...but ...
hgweb_config = os.path.join(self.hgweb_config_dir, "hgweb.config") if not os.path.exists(hgweb_config): # We used to raise an exception here... # raise Exception( "Required file %s does not exist - check config setting for hgweb_config_dir." % hgweb_config ) # ...but ...
76
1,012
234
1,246
import configparser import logging import os import shutil import threading from datetime import date from galaxy.util import unicodify log = logging.getLogger(__name__) new_hgweb_config_template = """ [paths] """ class HgWebConfigManager: def __init__(self): self.hgweb_config_dir = None self....
import configparser import logging import os import shutil import threading from datetime import date from galaxy.util import unicodify log = logging.getLogger(__name__) new_hgweb_config_template = """ [paths] """ class HgWebConfigManager: def __init__(self): self.hgweb_config_dir = None self....
46,553
/home/hieuvd/dung_repo/raw/stars_03/galaxyproject_galaxy/galaxy
/home/hieuvd/dung_repo/raw/stars_03/galaxyproject_galaxy/galaxy/lib/tool_shed/util/readme_util.py
26,27
1,127
build_readme_files_dict
32,102
27,102
import json import logging import os from mako.template import Template from galaxy import web from galaxy.tool_shed.util import basic_util from galaxy.tool_shed.util.hg_util import ( get_changectx_for_changeset, get_file_context_from_ctx, ) from galaxy.tool_shed.util.repository_util import get_repo_info_tupl...
import json import logging import os from mako.template import Template from galaxy import web from galaxy.tool_shed.util import basic_util from galaxy.tool_shed.util.hg_util import ( get_changectx_for_changeset, get_file_context_from_ctx, ) from galaxy.tool_shed.util.repository_util import get_repo_info_tupl...
if app.name == "galaxy": can_use_disk_files = True else: latest_downloadable_changeset_revision = get_latest_downloadable_changeset_revision(app, repository) can_use_disk_files = changeset_revision == latest_downloadable_changeset_revision readme_files_dict = {} if metadata: ...
""" Return a dictionary of valid readme file name <-> readme file content pairs for all readme files defined in the received metadata. Since the received changeset_revision (which is associated with the received metadata) may not be the latest installable changeset revision, the README file contents ma...
220
705
1,013
1,718
import json import logging import os from mako.template import Template from galaxy import web from galaxy.tool_shed.util import basic_util from galaxy.tool_shed.util.hg_util import ( get_changectx_for_changeset, get_file_context_from_ctx, ) from galaxy.tool_shed.util.repository_util import get_repo_info_tupl...
import json import logging import os from mako.template import Template from galaxy import web from galaxy.tool_shed.util import basic_util from galaxy.tool_shed.util.hg_util import ( get_changectx_for_changeset, get_file_context_from_ctx, ) from galaxy.tool_shed.util.repository_util import get_repo_info_tupl...
46,554
/home/hieuvd/dung_repo/raw/stars_03/galaxyproject_galaxy/galaxy
/home/hieuvd/dung_repo/raw/stars_03/galaxyproject_galaxy/galaxy/lib/tool_shed/util/repository_content_util.py
43,56
1,127
upload_tar
56,127
56,127
import os import shutil import tarfile import tempfile from typing import ( Optional, TYPE_CHECKING, ) import tool_shed.repository_types.util as rt_util from galaxy.tool_shed.util.hg_util import clone_repository from galaxy.util import checkers from tool_shed.dependencies.attribute_handlers import ( Reposi...
import os import shutil import tarfile import tempfile from typing import ( Optional, TYPE_CHECKING, ) import tool_shed.repository_types.util as rt_util from galaxy.tool_shed.util.hg_util import clone_repository from galaxy.util import checkers from tool_shed.dependencies.attribute_handlers import ( Reposi...
host = trans.repositories_hostname app = trans.app if tar is None: tar = tar_open(uploaded_file) rdah = rdah or RepositoryDependencyAttributeHandler(trans, unpopulate=False) tdah = tdah or ToolDependencyAttributeHandler(trans, unpopulate=False) # Upload a tar archive of files. undesi...
host = trans.repositories_hostname app = trans.app if tar is None: tar = tar_open(uploaded_file) rdah = rdah or RepositoryDependencyAttributeHandler(trans, unpopulate=False) tdah = tdah or ToolDependencyAttributeHandler(trans, unpopulate=False) # Upload a tar archive of files. undesi...
240
482
1,018
1,500
import os import shutil import tarfile import tempfile from typing import ( Optional, TYPE_CHECKING, ) import tool_shed.repository_types.util as rt_util from galaxy.tool_shed.util.hg_util import clone_repository from galaxy.util import checkers from tool_shed.dependencies.attribute_handlers import ( Reposi...
import os import shutil import tarfile import tempfile from typing import ( Optional, TYPE_CHECKING, ) import tool_shed.repository_types.util as rt_util from galaxy.tool_shed.util.hg_util import clone_repository from galaxy.util import checkers from tool_shed.dependencies.attribute_handlers import ( Reposi...
46,557
/home/hieuvd/dung_repo/raw/stars_03/galaxyproject_galaxy/galaxy
/home/hieuvd/dung_repo/raw/stars_03/galaxyproject_galaxy/galaxy/lib/tool_shed/util/tool_util.py
14,15
1,48
new_state
16,42
15,42
import logging import galaxy.tools from galaxy.tool_shed.util.tool_util import ( copy_sample_file, copy_sample_files, generate_message_for_invalid_tools, ) from galaxy.util.expressions import ExpressionContext log = logging.getLogger(__name__) def new_state(trans, tool, invalid=False): FILL_FUNC_BODY__a...
import logging import galaxy.tools from galaxy.tool_shed.util.tool_util import ( copy_sample_file, copy_sample_files, generate_message_for_invalid_tools, ) from galaxy.util.expressions import ExpressionContext log = logging.getLogger(__name__) def new_state(trans, tool, invalid=False): """Create a n...
state = galaxy.tools.DefaultToolState() state.inputs = {} if invalid: # We're attempting to display a tool in the tool shed that has been determined to have errors, so is invalid. return state try: # Attempt to generate the tool state using the standard Galaxy-side code r...
"""Create a new `DefaultToolState` for the received tool. Only inputs on the first page will be initialized.""" state = galaxy.tools.DefaultToolState() state.inputs = {} if invalid: # We're attempting to display a tool in the tool shed that has been determined to have errors, so is invalid. ...
116
177
288
465
import logging import galaxy.tools from galaxy.tool_shed.util.tool_util import ( copy_sample_file, copy_sample_files, generate_message_for_invalid_tools, ) from galaxy.util.expressions import ExpressionContext log = logging.getLogger(__name__) def new_state(trans, tool, invalid=False): FILL_FUNC_BODY__a...
import logging import galaxy.tools from galaxy.tool_shed.util.tool_util import ( copy_sample_file, copy_sample_files, generate_message_for_invalid_tools, ) from galaxy.util.expressions import ExpressionContext log = logging.getLogger(__name__) def new_state(trans, tool, invalid=False): """Create a n...
46,558
/home/hieuvd/dung_repo/raw/stars_03/galaxyproject_galaxy/galaxy
/home/hieuvd/dung_repo/raw/stars_03/galaxyproject_galaxy/galaxy/lib/tool_shed/util/web_util.py
7,8
1,21
escape
16,21
8,21
from markupsafe import escape as raw_escape ALLOWED_ELEMENTS = ["<b>", "</b>", "<br/>"] ALLOWED_MAP = {x: raw_escape(x) for x in ALLOWED_ELEMENTS} def escape(string): FILL_FUNC_BODY
from markupsafe import escape as raw_escape ALLOWED_ELEMENTS = ["<b>", "</b>", "<br/>"] ALLOWED_MAP = {x: raw_escape(x) for x in ALLOWED_ELEMENTS} def escape(string): """A tool shed variant of markupsafe.escape that allows a select few HTML elements that are repeatedly used in messages created deep in th...
escaped = str(raw_escape(string)) # Unescape few selected tags. for key, value in ALLOWED_MAP.items(): escaped = escaped.replace(value, key) return escaped
"""A tool shed variant of markupsafe.escape that allows a select few HTML elements that are repeatedly used in messages created deep in the toolshed components. Ideally abstract things would be produced in these components and messages in the views or client side - this is what should be worked towa...
19
228
57
285
from markupsafe import escape as raw_escape ALLOWED_ELEMENTS = ["<b>", "</b>", "<br/>"] ALLOWED_MAP = {x: raw_escape(x) for x in ALLOWED_ELEMENTS} def escape(string): FILL_FUNC_BODY
from markupsafe import escape as raw_escape ALLOWED_ELEMENTS = ["<b>", "</b>", "<br/>"] ALLOWED_MAP = {x: raw_escape(x) for x in ALLOWED_ELEMENTS} def escape(string): """A tool shed variant of markupsafe.escape that allows a select few HTML elements that are repeatedly used in messages created deep in th...
46,559
/home/hieuvd/dung_repo/raw/stars_03/galaxyproject_galaxy/galaxy
/home/hieuvd/dung_repo/raw/stars_03/galaxyproject_galaxy/galaxy/lib/tool_shed/webapp/api/configuration.py
15,17
14,26
version
ConfigurationController
25,26
17,26
class ConfigurationController(BaseShedAPIController): @expose_api_anonymous_and_sessionless def version(self, trans, **kwds): FILL_FUNC_BODY
class ConfigurationController(BaseShedAPIController): @expose_api_anonymous_and_sessionless def version(self, trans, **kwds): """ GET /api/version Return a description of the version_major and version of Galaxy Tool Shed (e.g. 15.07 and 15.07.dev). :rtype: dict ...
return {"version_major": self.app.config.version_major, "version": self.app.config.version}
""" GET /api/version Return a description of the version_major and version of Galaxy Tool Shed (e.g. 15.07 and 15.07.dev). :rtype: dict :returns: dictionary with versions keyed as 'version_major' and 'version' """ return {"version_major": self.app.c...
5
132
30
162
""" API operations allowing clients to determine Tool Shed instance's capabilities and configuration settings. """ import logging from galaxy.web import expose_api_anonymous_and_sessionless from . import BaseShedAPIController log = logging.getLogger(__name__) class ConfigurationController(BaseShedAPIController): ...
""" API operations allowing clients to determine Tool Shed instance's capabilities and configuration settings. """ import logging from galaxy.web import expose_api_anonymous_and_sessionless from . import BaseShedAPIController log = logging.getLogger(__name__) class ConfigurationController(BaseShedAPIController): ...
46,560
/home/hieuvd/dung_repo/raw/stars_03/galaxyproject_galaxy/galaxy
/home/hieuvd/dung_repo/raw/stars_03/galaxyproject_galaxy/galaxy/lib/tool_shed/webapp/api/tools.py
23,26
20,92
build_search_index
ToolsController
32,43
26,43
class ToolsController(BaseShedAPIController): """RESTful controller for interactions with tools in the Tool Shed.""" @expose_api @require_admin def build_search_index(self, trans, **kwd): FILL_FUNC_BODY @expose_api_raw_anonymous_and_sessionless def index(self, trans, **kwd): """ ...
class ToolsController(BaseShedAPIController): """RESTful controller for interactions with tools in the Tool Shed.""" @expose_api @require_admin def build_search_index(self, trans, **kwd): """ PUT /api/tools/build_search_index Not part of the stable API, just something to simpli...
repos_indexed, tools_indexed = build_index( trans.app.config.whoosh_index_dir, trans.app.config.file_path, trans.app.config.hgweb_config_dir, trans.app.config.database_connection, ) return { "repositories_indexed": repos_indexed, ...
""" PUT /api/tools/build_search_index Not part of the stable API, just something to simplify bootstrapping tool sheds, scripting, testing, etc... """ repos_indexed, tools_indexed = build_index( trans.app.config.whoosh_index_dir, trans.app.config.f...
16
647
123
770
import json import logging from galaxy import ( exceptions, util, ) from galaxy.web import ( expose_api, expose_api_raw_anonymous_and_sessionless, require_admin, ) from tool_shed.managers.tools import search from tool_shed.util.shed_index import build_index from . import BaseShedAPIController log ...
import json import logging from galaxy import ( exceptions, util, ) from galaxy.web import ( expose_api, expose_api_raw_anonymous_and_sessionless, require_admin, ) from tool_shed.managers.tools import search from tool_shed.util.shed_index import build_index from . import BaseShedAPIController log ...
46,561
/home/hieuvd/dung_repo/raw/stars_03/galaxyproject_galaxy/galaxy
/home/hieuvd/dung_repo/raw/stars_03/galaxyproject_galaxy/galaxy/lib/tool_shed/webapp/api/users.py
21,24
18,88
create
UsersController
35,51
24,51
class UsersController(BaseShedAPIController): """RESTful controller for interactions with users in the Tool Shed.""" @web.expose_api @web.require_admin def create(self, trans, payload, **kwd): FILL_FUNC_BODY def __get_value_mapper(self, trans): value_mapper = {"id": trans.security.encode_id}...
class UsersController(BaseShedAPIController): """RESTful controller for interactions with users in the Tool Shed.""" @web.expose_api @web.require_admin def create(self, trans, payload, **kwd): """ POST /api/users Returns a dictionary of information about the crea...
# Get the information about the user to be created from the payload. email = payload.get("email", "") password = payload.get("password", "") username = payload.get("username", "") # Create the user. request = CreateUserRequest( email=email, usernam...
""" POST /api/users Returns a dictionary of information about the created user. : param key: the current Galaxy admin user's API key The following parameters are included in the payload. :param email (required): the email address of...
57
631
199
830
import logging import tool_shed.util.shed_util_common as suc from galaxy import ( util, web, ) from tool_shed.managers.users import ( api_create_user, index, ) from tool_shed_client.schema import CreateUserRequest from . import BaseShedAPIController log = logging.getLogger(__name__) class UsersContr...
import logging import tool_shed.util.shed_util_common as suc from galaxy import ( util, web, ) from tool_shed.managers.users import ( api_create_user, index, ) from tool_shed_client.schema import CreateUserRequest from . import BaseShedAPIController log = logging.getLogger(__name__) class UsersContr...
46,563
/home/hieuvd/dung_repo/raw/stars_03/galaxyproject_galaxy/galaxy
/home/hieuvd/dung_repo/raw/stars_03/galaxyproject_galaxy/galaxy/lib/tool_shed/webapp/controllers/groups.py
10,12
9,17
index
Group
12,17
12,17
class Group(BaseUIController): @web.expose def index(self, trans, **kwd): FILL_FUNC_BODY
class Group(BaseUIController): @web.expose def index(self, trans, **kwd): FILL_FUNC_BODY
# define app configuration for generic mako template app = {"jscript": "../toolshed/scripts/toolshed.groups"} return trans.fill_template( "/webapps/tool_shed/group/index.mako", config={"title": "Tool Shed Groups", "app": app} )
# define app configuration for generic mako template app = {"jscript": "../toolshed/scripts/toolshed.groups"} return trans.fill_template( "/webapps/tool_shed/group/index.mako", config={"title": "Tool Shed Groups", "app": app} )
22
38
83
121
import logging from galaxy import web from galaxy.webapps.base.controller import BaseUIController log = logging.getLogger(__name__) class Group(BaseUIController): @web.expose def index(self, trans, **kwd): FILL_FUNC_BODY
import logging from galaxy import web from galaxy.webapps.base.controller import BaseUIController log = logging.getLogger(__name__) class Group(BaseUIController): @web.expose def index(self, trans, **kwd): FILL_FUNC_BODY
46,564
/home/hieuvd/dung_repo/raw/stars_03/galaxyproject_galaxy/galaxy
/home/hieuvd/dung_repo/raw/stars_03/galaxyproject_galaxy/galaxy/lib/tool_shed/webapp/controllers/hg.py
24,26
23,52
handle_request
HgController
26,52
26,52
class HgController(BaseUIController): @web.expose def handle_request(self, trans, **kwd): FILL_FUNC_BODY
class HgController(BaseUIController): @web.expose def handle_request(self, trans, **kwd): FILL_FUNC_BODY
# The os command that results in this method being called will look something like: # hg clone http://test@127.0.0.1:9009/repos/test/convert_characters1 hgweb_config = trans.app.hgweb_config_manager.hgweb_config def make_web_app(): hgwebapp = hgwebdir(hgweb_config.encode("ut...
# The os command that results in this method being called will look something like: # hg clone http://test@127.0.0.1:9009/repos/test/convert_characters1 hgweb_config = trans.app.hgweb_config_manager.hgweb_config def make_web_app(): hgwebapp = hgwebdir(hgweb_config.encode("ut...
88
42
370
412
import logging from mercurial.hgweb.hgwebdir_mod import hgwebdir from galaxy import web from galaxy.exceptions import ObjectNotFound from galaxy.model.base import transaction from galaxy.webapps.base.controller import BaseUIController from tool_shed.util.repository_util import get_repository_by_name_and_owner log = ...
import logging from mercurial.hgweb.hgwebdir_mod import hgwebdir from galaxy import web from galaxy.exceptions import ObjectNotFound from galaxy.model.base import transaction from galaxy.webapps.base.controller import BaseUIController from tool_shed.util.repository_util import get_repository_by_name_and_owner log = ...
46,566
/home/hieuvd/dung_repo/raw/stars_03/galaxyproject_galaxy/galaxy
/home/hieuvd/dung_repo/raw/stars_03/galaxyproject_galaxy/galaxy/lib/tool_shed/webapp/fast_factory.py
46,47
1,58
factory
47,58
47,58
"""Module containing factory class for building uvicorn app for the Galaxy Tool Shed. Information on uvicorn, its various settings, and how to invoke it can be found at https://www.uvicorn.org/. The Galaxy Tool Shed can be launched with uvicorn using the following invocation: :: uvicorn --app-dir lib --factory ...
"""Module containing factory class for building uvicorn app for the Galaxy Tool Shed. Information on uvicorn, its various settings, and how to invoke it can be found at https://www.uvicorn.org/. The Galaxy Tool Shed can be launched with uvicorn using the following invocation: :: uvicorn --app-dir lib --factory ...
props = WebappSetupProps( app_name=TOOLSHED_APP_NAME, default_section_name=TOOLSHED_APP_NAME, env_config_file="TOOL_SHED_CONFIG_FILE", ) config_provider = WebappConfigResolver(props) config = config_provider.resolve_config() gx_webapp, app = app_pair( global_conf=conf...
props = WebappSetupProps( app_name=TOOLSHED_APP_NAME, default_section_name=TOOLSHED_APP_NAME, env_config_file="TOOL_SHED_CONFIG_FILE", ) config_provider = WebappConfigResolver(props) config = config_provider.resolve_config() gx_webapp, app = app_pair( global_conf=conf...
24
460
176
636
"""Module containing factory class for building uvicorn app for the Galaxy Tool Shed. Information on uvicorn, its various settings, and how to invoke it can be found at https://www.uvicorn.org/. The Galaxy Tool Shed can be launched with uvicorn using the following invocation: :: uvicorn --app-dir lib --factory ...
"""Module containing factory class for building uvicorn app for the Galaxy Tool Shed. Information on uvicorn, its various settings, and how to invoke it can be found at https://www.uvicorn.org/. The Galaxy Tool Shed can be launched with uvicorn using the following invocation: :: uvicorn --app-dir lib --factory ...
46,567
/home/hieuvd/dung_repo/raw/stars_03/galaxyproject_galaxy/galaxy
/home/hieuvd/dung_repo/raw/stars_03/galaxyproject_galaxy/galaxy/lib/tool_shed/webapp/framework/decorators.py
9,10
1,26
require_login
10,26
10,26
import logging from functools import wraps from galaxy.web.framework import url_for log = logging.getLogger(__name__) def require_login(verb="perform this action", use_panels=False): FILL_FUNC_BODY
import logging from functools import wraps from galaxy.web.framework import url_for log = logging.getLogger(__name__) def require_login(verb="perform this action", use_panels=False): FILL_FUNC_BODY
def argcatcher(func): @wraps(func) def decorator(self, trans, *args, **kwargs): if trans.get_user(): return func(self, trans, *args, **kwargs) else: return trans.show_error_message( 'You must be <a target="galaxy_main" href=...
def argcatcher(func): @wraps(func) def decorator(self, trans, *args, **kwargs): if trans.get_user(): return func(self, trans, *args, **kwargs) else: return trans.show_error_message( 'You must be <a target="galaxy_main" href=...
37
67
171
238
import logging from functools import wraps from galaxy.web.framework import url_for log = logging.getLogger(__name__) def require_login(verb="perform this action", use_panels=False): FILL_FUNC_BODY
import logging from functools import wraps from galaxy.web.framework import url_for log = logging.getLogger(__name__) def require_login(verb="perform this action", use_panels=False): FILL_FUNC_BODY
46,568
/home/hieuvd/dung_repo/raw/stars_03/galaxyproject_galaxy/galaxy
/home/hieuvd/dung_repo/raw/stars_03/galaxyproject_galaxy/galaxy/lib/tool_shed/webapp/framework/middleware/remoteuser.py
125,128
41,130
error
RemoteUser
128,130
128,130
class RemoteUser: def __init__(self, app, maildomain=None, display_servers=None, admin_users=None, remote_user_secret_header=None): self.app = app self.maildomain = maildomain self.display_servers = display_servers or [] self.admin_users = admin_users or [] self.config_secret...
class RemoteUser: def __init__(self, app, maildomain=None, display_servers=None, admin_users=None, remote_user_secret_header=None): self.app = app self.maildomain = maildomain self.display_servers = display_servers or [] self.admin_users = admin_users or [] self.config_secret...
start_response("403 Forbidden", [("Content-type", "text/html")]) return [errorpage % (title, message)]
start_response("403 Forbidden", [("Content-type", "text/html")]) return [errorpage % (title, message)]
9
1,263
39
1,302
""" Middleware for handling $REMOTE_USER if use_remote_user is enabled. """ import socket from galaxy.util import safe_str_cmp errorpage = """ <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <html lang="en"> <head> <title>Galaxy</title> <styl...
""" Middleware for handling $REMOTE_USER if use_remote_user is enabled. """ import socket from galaxy.util import safe_str_cmp errorpage = """ <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <html lang="en"> <head> <title>Galaxy</title> <styl...
46,570
/home/hieuvd/dung_repo/raw/stars_03/galaxyproject_galaxy/galaxy
/home/hieuvd/dung_repo/raw/stars_03/galaxyproject_galaxy/galaxy/lib/tool_shed/webapp/graphql/schema.py
107,108
103,111
resolve_repositories
CategoryQueryMixin
108,111
108,111
class CategoryQueryMixin(HasIdMixin): name = graphene.NonNull(graphene.String) repositories = graphene.List(lambda: SimpleRepository) def resolve_repositories(self, info: InfoDict): FILL_FUNC_BODY
class CategoryQueryMixin(HasIdMixin): name = graphene.NonNull(graphene.String) repositories = graphene.List(lambda: SimpleRepository) def resolve_repositories(self, info: InfoDict): FILL_FUNC_BODY
return [a.repository for a in self.repositories]
return [a.repository for a in self.repositories]
6
76
21
97
import graphene from graphene import relay from graphene_sqlalchemy import ( SQLAlchemyConnectionField, SQLAlchemyObjectType, ) from graphene_sqlalchemy.converter import convert_sqlalchemy_type from graphene_sqlalchemy.utils import column_type_eq from graphql import GraphQLResolveInfo from sqlalchemy.orm import...
import graphene from graphene import relay from graphene_sqlalchemy import ( SQLAlchemyConnectionField, SQLAlchemyObjectType, ) from graphene_sqlalchemy.converter import convert_sqlalchemy_type from graphene_sqlalchemy.utils import column_type_eq from graphql import GraphQLResolveInfo from sqlalchemy.orm import...
46,571
/home/hieuvd/dung_repo/raw/stars_03/galaxyproject_galaxy/galaxy
/home/hieuvd/dung_repo/raw/stars_03/galaxyproject_galaxy/galaxy/lib/tool_shed/webapp/graphql/schema.py
82,83
78,86
resolve_encoded_id
HasIdMixin
83,86
83,86
class HasIdMixin: id = graphene.NonNull(graphene.ID) encoded_id = graphene.NonNull(graphene.String) def resolve_encoded_id(self: SQLAlchemyObjectType, info): FILL_FUNC_BODY
class HasIdMixin: id = graphene.NonNull(graphene.ID) encoded_id = graphene.NonNull(graphene.String) def resolve_encoded_id(self: SQLAlchemyObjectType, info): FILL_FUNC_BODY
return info.context["security"].encode_id(self.id)
return info.context["security"].encode_id(self.id)
2
79
22
101
import graphene from graphene import relay from graphene_sqlalchemy import ( SQLAlchemyConnectionField, SQLAlchemyObjectType, ) from graphene_sqlalchemy.converter import convert_sqlalchemy_type from graphene_sqlalchemy.utils import column_type_eq from graphql import GraphQLResolveInfo from sqlalchemy.orm import...
import graphene from graphene import relay from graphene_sqlalchemy import ( SQLAlchemyConnectionField, SQLAlchemyObjectType, ) from graphene_sqlalchemy.converter import convert_sqlalchemy_type from graphene_sqlalchemy.utils import column_type_eq from graphql import GraphQLResolveInfo from sqlalchemy.orm import...
46,572
/home/hieuvd/dung_repo/raw/stars_03/galaxyproject_galaxy/galaxy
/home/hieuvd/dung_repo/raw/stars_03/galaxyproject_galaxy/galaxy/lib/tool_shed/webapp/graphql/schema.py
225,226
211,242
resolve_users
Query
226,229
226,229
class Query(graphene.ObjectType): users = graphene.List(SimpleUser) repositories = graphene.List(SimpleRepository) categories = graphene.List(SimpleCategory) revisions = graphene.List(SimpleRepositoryMetadata) node = relay.Node.Field() relay_users = SQLAlchemyConnectionField(RelayUser.connectio...
class Query(graphene.ObjectType): users = graphene.List(SimpleUser) repositories = graphene.List(SimpleRepository) categories = graphene.List(SimpleCategory) revisions = graphene.List(SimpleRepositoryMetadata) node = relay.Node.Field() relay_users = SQLAlchemyConnectionField(RelayUser.connectio...
query = SimpleUser.get_query(info) return query.all()
query = SimpleUser.get_query(info) return query.all()
5
345
24
369
import graphene from graphene import relay from graphene_sqlalchemy import ( SQLAlchemyConnectionField, SQLAlchemyObjectType, ) from graphene_sqlalchemy.converter import convert_sqlalchemy_type from graphene_sqlalchemy.utils import column_type_eq from graphql import GraphQLResolveInfo from sqlalchemy.orm import...
import graphene from graphene import relay from graphene_sqlalchemy import ( SQLAlchemyConnectionField, SQLAlchemyObjectType, ) from graphene_sqlalchemy.converter import convert_sqlalchemy_type from graphene_sqlalchemy.utils import column_type_eq from graphql import GraphQLResolveInfo from sqlalchemy.orm import...
46,573
/home/hieuvd/dung_repo/raw/stars_03/galaxyproject_galaxy/galaxy
/home/hieuvd/dung_repo/raw/stars_03/galaxyproject_galaxy/galaxy/lib/tool_shed/webapp/graphql/schema.py
178,180
174,197
get_query
RepositoriesForCategoryField
180,197
180,197
class RepositoriesForCategoryField(SQLAlchemyConnectionField): def __init__(self): super().__init__(RelayRepository.connection, id=graphene.Int(), encoded_id=graphene.String()) @classmethod def get_query(cls, model, info: GraphQLResolveInfo, sort=None, **args): FILL_FUNC_BODY
class RepositoriesForCategoryField(SQLAlchemyConnectionField): def __init__(self): super().__init__(RelayRepository.connection, id=graphene.Int(), encoded_id=graphene.String()) @classmethod def get_query(cls, model, info: GraphQLResolveInfo, sort=None, **args): FILL_FUNC_BODY
repository_query = super().get_query(model, info, sort=sort, **args) context: InfoDict = info.root_value query_id = args.get("id") if not query_id: encoded_id = args.get("encoded_id") assert encoded_id, f"Invalid encodedId found {encoded_id} in args {args}" ...
repository_query = super().get_query(model, info, sort=sort, **args) context: InfoDict = info.root_value query_id = args.get("id") if not query_id: encoded_id = args.get("encoded_id") assert encoded_id, f"Invalid encodedId found {encoded_id} in args {args}" ...
48
100
209
309
import graphene from graphene import relay from graphene_sqlalchemy import ( SQLAlchemyConnectionField, SQLAlchemyObjectType, ) from graphene_sqlalchemy.converter import convert_sqlalchemy_type from graphene_sqlalchemy.utils import column_type_eq from graphql import GraphQLResolveInfo from sqlalchemy.orm import...
import graphene from graphene import relay from graphene_sqlalchemy import ( SQLAlchemyConnectionField, SQLAlchemyObjectType, ) from graphene_sqlalchemy.converter import convert_sqlalchemy_type from graphene_sqlalchemy.utils import column_type_eq from graphql import GraphQLResolveInfo from sqlalchemy.orm import...
46,574
/home/hieuvd/dung_repo/raw/stars_03/galaxyproject_galaxy/galaxy
/home/hieuvd/dung_repo/raw/stars_03/galaxyproject_galaxy/galaxy/lib/tool_shed/webapp/graphql/schema.py
201,203
197,211
get_query
RepositoriesForOwnerField
203,211
203,211
class RepositoriesForOwnerField(SQLAlchemyConnectionField): def __init__(self): super().__init__(RelayRepository.connection, username=graphene.String()) @classmethod def get_query(cls, model, info: GraphQLResolveInfo, sort=None, **args): FILL_FUNC_BODY
class RepositoriesForOwnerField(SQLAlchemyConnectionField): def __init__(self): super().__init__(RelayRepository.connection, username=graphene.String()) @classmethod def get_query(cls, model, info: GraphQLResolveInfo, sort=None, **args): FILL_FUNC_BODY
repository_query = super().get_query(model, info, sort=sort, **args) username = args.get("username") rval = repository_query.join( SaUser, ).filter(SaUser.username == username) return rval
repository_query = super().get_query(model, info, sort=sort, **args) username = args.get("username") rval = repository_query.join( SaUser, ).filter(SaUser.username == username) return rval
18
89
77
166
import graphene from graphene import relay from graphene_sqlalchemy import ( SQLAlchemyConnectionField, SQLAlchemyObjectType, ) from graphene_sqlalchemy.converter import convert_sqlalchemy_type from graphene_sqlalchemy.utils import column_type_eq from graphql import GraphQLResolveInfo from sqlalchemy.orm import...
import graphene from graphene import relay from graphene_sqlalchemy import ( SQLAlchemyConnectionField, SQLAlchemyObjectType, ) from graphene_sqlalchemy.converter import convert_sqlalchemy_type from graphene_sqlalchemy.utils import column_type_eq from graphql import GraphQLResolveInfo from sqlalchemy.orm import...
46,575
/home/hieuvd/dung_repo/raw/stars_03/galaxyproject_galaxy/galaxy
/home/hieuvd/dung_repo/raw/stars_03/galaxyproject_galaxy/galaxy/lib/tool_shed/webapp/model/mapping.py
31,34
1,54
init
35,54
34,54
""" Details of how the data model objects are mapped onto the relational database are encapsulated here. """ import logging from typing import ( Any, Dict, Optional, ) import tool_shed.webapp.model import tool_shed.webapp.util.shed_statistics as shed_statistics from galaxy.model.base import SharedModelMap...
""" Details of how the data model objects are mapped onto the relational database are encapsulated here. """ import logging from typing import ( Any, Dict, Optional, ) import tool_shed.webapp.model import tool_shed.webapp.util.shed_statistics as shed_statistics from galaxy.model.base import SharedModelMap...
engine_options = engine_options or {} # Create the database engine engine = build_engine(url, engine_options) result = ToolShedModelMapping([tool_shed.webapp.model], engine=engine) if create_tables: metadata.create_all(bind=engine) result.create_tables = create_tables result.secu...
"""Connect mappings to the database""" engine_options = engine_options or {} # Create the database engine engine = build_engine(url, engine_options) result = ToolShedModelMapping([tool_shed.webapp.model], engine=engine) if create_tables: metadata.create_all(bind=engine) result.cre...
38
278
182
460
""" Details of how the data model objects are mapped onto the relational database are encapsulated here. """ import logging from typing import ( Any, Dict, Optional, ) import tool_shed.webapp.model import tool_shed.webapp.util.shed_statistics as shed_statistics from galaxy.model.base import SharedModelMap...
""" Details of how the data model objects are mapped onto the relational database are encapsulated here. """ import logging from typing import ( Any, Dict, Optional, ) import tool_shed.webapp.model import tool_shed.webapp.util.shed_statistics as shed_statistics from galaxy.model.base import SharedModelMap...
46,576
/home/hieuvd/dung_repo/raw/stars_03/galaxyproject_galaxy/galaxy
/home/hieuvd/dung_repo/raw/stars_03/galaxyproject_galaxy/galaxy/lib/tool_shed/webapp/model/migrations/alembic/env.py
73,74
1,89
_get_url_from_config
74,78
74,78
import logging from typing import ( Callable, cast, Dict, ) from alembic import context from sqlalchemy import create_engine config = context.config target_metadata = None # Not implemented: used for autogenerate, which we don't use here. log = logging.getLogger(__name__) def run_migrations_offline() -...
import logging from typing import ( Callable, cast, Dict, ) from alembic import context from sqlalchemy import create_engine config = context.config target_metadata = None # Not implemented: used for autogenerate, which we don't use here. log = logging.getLogger(__name__) def run_migrations_offline() -...
url = config.get_main_option("sqlalchemy.url") return cast(str, url)
url = config.get_main_option("sqlalchemy.url") return cast(str, url)
6
840
34
874
import logging from typing import ( Callable, cast, Dict, ) from alembic import context from sqlalchemy import create_engine config = context.config target_metadata = None # Not implemented: used for autogenerate, which we don't use here. log = logging.getLogger(__name__) def run_migrations_offline() -...
import logging from typing import ( Callable, cast, Dict, ) from alembic import context from sqlalchemy import create_engine config = context.config target_metadata = None # Not implemented: used for autogenerate, which we don't use here. log = logging.getLogger(__name__) def run_migrations_offline() -...
46,577
/home/hieuvd/dung_repo/raw/stars_03/galaxyproject_galaxy/galaxy
/home/hieuvd/dung_repo/raw/stars_03/galaxyproject_galaxy/galaxy/lib/tool_shed/webapp/model/migrations/dbscript.py
44,45
39,48
_get_dbscript
Command
45,48
45,48
class Command(BaseCommand): def init(self, args: Namespace) -> None: url = get_dburl(sys.argv, os.getcwd()) verify_database(url) def _get_dbscript(self, config_file: str) -> BaseDbScript: FILL_FUNC_BODY
class Command(BaseCommand): def init(self, args: Namespace) -> None: url = get_dburl(sys.argv, os.getcwd()) verify_database(url) def _get_dbscript(self, config_file: str) -> BaseDbScript: FILL_FUNC_BODY
return DbScript(config_file)
return DbScript(config_file)
2
85
16
101
import logging import os import sys from argparse import Namespace from typing import Optional from galaxy.model.migrations.base import ( BaseCommand, BaseDbScript, BaseParserBuilder, ) from tool_shed.webapp.model.migrations import verify_database from tool_shed.webapp.model.migrations.scripts import ( ...
import logging import os import sys from argparse import Namespace from typing import Optional from galaxy.model.migrations.base import ( BaseCommand, BaseDbScript, BaseParserBuilder, ) from tool_shed.webapp.model.migrations import verify_database from tool_shed.webapp.model.migrations.scripts import ( ...
46,578
/home/hieuvd/dung_repo/raw/stars_03/galaxyproject_galaxy/galaxy
/home/hieuvd/dung_repo/raw/stars_03/galaxyproject_galaxy/galaxy/lib/tool_shed/webapp/model/migrations/dbscript.py
57,58
48,59
_revision_tags
DbScript
58,59
58,59
class DbScript(BaseDbScript): def _set_dburl(self, config_file: Optional[str] = None) -> None: self.url = get_dburl_from_file(os.getcwd(), config_file) self.alembic_config.set_main_option("sqlalchemy.url", self.url) def _upgrade_to_head(self, is_sql_mode: bool) -> None: self.alembic_con...
class DbScript(BaseDbScript): def _set_dburl(self, config_file: Optional[str] = None) -> None: self.url = get_dburl_from_file(os.getcwd(), config_file) self.alembic_config.set_main_option("sqlalchemy.url", self.url) def _upgrade_to_head(self, is_sql_mode: bool) -> None: self.alembic_con...
return REVISION_TAGS
return REVISION_TAGS
2
181
11
192
import logging import os import sys from argparse import Namespace from typing import Optional from galaxy.model.migrations.base import ( BaseCommand, BaseDbScript, BaseParserBuilder, ) from tool_shed.webapp.model.migrations import verify_database from tool_shed.webapp.model.migrations.scripts import ( ...
import logging import os import sys from argparse import Namespace from typing import Optional from galaxy.model.migrations.base import ( BaseCommand, BaseDbScript, BaseParserBuilder, ) from tool_shed.webapp.model.migrations import verify_database from tool_shed.webapp.model.migrations.scripts import ( ...
46,579
/home/hieuvd/dung_repo/raw/stars_03/galaxyproject_galaxy/galaxy
/home/hieuvd/dung_repo/raw/stars_03/galaxyproject_galaxy/galaxy/lib/tool_shed/webapp/model/migrations/dbscript.py
35,36
34,39
_get_command_object
ParserBuilder
36,39
36,39
class ParserBuilder(BaseParserBuilder): def _get_command_object(self): FILL_FUNC_BODY
class ParserBuilder(BaseParserBuilder): def _get_command_object(self): FILL_FUNC_BODY
return Command()
return Command()
2
32
10
42
import logging import os import sys from argparse import Namespace from typing import Optional from galaxy.model.migrations.base import ( BaseCommand, BaseDbScript, BaseParserBuilder, ) from tool_shed.webapp.model.migrations import verify_database from tool_shed.webapp.model.migrations.scripts import ( ...
import logging import os import sys from argparse import Namespace from typing import Optional from galaxy.model.migrations.base import ( BaseCommand, BaseDbScript, BaseParserBuilder, ) from tool_shed.webapp.model.migrations import verify_database from tool_shed.webapp.model.migrations.scripts import ( ...
46,580
/home/hieuvd/dung_repo/raw/stars_03/galaxyproject_galaxy/galaxy
/home/hieuvd/dung_repo/raw/stars_03/galaxyproject_galaxy/galaxy/lib/tool_shed/webapp/model/migrations/scripts.py
26,27
1,35
get_dburl_from_file
27,35
27,35
import os from typing import ( List, Optional, ) from galaxy.model.migrations.base import pop_arg_from_args from galaxy.util.properties import ( find_config_file, get_data_dir, load_app_properties, ) DEFAULT_CONFIG_NAMES = ["tool_shed", "tool_shed_wsgi"] CONFIG_FILE_ARG = "--toolshed-config" CONFI...
import os from typing import ( List, Optional, ) from galaxy.model.migrations.base import pop_arg_from_args from galaxy.util.properties import ( find_config_file, get_data_dir, load_app_properties, ) DEFAULT_CONFIG_NAMES = ["tool_shed", "tool_shed_wsgi"] CONFIG_FILE_ARG = "--toolshed-config" CONFI...
if config_file is None: cwds = [cwd, os.path.join(cwd, CONFIG_DIR_NAME)] config_file = find_config_file(DEFAULT_CONFIG_NAMES, dirs=cwds) properties = load_app_properties(config_file=config_file, config_prefix=TOOLSHED_CONFIG_PREFIX) default_url = f"sqlite:///{os.path.join(get_data_dir(prope...
if config_file is None: cwds = [cwd, os.path.join(cwd, CONFIG_DIR_NAME)] config_file = find_config_file(DEFAULT_CONFIG_NAMES, dirs=cwds) properties = load_app_properties(config_file=config_file, config_prefix=TOOLSHED_CONFIG_PREFIX) default_url = f"sqlite:///{os.path.join(get_data_dir(prope...
27
260
167
427
import os from typing import ( List, Optional, ) from galaxy.model.migrations.base import pop_arg_from_args from galaxy.util.properties import ( find_config_file, get_data_dir, load_app_properties, ) DEFAULT_CONFIG_NAMES = ["tool_shed", "tool_shed_wsgi"] CONFIG_FILE_ARG = "--toolshed-config" CONFI...
import os from typing import ( List, Optional, ) from galaxy.model.migrations.base import pop_arg_from_args from galaxy.util.properties import ( find_config_file, get_data_dir, load_app_properties, ) DEFAULT_CONFIG_NAMES = ["tool_shed", "tool_shed_wsgi"] CONFIG_FILE_ARG = "--toolshed-config" CONFI...
46,581
/home/hieuvd/dung_repo/raw/stars_03/galaxyproject_galaxy/galaxy
/home/hieuvd/dung_repo/raw/stars_03/galaxyproject_galaxy/galaxy/lib/tool_shed/webapp/search/tool_search.py
35,36
34,93
search
ToolSearch
43,93
36,93
class ToolSearch: def search(self, app, search_term, page, page_size, boosts): FILL_FUNC_BODY
class ToolSearch: def search(self, app, search_term, page, page_size, boosts): """ Perform the search on the given search_term :param search_term: unicode encoded string with the search term(s) :returns results: dictionary containing number of hits, hits themselves and matched term...
tool_index_dir = os.path.join(app.config.whoosh_index_dir, "tools") index_exists = whoosh.index.exists_in(tool_index_dir) if index_exists: index = whoosh.index.open_dir(tool_index_dir) try: # Some literature about BM25F: # http://trec.nist....
""" Perform the search on the given search_term :param search_term: unicode encoded string with the search term(s) :returns results: dictionary containing number of hits, hits themselves and matched terms for each """ tool_index_dir = os.path.join(app.config.whoosh_inde...
147
95
753
848
"""Module for searching the toolshed tools within all repositories""" import logging import os import whoosh.index from whoosh import scoring from whoosh.fields import ( ID, Schema, TEXT, ) from whoosh.qparser import MultifieldParser from galaxy import exceptions from galaxy.exceptions import ObjectNotFo...
"""Module for searching the toolshed tools within all repositories""" import logging import os import whoosh.index from whoosh import scoring from whoosh.fields import ( ID, Schema, TEXT, ) from whoosh.qparser import MultifieldParser from galaxy import exceptions from galaxy.exceptions import ObjectNotFo...
46,582
/home/hieuvd/dung_repo/raw/stars_03/galaxyproject_galaxy/galaxy
/home/hieuvd/dung_repo/raw/stars_03/galaxyproject_galaxy/galaxy/lib/tool_shed/webapp/util/ratings_util.py
12,13
9,34
rate_item
ItemRatings
14,34
13,34
class ItemRatings(UsesItemRatings): """Overrides rate_item method since we also allow for comments""" def rate_item(self, trans, user, item, rating, comment=""): FILL_FUNC_BODY
class ItemRatings(UsesItemRatings): """Overrides rate_item method since we also allow for comments""" def rate_item(self, trans, user, item, rating, comment=""): """Rate an item. Return type is <item_class>RatingAssociation.""" FILL_FUNC_BODY
item_rating = self.get_user_item_rating(trans.sa_session, user, item, webapp_model=trans.model) if not item_rating: # User has not yet rated item; create rating. item_rating_assoc_class = self._get_item_rating_assoc_class(item, webapp_model=trans.model) item_rating = ...
"""Rate an item. Return type is <item_class>RatingAssociation.""" item_rating = self.get_user_item_rating(trans.sa_session, user, item, webapp_model=trans.model) if not item_rating: # User has not yet rated item; create rating. item_rating_assoc_class = self._get_item_rat...
67
83
294
377
import logging from galaxy.model.base import transaction from galaxy.model.item_attrs import UsesItemRatings log = logging.getLogger(__name__) class ItemRatings(UsesItemRatings): """Overrides rate_item method since we also allow for comments""" def rate_item(self, trans, user, item, rating, comment=""): FI...
import logging from galaxy.model.base import transaction from galaxy.model.item_attrs import UsesItemRatings log = logging.getLogger(__name__) class ItemRatings(UsesItemRatings): """Overrides rate_item method since we also allow for comments""" def rate_item(self, trans, user, item, rating, comment=""): ...
46,583
/home/hieuvd/dung_repo/raw/stars_03/galaxyproject_galaxy/galaxy
/home/hieuvd/dung_repo/raw/stars_03/galaxyproject_galaxy/galaxy/lib/tool_shed/webapp/util/shed_statistics.py
27,28
11,95
generate_statistics
ShedCounter
28,95
28,95
class ShedCounter: def __init__(self, model): # TODO: Enhance the ShedCounter to retrieve information from the db instead of displaying what's currently in memory. self.model = model self.custom_datatypes = 0 self.generation_time = strftime("%b %d, %Y", gmtime()) self.deleted...
class ShedCounter: def __init__(self, model): # TODO: Enhance the ShedCounter to retrieve information from the db instead of displaying what's currently in memory. self.model = model self.custom_datatypes = 0 self.generation_time = strftime("%b %d, %Y", gmtime()) self.deleted...
self.custom_datatypes = 0 self.deleted_repositories = 0 self.deprecated_repositories = 0 self.invalid_versions_of_tools = 0 self.repositories = 0 self.total_clones = 0 self.unique_owners = 0 self.valid_versions_of_tools = 0 self.unique_valid_tools ...
self.custom_datatypes = 0 self.deleted_repositories = 0 self.deprecated_repositories = 0 self.invalid_versions_of_tools = 0 self.repositories = 0 self.total_clones = 0 self.unique_owners = 0 self.valid_versions_of_tools = 0 self.unique_valid_tools ...
223
208
886
1,094
from time import ( gmtime, strftime, ) from sqlalchemy import select from tool_shed.webapp.model import Repository class ShedCounter: def __init__(self, model): # TODO: Enhance the ShedCounter to retrieve information from the db instead of displaying what's currently in memory. self.mode...
from time import ( gmtime, strftime, ) from sqlalchemy import select from tool_shed.webapp.model import Repository class ShedCounter: def __init__(self, model): # TODO: Enhance the ShedCounter to retrieve information from the db instead of displaying what's currently in memory. self.mode...
46,584
/home/hieuvd/dung_repo/raw/stars_03/galaxyproject_galaxy/galaxy
/home/hieuvd/dung_repo/raw/stars_03/galaxyproject_galaxy/galaxy/lib/tool_shed_client/trs_util.py
22,23
1,25
encode_identifier
23,25
23,25
from typing import NamedTuple class EncodedIdentifier(NamedTuple): tool_shed_base: str encoded_id: str # TRS specified encoding/decoding according to... # https://datatracker.ietf.org/doc/html/rfc3986#section-2.4 # Failed to get whole tool shed IDs working with FastAPI # - https://github.com/tiangolo/fastap...
from typing import NamedTuple class EncodedIdentifier(NamedTuple): tool_shed_base: str encoded_id: str # TRS specified encoding/decoding according to... # https://datatracker.ietf.org/doc/html/rfc3986#section-2.4 # Failed to get whole tool shed IDs working with FastAPI # - https://github.com/tiangolo/fastap...
base, rest = identifier.split("/repos/", 1) return EncodedIdentifier(base, "~".join(rest.split("/")))
base, rest = identifier.split("/repos/", 1) return EncodedIdentifier(base, "~".join(rest.split("/")))
8
257
39
296
from typing import NamedTuple class EncodedIdentifier(NamedTuple): tool_shed_base: str encoded_id: str # TRS specified encoding/decoding according to... # https://datatracker.ietf.org/doc/html/rfc3986#section-2.4 # Failed to get whole tool shed IDs working with FastAPI # - https://github.com/tiangolo/fastap...
from typing import NamedTuple class EncodedIdentifier(NamedTuple): tool_shed_base: str encoded_id: str # TRS specified encoding/decoding according to... # https://datatracker.ietf.org/doc/html/rfc3986#section-2.4 # Failed to get whole tool shed IDs working with FastAPI # - https://github.com/tiangolo/fastap...
46,585
/home/hieuvd/dung_repo/raw/stars_03/galaxyproject_galaxy/galaxy
/home/hieuvd/dung_repo/raw/stars_03/galaxyproject_galaxy/galaxy/packages/app/galaxy/config_watchers.py
138,140
15,152
tool_config_paths
ConfigWatchers
140,145
140,145
class ConfigWatchers: """Contains ToolConfWatcher, ToolWatcher and ToolDataWatcher objects.""" def __init__(self, app: StructuredApp): self.app = app self.active = False # ToolConfWatcher objects will watch the tool_cache if the tool_cache is passed into get_tool_conf_watcher. #...
class ConfigWatchers: """Contains ToolConfWatcher, ToolWatcher and ToolDataWatcher objects.""" def __init__(self, app: StructuredApp): self.app = app self.active = False # ToolConfWatcher objects will watch the tool_cache if the tool_cache is passed into get_tool_conf_watcher. #...
tool_config_paths = [] if hasattr(self.app.config, "tool_configs"): tool_config_paths = self.app.config.tool_configs return tool_config_paths
tool_config_paths = [] if hasattr(self.app.config, "tool_configs"): tool_config_paths = self.app.config.tool_configs return tool_config_paths
11
1,827
60
1,887
import logging from os.path import dirname from galaxy.queue_worker import job_rule_modules from galaxy.structured_app import StructuredApp from galaxy.tool_util.toolbox.watcher import ( get_tool_conf_watcher, get_tool_watcher, ) from galaxy.util.watcher import get_watcher log = logging.getLogger(__name__) ...
import logging from os.path import dirname from galaxy.queue_worker import job_rule_modules from galaxy.structured_app import StructuredApp from galaxy.tool_util.toolbox.watcher import ( get_tool_conf_watcher, get_tool_watcher, ) from galaxy.util.watcher import get_watcher log = logging.getLogger(__name__) ...
46,586
/home/hieuvd/dung_repo/raw/stars_03/galaxyproject_galaxy/galaxy
/home/hieuvd/dung_repo/raw/stars_03/galaxyproject_galaxy/galaxy/packages/app/galaxy/di.py
31,34
15,49
_register_abstract_singleton
Container
34,37
34,37
class Container(LagomContainer): """Abstraction around lagom to provide a dependency injection context. Abstractions used by Galaxy should come through this interface so we can swap out the backend as needed. For instance https://punq.readthedocs.io/en/latest/ containers look very nice and would allow ...
class Container(LagomContainer): """Abstraction around lagom to provide a dependency injection context. Abstractions used by Galaxy should come through this interface so we can swap out the backend as needed. For instance https://punq.readthedocs.io/en/latest/ containers look very nice and would allow ...
self[abstract_type] = instance if instance is not None else concrete_type return self[abstract_type]
self[abstract_type] = instance if instance is not None else concrete_type return self[abstract_type]
12
360
34
394
"""Dependency injection framework for Galaxy-type apps.""" from typing import ( Optional, Type, TypeVar, ) from lagom import Container as LagomContainer from lagom.exceptions import UnresolvableType T = TypeVar("T") class Container(LagomContainer): """Abstraction around lagom to provide a dependenc...
"""Dependency injection framework for Galaxy-type apps.""" from typing import ( Optional, Type, TypeVar, ) from lagom import Container as LagomContainer from lagom.exceptions import UnresolvableType T = TypeVar("T") class Container(LagomContainer): """Abstraction around lagom to provide a dependenc...
46,587
/home/hieuvd/dung_repo/raw/stars_03/galaxyproject_galaxy/galaxy
/home/hieuvd/dung_repo/raw/stars_03/galaxyproject_galaxy/galaxy/packages/app/galaxy/main_config.py
38,39
1,114
find_config
39,53
39,53
"""Utilities for finding Galaxy's configuration file. This is for use by web framework code and scripts (e.g. scripts/galaxy_main.py). """ import os from typing import ( List, NamedTuple, Optional, ) from galaxy.util.properties import find_config_file from galaxy.web_stack import get_app_kwds DEFAULT_IN...
"""Utilities for finding Galaxy's configuration file. This is for use by web framework code and scripts (e.g. scripts/galaxy_main.py). """ import os from typing import ( List, NamedTuple, Optional, ) from galaxy.util.properties import find_config_file from galaxy.web_stack import get_app_kwds DEFAULT_IN...
if supplied_config: return supplied_config if galaxy_root is None: return os.path.abspath(f"{app_name}.yml") for filename in default_relative_config_paths_for(app_name): config_path = os.path.join(galaxy_root, filename) if os.path.exists(config_path): return con...
if supplied_config: return supplied_config if galaxy_root is None: return os.path.abspath(f"{app_name}.yml") for filename in default_relative_config_paths_for(app_name): config_path = os.path.join(galaxy_root, filename) if os.path.exists(config_path): return con...
24
1,202
123
1,325
"""Utilities for finding Galaxy's configuration file. This is for use by web framework code and scripts (e.g. scripts/galaxy_main.py). """ import os from typing import ( List, NamedTuple, Optional, ) from galaxy.util.properties import find_config_file from galaxy.web_stack import get_app_kwds DEFAULT_IN...
"""Utilities for finding Galaxy's configuration file. This is for use by web framework code and scripts (e.g. scripts/galaxy_main.py). """ import os from typing import ( List, NamedTuple, Optional, ) from galaxy.util.properties import find_config_file from galaxy.web_stack import get_app_kwds DEFAULT_IN...
46,588
/home/hieuvd/dung_repo/raw/stars_03/galaxyproject_galaxy/galaxy
/home/hieuvd/dung_repo/raw/stars_03/galaxyproject_galaxy/galaxy/packages/app/galaxy/main_config.py
89,90
72,114
_resolve_config_file_path
WebappConfigResolver
90,101
90,101
class WebappConfigResolver: def __init__(self, props: WebappSetupProps) -> None: self.props = props self.app_kwds = get_app_kwds(props.default_section_name, props.app_name) self.config_file = self._resolve_config_file_path() self.is_ini_file = config_is_ini(self.config_file) ...
class WebappConfigResolver: def __init__(self, props: WebappSetupProps) -> None: self.props = props self.app_kwds = get_app_kwds(props.default_section_name, props.app_name) self.config_file = self._resolve_config_file_path() self.is_ini_file = config_is_ini(self.config_file) ...
config_file = self.app_kwds.get("config_file") if not config_file and os.environ.get(self.props.env_config_file): config_file = os.path.abspath(os.environ[self.props.env_config_file]) elif self.props.check_galaxy_root: galaxy_root = self.app_kwds.get("galaxy_root") or os....
config_file = self.app_kwds.get("config_file") if not config_file and os.environ.get(self.props.env_config_file): config_file = os.path.abspath(os.environ[self.props.env_config_file]) elif self.props.check_galaxy_root: galaxy_root = self.app_kwds.get("galaxy_root") or os....
33
459
222
681
"""Utilities for finding Galaxy's configuration file. This is for use by web framework code and scripts (e.g. scripts/galaxy_main.py). """ import os from typing import ( List, NamedTuple, Optional, ) from galaxy.util.properties import find_config_file from galaxy.web_stack import get_app_kwds DEFAULT_IN...
"""Utilities for finding Galaxy's configuration file. This is for use by web framework code and scripts (e.g. scripts/galaxy_main.py). """ import os from typing import ( List, NamedTuple, Optional, ) from galaxy.util.properties import find_config_file from galaxy.web_stack import get_app_kwds DEFAULT_IN...
46,589
/home/hieuvd/dung_repo/raw/stars_03/galaxyproject_galaxy/galaxy
/home/hieuvd/dung_repo/raw/stars_03/galaxyproject_galaxy/galaxy/packages/app/galaxy/queues.py
20,21
1,49
all_control_queues_for_declare
25,32
21,32
""" All message queues used by Galaxy """ import socket from typing import Optional from kombu import ( Connection, Exchange, Queue, ) ALL_CONTROL = "control.*" galaxy_exchange = Exchange("galaxy_core_exchange", type="topic") def all_control_queues_for_declare(application_stack): FILL_FUNC_BODYdef co...
""" All message queues used by Galaxy """ import socket from typing import Optional from kombu import ( Connection, Exchange, Queue, ) ALL_CONTROL = "control.*" galaxy_exchange = Exchange("galaxy_core_exchange", type="topic") def all_control_queues_for_declare(application_stack): """ For in-m...
# Get all active processes and construct queues for each process process_names = ( f"{p.server_name}@{p.hostname}" for p in application_stack.app.database_heartbeat.get_active_processes() ) return [Queue(f"control.{server_name}", galaxy_exchange, routing_key="control.*") for server_name in proce...
""" For in-memory routing (used by sqlalchemy-based transports), we need to be able to build the entire routing table in producers. """ # Get all active processes and construct queues for each process process_names = ( f"{p.server_name}@{p.hostname}" for p in application_stack.app.databa...
28
357
109
466
""" All message queues used by Galaxy """ import socket from typing import Optional from kombu import ( Connection, Exchange, Queue, ) ALL_CONTROL = "control.*" galaxy_exchange = Exchange("galaxy_core_exchange", type="topic") def all_control_queues_for_declare(application_stack): FILL_FUNC_BODYdef co...
""" All message queues used by Galaxy """ import socket from typing import Optional from kombu import ( Connection, Exchange, Queue, ) ALL_CONTROL = "control.*" galaxy_exchange = Exchange("galaxy_core_exchange", type="topic") def all_control_queues_for_declare(application_stack): """ For in-m...
46,590
/home/hieuvd/dung_repo/raw/stars_03/galaxyproject_galaxy/galaxy
/home/hieuvd/dung_repo/raw/stars_03/galaxyproject_galaxy/galaxy/packages/build_scripts/commit_version.py
10,11
1,47
main
11,40
11,40
#!/usr/bin/env python # Modify version... import datetime import os import re import subprocess import sys def main(argv): FILL_FUNC_BODYdef shell(cmds, **kwds): p = subprocess.Popen(cmds, **kwds) return p.wait() if __name__ == "__main__": main(sys.argv)
#!/usr/bin/env python # Modify version... import datetime import os import re import subprocess import sys def main(argv): FILL_FUNC_BODYdef shell(cmds, **kwds): p = subprocess.Popen(cmds, **kwds) return p.wait() if __name__ == "__main__": main(sys.argv)
DEV_RELEASE = os.environ.get("DEV_RELEASE", None) == "1" PROJECT_DIRECTORY = os.getcwd() PROJECT_DIRECTORY_NAME = os.path.basename(os.path.abspath(PROJECT_DIRECTORY)) PROJECT_NAME = PROJECT_DIRECTORY_NAME.replace("_", "-") version = argv[1] setup_cfg_path = os.path.join(PROJECT_DIRECTORY, "setu...
DEV_RELEASE = os.environ.get("DEV_RELEASE", None) == "1" PROJECT_DIRECTORY = os.getcwd() PROJECT_DIRECTORY_NAME = os.path.basename(os.path.abspath(PROJECT_DIRECTORY)) PROJECT_NAME = PROJECT_DIRECTORY_NAME.replace("_", "-") version = argv[1] setup_cfg_path = os.path.join(PROJECT_DIRECTORY, "setu...
97
106
475
581
#!/usr/bin/env python # Modify version... import datetime import os import re import subprocess import sys def main(argv): FILL_FUNC_BODYdef shell(cmds, **kwds): p = subprocess.Popen(cmds, **kwds) return p.wait() if __name__ == "__main__": main(sys.argv)
#!/usr/bin/env python # Modify version... import datetime import os import re import subprocess import sys def main(argv): FILL_FUNC_BODYdef shell(cmds, **kwds): p = subprocess.Popen(cmds, **kwds) return p.wait() if __name__ == "__main__": main(sys.argv)
46,591
/home/hieuvd/dung_repo/raw/stars_03/galaxyproject_galaxy/galaxy
/home/hieuvd/dung_repo/raw/stars_03/galaxyproject_galaxy/galaxy/packages/build_scripts/new_version.py
16,17
1,78
main
17,71
17,71
#!/usr/bin/env python # Modify version... import os import re import subprocess import sys from packaging.version import Version DEV_RELEASE = os.environ.get("DEV_RELEASE", None) == "1" PROJECT_DIRECTORY = os.getcwd() PROJECT_DIRECTORY_NAME = os.path.basename(os.path.abspath(PROJECT_DIRECTORY)) PROJECT_NAME = PROJECT...
#!/usr/bin/env python # Modify version... import os import re import subprocess import sys from packaging.version import Version DEV_RELEASE = os.environ.get("DEV_RELEASE", None) == "1" PROJECT_DIRECTORY = os.getcwd() PROJECT_DIRECTORY_NAME = os.path.basename(os.path.abspath(PROJECT_DIRECTORY)) PROJECT_NAME = PROJECT...
version = argv[1] version_obj = Version(version) if not DEV_RELEASE: # Discard epoch, release numbers after micro, pre-, post-, dev-release segments and local version new_version_tuple = list(version_obj.release[:3]) if len(new_version_tuple) < 3: new_version_tuple.append...
version = argv[1] version_obj = Version(version) if not DEV_RELEASE: # Discard epoch, release numbers after micro, pre-, post-, dev-release segments and local version new_version_tuple = list(version_obj.release[:3]) if len(new_version_tuple) < 3: new_version_tuple.append...
152
201
647
848
#!/usr/bin/env python # Modify version... import os import re import subprocess import sys from packaging.version import Version DEV_RELEASE = os.environ.get("DEV_RELEASE", None) == "1" PROJECT_DIRECTORY = os.getcwd() PROJECT_DIRECTORY_NAME = os.path.basename(os.path.abspath(PROJECT_DIRECTORY)) PROJECT_NAME = PROJECT...
#!/usr/bin/env python # Modify version... import os import re import subprocess import sys from packaging.version import Version DEV_RELEASE = os.environ.get("DEV_RELEASE", None) == "1" PROJECT_DIRECTORY = os.getcwd() PROJECT_DIRECTORY_NAME = os.path.basename(os.path.abspath(PROJECT_DIRECTORY)) PROJECT_NAME = PROJECT...
46,592
/home/hieuvd/dung_repo/raw/stars_03/galaxyproject_galaxy/galaxy
/home/hieuvd/dung_repo/raw/stars_03/galaxyproject_galaxy/galaxy/packages/build_scripts/print_version_for_release.py
9,10
1,31
main
10,29
10,29
import os import re from packaging.version import Version _version_re = re.compile(r"^version\s+=\s+(.*)", flags=re.MULTILINE) def main(): FILL_FUNC_BODYif __name__ == "__main__": main()
import os import re from packaging.version import Version _version_re = re.compile(r"^version\s+=\s+(.*)", flags=re.MULTILINE) def main(): FILL_FUNC_BODYif __name__ == "__main__": main()
DEV_RELEASE = os.environ.get("DEV_RELEASE", None) == "1" PROJECT_DIRECTORY = os.getcwd() setup_cfg_path = os.path.join(PROJECT_DIRECTORY, "setup.cfg") with open(setup_cfg_path) as f: setup_cfg = f.read() version_match = _version_re.search(setup_cfg) assert version_match version = v...
DEV_RELEASE = os.environ.get("DEV_RELEASE", None) == "1" PROJECT_DIRECTORY = os.getcwd() setup_cfg_path = os.path.join(PROJECT_DIRECTORY, "setup.cfg") with open(setup_cfg_path) as f: setup_cfg = f.read() version_match = _version_re.search(setup_cfg) assert version_match version = v...
40
79
200
279
import os import re from packaging.version import Version _version_re = re.compile(r"^version\s+=\s+(.*)", flags=re.MULTILINE) def main(): FILL_FUNC_BODYif __name__ == "__main__": main()
import os import re from packaging.version import Version _version_re = re.compile(r"^version\s+=\s+(.*)", flags=re.MULTILINE) def main(): FILL_FUNC_BODYif __name__ == "__main__": main()
46,593
/home/hieuvd/dung_repo/raw/stars_03/galaxyproject_galaxy/galaxy
/home/hieuvd/dung_repo/raw/stars_03/galaxyproject_galaxy/galaxy/scripts/api/common.py
118,119
1,195
submit
123,155
119,155
""" Common methods used by the API sample scripts. """ import json import logging import sys from urllib.error import HTTPError from urllib.request import ( Request, urlopen, ) log = logging.getLogger(__name__) def make_url(api_key, url, args=None): """ Adds the API Key to the URL if it's not alread...
""" Common methods used by the API sample scripts. """ import json import logging import sys from urllib.error import HTTPError from urllib.request import ( Request, urlopen, ) log = logging.getLogger(__name__) def make_url(api_key, url, args=None): """ Adds the API Key to the URL if it's not alread...
try: r = post(api_key, url, data) except HTTPError as e: if return_formatted: print(e) print(e.read(1024)) sys.exit(1) else: return "Error. " + str(e.read(1024)) if not return_formatted: return r print("Response") print(...
""" Sends an API POST request and acts as a generic formatter for the JSON response. 'data' will become the JSON payload read by Galaxy. """ try: r = post(api_key, url, data) except HTTPError as e: if return_formatted: print(e) print(e.read(1024)) ...
83
1,450
297
1,747
""" Common methods used by the API sample scripts. """ import json import logging import sys from urllib.error import HTTPError from urllib.request import ( Request, urlopen, ) log = logging.getLogger(__name__) def make_url(api_key, url, args=None): """ Adds the API Key to the URL if it's not alread...
""" Common methods used by the API sample scripts. """ import json import logging import sys from urllib.error import HTTPError from urllib.request import ( Request, urlopen, ) log = logging.getLogger(__name__) def make_url(api_key, url, args=None): """ Adds the API Key to the URL if it's not alread...
46,594
/home/hieuvd/dung_repo/raw/stars_03/galaxyproject_galaxy/galaxy
/home/hieuvd/dung_repo/raw/stars_03/galaxyproject_galaxy/galaxy/scripts/api/copy_hda_to_library_folder.py
10,11
1,37
copy_hda_to_library_folder
11,23
11,23
#!/usr/bin/env python import sys from common import submit usage = "USAGE: copy_hda_to_library_folder.py <base url> <api key> <hda id> <library id> <folder id> [ message ]" def copy_hda_to_library_folder(base_url, key, hda_id, library_id, folder_id, message=""): FILL_FUNC_BODYif __name__ == "__main__": num_arg...
#!/usr/bin/env python import sys from common import submit usage = "USAGE: copy_hda_to_library_folder.py <base url> <api key> <hda id> <library id> <folder id> [ message ]" def copy_hda_to_library_folder(base_url, key, hda_id, library_id, folder_id, message=""): FILL_FUNC_BODYif __name__ == "__main__": num_arg...
url = f"http://{base_url}/api/libraries/{library_id}/contents" payload = { "folder_id": folder_id, "create_type": "file", "from_hda_id": hda_id, } if message: payload.update(dict(ldda_message=message)) return submit(key, url, payload)
url = f"http://{base_url}/api/libraries/{library_id}/contents" payload = { "folder_id": folder_id, "create_type": "file", "from_hda_id": hda_id, } if message: payload.update(dict(ldda_message=message)) return submit(key, url, payload)
20
285
113
398
#!/usr/bin/env python import sys from common import submit usage = "USAGE: copy_hda_to_library_folder.py <base url> <api key> <hda id> <library id> <folder id> [ message ]" def copy_hda_to_library_folder(base_url, key, hda_id, library_id, folder_id, message=""): FILL_FUNC_BODYif __name__ == "__main__": num_arg...
#!/usr/bin/env python import sys from common import submit usage = "USAGE: copy_hda_to_library_folder.py <base url> <api key> <hda id> <library id> <folder id> [ message ]" def copy_hda_to_library_folder(base_url, key, hda_id, library_id, folder_id, message=""): FILL_FUNC_BODYif __name__ == "__main__": num_arg...
46,595
/home/hieuvd/dung_repo/raw/stars_03/galaxyproject_galaxy/galaxy
/home/hieuvd/dung_repo/raw/stars_03/galaxyproject_galaxy/galaxy/scripts/api/data_manager_example_execute.py
24,25
1,152
run_tool
25,49
25,49
#!/usr/bin/env python # Dan Blankenberg # Very simple example of using the API to run Data Managers # Script makes the naive assumption that dbkey==sequence id, which in many cases is not true nor desired # *** This script is not recommended for use as-is on a production server *** import optparse import time from url...
#!/usr/bin/env python # Dan Blankenberg # Very simple example of using the API to run Data Managers # Script makes the naive assumption that dbkey==sequence id, which in many cases is not true nor desired # *** This script is not recommended for use as-is on a production server *** import optparse import time from url...
sleep_time = sleep_time or DEFAULT_SLEEP_TIME tools_url = urljoin(galaxy_url, "api/tools") payload = { "tool_id": tool_id, } if history_id: payload["history_id"] = history_id payload["inputs"] = params rval = post(api_key, tools_url, payload) if wait: outputs = li...
sleep_time = sleep_time or DEFAULT_SLEEP_TIME tools_url = urljoin(galaxy_url, "api/tools") payload = { "tool_id": tool_id, } if history_id: payload["history_id"] = history_id payload["inputs"] = params rval = post(api_key, tools_url, payload) if wait: outputs = li...
60
1,438
262
1,700
#!/usr/bin/env python # Dan Blankenberg # Very simple example of using the API to run Data Managers # Script makes the naive assumption that dbkey==sequence id, which in many cases is not true nor desired # *** This script is not recommended for use as-is on a production server *** import optparse import time from url...
#!/usr/bin/env python # Dan Blankenberg # Very simple example of using the API to run Data Managers # Script makes the naive assumption that dbkey==sequence id, which in many cases is not true nor desired # *** This script is not recommended for use as-is on a production server *** import optparse import time from url...
46,596
/home/hieuvd/dung_repo/raw/stars_03/galaxyproject_galaxy/galaxy
/home/hieuvd/dung_repo/raw/stars_03/galaxyproject_galaxy/galaxy/scripts/api/fetch_to_library.py
8,9
1,29
main
9,27
9,27
import argparse import json import requests import yaml def main(): FILL_FUNC_BODYif __name__ == "__main__": main()
import argparse import json import requests import yaml def main(): FILL_FUNC_BODYif __name__ == "__main__": main()
parser = argparse.ArgumentParser(description="Upload a directory into a data library") parser.add_argument("-u", "--url", dest="url", required=True, help="Galaxy URL") parser.add_argument("-a", "--api", dest="api_key", required=True, help="API Key") parser.add_argument("target", metavar="FILE", type=str...
parser = argparse.ArgumentParser(description="Upload a directory into a data library") parser.add_argument("-u", "--url", dest="url", required=True, help="Galaxy URL") parser.add_argument("-a", "--api", dest="api_key", required=True, help="API Key") parser.add_argument("target", metavar="FILE", type=str...
68
46
302
348
import argparse import json import requests import yaml def main(): FILL_FUNC_BODYif __name__ == "__main__": main()
import argparse import json import requests import yaml def main(): FILL_FUNC_BODYif __name__ == "__main__": main()
46,597
/home/hieuvd/dung_repo/raw/stars_03/galaxyproject_galaxy/galaxy
/home/hieuvd/dung_repo/raw/stars_03/galaxyproject_galaxy/galaxy/scripts/api/library_upload_dir.py
21,22
10,149
prepopulate_memo
Uploader
34,52
22,52
class Uploader: def __init__(self, url, api, library_id, folder_id, should_link, non_local): self.gi = galaxy.GalaxyInstance(url=url, key=api) self.library_id = library_id self.folder_id = folder_id self.should_link = should_link self.non_local = non_local self.memo_...
class Uploader: def __init__(self, url, api, library_id, folder_id, should_link, non_local): self.gi = galaxy.GalaxyInstance(url=url, key=api) self.library_id = library_id self.folder_id = folder_id self.should_link = should_link self.non_local = non_local self.memo_...
existing = self.gi.libraries.show_library(self.library_id, contents=True) uploading_to = [x for x in existing if x["id"] == self.folder_id] if len(uploading_to) == 0: raise Exception(f"Unknown folder [{self.folder_id}] in library [{self.library_id}]") else: uploa...
""" Because the Galaxy Data Libraries API/system does not act like any other file system in existence, and allows multiple files/folders with identical names in the same parent directory, we have to prepopulate the memoization cache with everything currently in the target ...
63
1,461
250
1,711
#!/usr/bin/env python import argparse import os import sys from bioblend import galaxy class Uploader: def __init__(self, url, api, library_id, folder_id, should_link, non_local): self.gi = galaxy.GalaxyInstance(url=url, key=api) self.library_id = library_id self.folder_id = folder_id ...
#!/usr/bin/env python import argparse import os import sys from bioblend import galaxy class Uploader: def __init__(self, url, api, library_id, folder_id, should_link, non_local): self.gi = galaxy.GalaxyInstance(url=url, key=api) self.library_id = library_id self.folder_id = folder_id ...
46,598
/home/hieuvd/dung_repo/raw/stars_03/galaxyproject_galaxy/galaxy
/home/hieuvd/dung_repo/raw/stars_03/galaxyproject_galaxy/galaxy/scripts/api/reset_metadata_on_installed_repositories.py
16,17
1,30
main
17,22
17,22
#!/usr/bin/env python """ Script to reset metadata on all Tool Shed repositories installed into a Galaxy instance. The received API key must be associated with a Galaxy admin user. usage: reset_metadata_on_installed_repositories.py key Here is a working example of how to use this script. python ./reset_metadata_on_i...
#!/usr/bin/env python """ Script to reset metadata on all Tool Shed repositories installed into a Galaxy instance. The received API key must be associated with a Galaxy admin user. usage: reset_metadata_on_installed_repositories.py key Here is a working example of how to use this script. python ./reset_metadata_on_i...
base_galaxy_url = options.galaxy_url.rstrip("/") url = f"{base_galaxy_url}/api/tool_shed_repositories/reset_metadata_on_installed_repositories" submit(options.api, url, {})
base_galaxy_url = options.galaxy_url.rstrip("/") url = f"{base_galaxy_url}/api/tool_shed_repositories/reset_metadata_on_installed_repositories" submit(options.api, url, {})
9
266
76
342
#!/usr/bin/env python """ Script to reset metadata on all Tool Shed repositories installed into a Galaxy instance. The received API key must be associated with a Galaxy admin user. usage: reset_metadata_on_installed_repositories.py key Here is a working example of how to use this script. python ./reset_metadata_on_i...
#!/usr/bin/env python """ Script to reset metadata on all Tool Shed repositories installed into a Galaxy instance. The received API key must be associated with a Galaxy admin user. usage: reset_metadata_on_installed_repositories.py key Here is a working example of how to use this script. python ./reset_metadata_on_i...
46,599
/home/hieuvd/dung_repo/raw/stars_03/galaxyproject_galaxy/galaxy
/home/hieuvd/dung_repo/raw/stars_03/galaxyproject_galaxy/galaxy/scripts/api/search.py
16,17
11,33
get
RemoteGalaxy
17,23
17,23
class RemoteGalaxy: def __init__(self, url, api_key): self.url = url self.api_key = api_key def get(self, path): FILL_FUNC_BODY def post(self, path, payload): c_url = self.url + path params = {} params["key"] = self.api_key req = requests.post( c_u...
class RemoteGalaxy: def __init__(self, url, api_key): self.url = url self.api_key = api_key def get(self, path): FILL_FUNC_BODY def post(self, path, payload): c_url = self.url + path params = {} params["key"] = self.api_key req = requests.post( c_u...
c_url = self.url + path params = {} params["key"] = self.api_key req = requests.get(c_url, params=params) return req.json()
c_url = self.url + path params = {} params["key"] = self.api_key req = requests.get(c_url, params=params) return req.json()
17
149
58
207
""" Sample script for Galaxy Search API """ import json import sys import requests class RemoteGalaxy: def __init__(self, url, api_key): self.url = url self.api_key = api_key def get(self, path): FILL_FUNC_BODY def post(self, path, payload): c_url = self.url + path params...
""" Sample script for Galaxy Search API """ import json import sys import requests class RemoteGalaxy: def __init__(self, url, api_key): self.url = url self.api_key = api_key def get(self, path): FILL_FUNC_BODY def post(self, path, payload): c_url = self.url + path params...
46,600
/home/hieuvd/dung_repo/raw/stars_03/galaxyproject_galaxy/galaxy
/home/hieuvd/dung_repo/raw/stars_03/galaxyproject_galaxy/galaxy/scripts/api/upload_to_history.py
20,21
1,58
upload_file
21,45
21,45
#!/usr/bin/env python """ Upload a file to the desired history. """ import json import os import sys try: import requests except ImportError: print( "Could not import the requests module. See http://docs.python-requests.org/en/latest/" " or install with 'pip install requests'" ) raise ...
#!/usr/bin/env python """ Upload a file to the desired history. """ import json import os import sys try: import requests except ImportError: print( "Could not import the requests module. See http://docs.python-requests.org/en/latest/" " or install with 'pip install requests'" ) raise ...
full_url = base_url + "/api/tools" payload = { "key": api_key, "tool_id": "upload1", "history_id": history_id, } inputs = { "files_0|NAME": kwargs.get("filename", os.path.basename(filepath)), "files_0|type": "upload_dataset", # TODO: the following doesn't...
full_url = base_url + "/api/tools" payload = { "key": api_key, "tool_id": "upload1", "history_id": history_id, } inputs = { "files_0|NAME": kwargs.get("filename", os.path.basename(filepath)), "files_0|type": "upload_dataset", # TODO: the following doesn't...
61
325
271
596
#!/usr/bin/env python """ Upload a file to the desired history. """ import json import os import sys try: import requests except ImportError: print( "Could not import the requests module. See http://docs.python-requests.org/en/latest/" " or install with 'pip install requests'" ) raise ...
#!/usr/bin/env python """ Upload a file to the desired history. """ import json import os import sys try: import requests except ImportError: print( "Could not import the requests module. See http://docs.python-requests.org/en/latest/" " or install with 'pip install requests'" ) raise ...
46,601
/home/hieuvd/dung_repo/raw/stars_03/galaxyproject_galaxy/galaxy
/home/hieuvd/dung_repo/raw/stars_03/galaxyproject_galaxy/galaxy/scripts/api/workflow_execute.py
15,16
1,34
main
16,32
16,32
#!/usr/bin/env python """ Execute workflows from the command line. Example calls: python workflow_execute.py <api_key> <galaxy_url>/api/workflows f2db41e1fa331b3e 'Test API History' '38=ldda=0qr350234d2d192f' python workflow_execute.py <api_key> <galaxy_url>/api/workflows f2db41e1fa331b3e 'hist_id=a912e9e5d84530d4' '38...
#!/usr/bin/env python """ Execute workflows from the command line. Example calls: python workflow_execute.py <api_key> <galaxy_url>/api/workflows f2db41e1fa331b3e 'Test API History' '38=ldda=0qr350234d2d192f' python workflow_execute.py <api_key> <galaxy_url>/api/workflows f2db41e1fa331b3e 'hist_id=a912e9e5d84530d4' '38...
try: data = {} data["workflow_id"] = sys.argv[3] data["history"] = sys.argv[4] data["ds_map"] = {} # DBTODO If only one input is given, don't require a step # mapping, just use it for everything? for v in sys.argv[5:]: step, src, ds_id = v.split("=...
try: data = {} data["workflow_id"] = sys.argv[3] data["history"] = sys.argv[4] data["ds_map"] = {} # DBTODO If only one input is given, don't require a step # mapping, just use it for everything? for v in sys.argv[5:]: step, src, ds_id = v.split("=...
60
216
223
439
#!/usr/bin/env python """ Execute workflows from the command line. Example calls: python workflow_execute.py <api_key> <galaxy_url>/api/workflows f2db41e1fa331b3e 'Test API History' '38=ldda=0qr350234d2d192f' python workflow_execute.py <api_key> <galaxy_url>/api/workflows f2db41e1fa331b3e 'hist_id=a912e9e5d84530d4' '38...
#!/usr/bin/env python """ Execute workflows from the command line. Example calls: python workflow_execute.py <api_key> <galaxy_url>/api/workflows f2db41e1fa331b3e 'Test API History' '38=ldda=0qr350234d2d192f' python workflow_execute.py <api_key> <galaxy_url>/api/workflows f2db41e1fa331b3e 'hist_id=a912e9e5d84530d4' '38...
46,602
/home/hieuvd/dung_repo/raw/stars_03/galaxyproject_galaxy/galaxy
/home/hieuvd/dung_repo/raw/stars_03/galaxyproject_galaxy/galaxy/scripts/api/workflow_execute_parameters.py
19,20
1,56
main
20,54
20,54
#!/usr/bin/env python """ # ---------------------------------------------- # # PARKLAB, Author: RPARK # ---------------------------------------------- # Execute workflows from the command line. Example calls: python workflow_execute.py <api_key> <galaxy_url>/api/workflows <workflow_id> 'hist_id=<history_id>' '38=hda=<...
#!/usr/bin/env python """ # ---------------------------------------------- # # PARKLAB, Author: RPARK # ---------------------------------------------- # Execute workflows from the command line. Example calls: python workflow_execute.py <api_key> <galaxy_url>/api/workflows <workflow_id> 'hist_id=<history_id>' '38=hda=<...
try: print("workflow_execute:py:") data = {} data["workflow_id"] = sys.argv[3] data["history"] = sys.argv[4] data["ds_map"] = {} # Trying to pass in parameter for my own dictionary data["parameters"] = {} # DBTODO If only one input is given, don't re...
try: print("workflow_execute:py:") data = {} data["workflow_id"] = sys.argv[3] data["history"] = sys.argv[4] data["ds_map"] = {} # Trying to pass in parameter for my own dictionary data["parameters"] = {} # DBTODO If only one input is given, don't re...
101
299
374
673
#!/usr/bin/env python """ # ---------------------------------------------- # # PARKLAB, Author: RPARK # ---------------------------------------------- # Execute workflows from the command line. Example calls: python workflow_execute.py <api_key> <galaxy_url>/api/workflows <workflow_id> 'hist_id=<history_id>' '38=hda=<...
#!/usr/bin/env python """ # ---------------------------------------------- # # PARKLAB, Author: RPARK # ---------------------------------------------- # Execute workflows from the command line. Example calls: python workflow_execute.py <api_key> <galaxy_url>/api/workflows <workflow_id> 'hist_id=<history_id>' '38=hda=<...
46,603
/home/hieuvd/dung_repo/raw/stars_03/galaxyproject_galaxy/galaxy
/home/hieuvd/dung_repo/raw/stars_03/galaxyproject_galaxy/galaxy/scripts/api/workflow_import.py
14,15
1,31
main
15,29
15,29
#!/usr/bin/env python """ Import workflows from the command line. Example calls: python workflow_import.py <api_key> <galaxy_url> '/path/to/workflow/file [--add_to_menu]' """ import os import sys from common import submit def main(): FILL_FUNC_BODYif __name__ == "__main__": main()
#!/usr/bin/env python """ Import workflows from the command line. Example calls: python workflow_import.py <api_key> <galaxy_url> '/path/to/workflow/file [--add_to_menu]' """ import os import sys from common import submit def main(): FILL_FUNC_BODYif __name__ == "__main__": main()
api_key = sys.argv[1] api_base_url = sys.argv[2] api_url = f"{api_base_url}/api/workflows" try: data = {} data["installed_repository_file"] = sys.argv[3] if len(sys.argv) > 4 and sys.argv[4] == "--add_to_menu": data["add_to_menu"] = True except IndexError: ...
api_key = sys.argv[1] api_base_url = sys.argv[2] api_url = f"{api_base_url}/api/workflows" try: data = {} data["installed_repository_file"] = sys.argv[3] if len(sys.argv) > 4 and sys.argv[4] == "--add_to_menu": data["add_to_menu"] = True except IndexError: ...
39
104
200
304
#!/usr/bin/env python """ Import workflows from the command line. Example calls: python workflow_import.py <api_key> <galaxy_url> '/path/to/workflow/file [--add_to_menu]' """ import os import sys from common import submit def main(): FILL_FUNC_BODYif __name__ == "__main__": main()
#!/usr/bin/env python """ Import workflows from the command line. Example calls: python workflow_import.py <api_key> <galaxy_url> '/path/to/workflow/file [--add_to_menu]' """ import os import sys from common import submit def main(): FILL_FUNC_BODYif __name__ == "__main__": main()
46,604
/home/hieuvd/dung_repo/raw/stars_03/galaxyproject_galaxy/galaxy
/home/hieuvd/dung_repo/raw/stars_03/galaxyproject_galaxy/galaxy/scripts/api/workflow_import_from_file_rpark.py
14,15
1,33
openWorkflow
15,20
15,20
#!/usr/bin/env python """ python rpark_import_workflow_from_file.py 35a24ae2643785ff3d046c98ea362c7f http://localhost:8080/api/workflows/import 'spp_submodule.ga' python rpark_import_workflow_from_file.py 35a24ae2643785ff3d046c98ea362c7f http://localhost:8080/api/workflows/import 'spp_submodule.ga' """ import json imp...
#!/usr/bin/env python """ python rpark_import_workflow_from_file.py 35a24ae2643785ff3d046c98ea362c7f http://localhost:8080/api/workflows/import 'spp_submodule.ga' python rpark_import_workflow_from_file.py 35a24ae2643785ff3d046c98ea362c7f http://localhost:8080/api/workflows/import 'spp_submodule.ga' """ import json imp...
with open(in_file) as f: temp_data = json.load(f) return temp_data
with open(in_file) as f: temp_data = json.load(f) return temp_data
9
312
37
349
#!/usr/bin/env python """ python rpark_import_workflow_from_file.py 35a24ae2643785ff3d046c98ea362c7f http://localhost:8080/api/workflows/import 'spp_submodule.ga' python rpark_import_workflow_from_file.py 35a24ae2643785ff3d046c98ea362c7f http://localhost:8080/api/workflows/import 'spp_submodule.ga' """ import json imp...
#!/usr/bin/env python """ python rpark_import_workflow_from_file.py 35a24ae2643785ff3d046c98ea362c7f http://localhost:8080/api/workflows/import 'spp_submodule.ga' python rpark_import_workflow_from_file.py 35a24ae2643785ff3d046c98ea362c7f http://localhost:8080/api/workflows/import 'spp_submodule.ga' """ import json imp...
46,605
/home/hieuvd/dung_repo/raw/stars_03/galaxyproject_galaxy/galaxy
/home/hieuvd/dung_repo/raw/stars_03/galaxyproject_galaxy/galaxy/scripts/auth/pam_auth_helper.py
18,19
1,42
handle_timeout
19,23
19,23
#!/usr/bin/env python import logging import signal import sys log = logging.getLogger(__name__) TIMEOUT = 5 try: import pam except ImportError: log.debug("PAM auth helper: Could not import pam module") sys.exit(1) def handle_timeout(signum, stack): FILL_FUNC_BODYsignal.alarm(TIMEOUT) pam_service = sy...
#!/usr/bin/env python import logging import signal import sys log = logging.getLogger(__name__) TIMEOUT = 5 try: import pam except ImportError: log.debug("PAM auth helper: Could not import pam module") sys.exit(1) def handle_timeout(signum, stack): FILL_FUNC_BODYsignal.alarm(TIMEOUT) pam_service = sy...
raise OSError("Timed out reading input") # set timeout so we don't block on reading stdin
raise OSError("Timed out reading input") # set timeout so we don't block on reading stdin
15
304
33
337
#!/usr/bin/env python import logging import signal import sys log = logging.getLogger(__name__) TIMEOUT = 5 try: import pam except ImportError: log.debug("PAM auth helper: Could not import pam module") sys.exit(1) def handle_timeout(signum, stack): FILL_FUNC_BODYsignal.alarm(TIMEOUT) pam_service = sy...
#!/usr/bin/env python import logging import signal import sys log = logging.getLogger(__name__) TIMEOUT = 5 try: import pam except ImportError: log.debug("PAM auth helper: Could not import pam module") sys.exit(1) def handle_timeout(signum, stack): FILL_FUNC_BODYsignal.alarm(TIMEOUT) pam_service = sy...
46,606
/home/hieuvd/dung_repo/raw/stars_03/galaxyproject_galaxy/galaxy
/home/hieuvd/dung_repo/raw/stars_03/galaxyproject_galaxy/galaxy/scripts/check_python.py
11,12
1,35
check_python
12,30
12,30
""" If the current installed Python version is not supported, prints an error message to stderr and returns 1 """ from __future__ import print_function # noqa: UP010 import sys def check_python(): FILL_FUNC_BODYif __name__ == "__main__": try: check_python() except Exception: sys.exit(1)
""" If the current installed Python version is not supported, prints an error message to stderr and returns 1 """ from __future__ import print_function # noqa: UP010 import sys def check_python(): FILL_FUNC_BODYif __name__ == "__main__": try: check_python() except Exception: sys.exit(1)
if sys.version_info[:2] >= (3, 8): # noqa: UP036 # supported return else: version_string = ".".join(str(_) for _ in sys.version_info[:3]) msg = ( """ERROR: Your Python version is: %s Galaxy is currently supported on Python >=3.8 . To run Galaxy, please install a supp...
if sys.version_info[:2] >= (3, 8): # noqa: UP036 # supported return else: version_string = ".".join(str(_) for _ in sys.version_info[:3]) msg = ( """ERROR: Your Python version is: %s Galaxy is currently supported on Python >=3.8 . To run Galaxy, please install a supp...
80
103
213
316
""" If the current installed Python version is not supported, prints an error message to stderr and returns 1 """ from __future__ import print_function # noqa: UP010 import sys def check_python(): FILL_FUNC_BODYif __name__ == "__main__": try: check_python() except Exception: sys.exit(1)
""" If the current installed Python version is not supported, prints an error message to stderr and returns 1 """ from __future__ import print_function # noqa: UP010 import sys def check_python(): FILL_FUNC_BODYif __name__ == "__main__": try: check_python() except Exception: sys.exit(1)
46,607
/home/hieuvd/dung_repo/raw/stars_03/galaxyproject_galaxy/galaxy
/home/hieuvd/dung_repo/raw/stars_03/galaxyproject_galaxy/galaxy/scripts/config_sample_to_kwalify.py
37,38
1,71
_dump_option
38,69
38,69
import sys def main(): """Entry point for conversion procedure.""" found_app_main = False current_section_desc = [] current_section_options = [] try: sample = sys.argv[1] except KeyError: sample = "config/galaxy.ini.sample" for line in open(sample): is_app_main = l...
import sys def main(): """Entry point for conversion procedure.""" found_app_main = False current_section_desc = [] current_section_options = [] try: sample = sys.argv[1] except KeyError: sample = "config/galaxy.ini.sample" for line in open(sample): is_app_main = l...
def print_line(line): print((" " * 6) + line) if "=" not in option: print(option) key, default = (s.strip() for s in option.split("=", 1)) key = key[1:] # strip # if default.strip().lower() in ["true", "false"]: default = default.lower() type = "bool" elif defau...
def print_line(line): print((" " * 6) + line) if "=" not in option: print(option) key, default = (s.strip() for s in option.split("=", 1)) key = key[1:] # strip # if default.strip().lower() in ["true", "false"]: default = default.lower() type = "bool" elif defau...
89
338
306
644
import sys def main(): """Entry point for conversion procedure.""" found_app_main = False current_section_desc = [] current_section_options = [] try: sample = sys.argv[1] except KeyError: sample = "config/galaxy.ini.sample" for line in open(sample): is_app_main = l...
import sys def main(): """Entry point for conversion procedure.""" found_app_main = False current_section_desc = [] current_section_options = [] try: sample = sys.argv[1] except KeyError: sample = "config/galaxy.ini.sample" for line in open(sample): is_app_main = l...
46,609
/home/hieuvd/dung_repo/raw/stars_03/galaxyproject_galaxy/galaxy
/home/hieuvd/dung_repo/raw/stars_03/galaxyproject_galaxy/galaxy/scripts/external_chown_script.py
40,41
1,52
main
41,50
41,50
#!/usr/bin/env python import os import subprocess import sys # you may configure the paths below which modifications are allowed. # should contain the full paths to job_working_directory and new_file_path. # if set to None every file can be modified by the script. # this can increase security in particular if write ac...
#!/usr/bin/env python import os import subprocess import sys # you may configure the paths below which modifications are allowed. # should contain the full paths to job_working_directory and new_file_path. # if set to None every file can be modified by the script. # this can increase security in particular if write ac...
path, galaxy_user_name, gid = validate_parameters() for cmd in [["chown", "-Rh", galaxy_user_name, path], ["chgrp", "-Rh", gid, path]]: p = subprocess.Popen(cmd, shell=False, stdout=subprocess.PIPE, stderr=subprocess.PIPE) (stdoutdata, stderrdata) = p.communicate() exitcode = p.returncod...
path, galaxy_user_name, gid = validate_parameters() for cmd in [["chown", "-Rh", galaxy_user_name, path], ["chgrp", "-Rh", gid, path]]: p = subprocess.Popen(cmd, shell=False, stdout=subprocess.PIPE, stderr=subprocess.PIPE) (stdoutdata, stderrdata) = p.communicate() exitcode = p.returncod...
40
371
166
537
#!/usr/bin/env python import os import subprocess import sys # you may configure the paths below which modifications are allowed. # should contain the full paths to job_working_directory and new_file_path. # if set to None every file can be modified by the script. # this can increase security in particular if write ac...
#!/usr/bin/env python import os import subprocess import sys # you may configure the paths below which modifications are allowed. # should contain the full paths to job_working_directory and new_file_path. # if set to None every file can be modified by the script. # this can increase security in particular if write ac...
46,610
/home/hieuvd/dung_repo/raw/stars_03/galaxyproject_galaxy/galaxy
/home/hieuvd/dung_repo/raw/stars_03/galaxyproject_galaxy/galaxy/scripts/extract_toolbox_sections.py
99,100
1,136
addToToolDict
100,117
100,117
import os from collections import defaultdict from xml.etree import ElementTree as ET # Todo: "" # execute from galaxy root dir tooldict = defaultdict(list) def main(): doc = ET.parse("tool_conf.xml") root = doc.getroot() # index range 1-1000, current sections/tools divided between 250-750 sectioni...
import os from collections import defaultdict from xml.etree import ElementTree as ET # Todo: "" # execute from galaxy root dir tooldict = defaultdict(list) def main(): doc = ET.parse("tool_conf.xml") root = doc.getroot() # index range 1-1000, current sections/tools divided between 250-750 sectioni...
toolfile = tool.attrib["file"] realtoolfile = os.path.join(os.getcwd(), "tools", toolfile) # define attributes for the toolboxposition xml-tag attribdict = {} if sectionname: attribdict["section"] = sectionname if currentlabel: attribdict["label"] = currentlabel if sectionin...
toolfile = tool.attrib["file"] realtoolfile = os.path.join(os.getcwd(), "tools", toolfile) # define attributes for the toolboxposition xml-tag attribdict = {} if sectionname: attribdict["section"] = sectionname if currentlabel: attribdict["label"] = currentlabel if sectionin...
52
1,223
182
1,405
import os from collections import defaultdict from xml.etree import ElementTree as ET # Todo: "" # execute from galaxy root dir tooldict = defaultdict(list) def main(): doc = ET.parse("tool_conf.xml") root = doc.getroot() # index range 1-1000, current sections/tools divided between 250-750 sectioni...
import os from collections import defaultdict from xml.etree import ElementTree as ET # Todo: "" # execute from galaxy root dir tooldict = defaultdict(list) def main(): doc = ET.parse("tool_conf.xml") root = doc.getroot() # index range 1-1000, current sections/tools divided between 250-750 sectioni...
46,611
/home/hieuvd/dung_repo/raw/stars_03/galaxyproject_galaxy/galaxy
/home/hieuvd/dung_repo/raw/stars_03/galaxyproject_galaxy/galaxy/scripts/grt/upload.py
18,19
1,79
main
19,77
19,77
#!/usr/bin/env python """Script for submitting Galaxy job information to the Galactic Radio Telescope. See doc/source/admin/grt.rst for more detailed usage information. """ import argparse import logging import os import sys import requests import yaml sample_config = os.path.abspath(os.path.join(os.path.dirname(__f...
#!/usr/bin/env python """Script for submitting Galaxy job information to the Galactic Radio Telescope. See doc/source/admin/grt.rst for more detailed usage information. """ import argparse import logging import os import sys import requests import yaml sample_config = os.path.abspath(os.path.join(os.path.dirname(__f...
parser = argparse.ArgumentParser() parser = argparse.ArgumentParser(formatter_class=argparse.ArgumentDefaultsHelpFormatter) parser.add_argument( "-r", "--report-directory", help="Directory in which reports are stored", default=os.path.abspath(os.path.join(".", "reports")), ...
parser = argparse.ArgumentParser() parser = argparse.ArgumentParser(formatter_class=argparse.ArgumentDefaultsHelpFormatter) parser.add_argument( "-r", "--report-directory", help="Directory in which reports are stored", default=os.path.abspath(os.path.join(".", "reports")), ...
189
182
809
991
#!/usr/bin/env python """Script for submitting Galaxy job information to the Galactic Radio Telescope. See doc/source/admin/grt.rst for more detailed usage information. """ import argparse import logging import os import sys import requests import yaml sample_config = os.path.abspath(os.path.join(os.path.dirname(__f...
#!/usr/bin/env python """Script for submitting Galaxy job information to the Galactic Radio Telescope. See doc/source/admin/grt.rst for more detailed usage information. """ import argparse import logging import os import sys import requests import yaml sample_config = os.path.abspath(os.path.join(os.path.dirname(__f...
46,614
/home/hieuvd/dung_repo/raw/stars_03/galaxyproject_galaxy/galaxy
/home/hieuvd/dung_repo/raw/stars_03/galaxyproject_galaxy/galaxy/scripts/microbes/util.py
101,102
40,109
get_features_by_type
GenBankFeatureParser
102,109
102,109
class GenBankFeatureParser: """Parses Features from Single Locus GenBank file""" def __init__(self, fh): self.fh = fh self.features = {} fh.seek(0) in_features = False last_feature_name = None base_indent = 0 last_attr_name = None for line in fh: ...
class GenBankFeatureParser: """Parses Features from Single Locus GenBank file""" def __init__(self, fh): self.fh = fh self.features = {} fh.seek(0) in_features = False last_feature_name = None base_indent = 0 last_attr_name = None for line in fh: ...
if feature_type not in self.features: return [] else: return self.features[feature_type] # Parse A GenBank file and return arrays of BED regions for the corresponding features
if feature_type not in self.features: return [] else: return self.features[feature_type] # Parse A GenBank file and return arrays of BED regions for the corresponding features
25
766
60
826
#!/usr/bin/env python # Dan Blankenberg import sys assert sys.version_info[:2] >= (2, 4) # genbank_to_bed class Region: def __init__(self): self.qualifiers = {} self.start = None self.end = None self.strand = "+" def set_coordinates_by_location(self, location): locat...
#!/usr/bin/env python # Dan Blankenberg import sys assert sys.version_info[:2] >= (2, 4) # genbank_to_bed class Region: def __init__(self): self.qualifiers = {} self.start = None self.end = None self.strand = "+" def set_coordinates_by_location(self, location): locat...
46,615
/home/hieuvd/dung_repo/raw/stars_03/galaxyproject_galaxy/galaxy
/home/hieuvd/dung_repo/raw/stars_03/galaxyproject_galaxy/galaxy/scripts/microbes/util.py
17,18
10,40
set_coordinates_by_location
Region
18,40
18,40
class Region: def __init__(self): self.qualifiers = {} self.start = None self.end = None self.strand = "+" def set_coordinates_by_location(self, location): FILL_FUNC_BODY
class Region: def __init__(self): self.qualifiers = {} self.start = None self.end = None self.strand = "+" def set_coordinates_by_location(self, location): FILL_FUNC_BODY
location = location.strip().lower().replace("..", ",") if "complement(" in location: # if part of the sequence is on the negative strand, it all is? self.strand = "-" # default of + strand for remove_text in ["join(", "order(", "complement(", ")"]: location = location.r...
location = location.strip().lower().replace("..", ",") if "complement(" in location: # if part of the sequence is on the negative strand, it all is? self.strand = "-" # default of + strand for remove_text in ["join(", "order(", "complement(", ")"]: location = location.r...
116
71
334
405
#!/usr/bin/env python # Dan Blankenberg import sys assert sys.version_info[:2] >= (2, 4) # genbank_to_bed class Region: def __init__(self): self.qualifiers = {} self.start = None self.end = None self.strand = "+" def set_coordinates_by_location(self, location): FILL_FUNC_BOD...
#!/usr/bin/env python # Dan Blankenberg import sys assert sys.version_info[:2] >= (2, 4) # genbank_to_bed class Region: def __init__(self): self.qualifiers = {} self.start = None self.end = None self.strand = "+" def set_coordinates_by_location(self, location): FILL_FUNC_BOD...
46,616
/home/hieuvd/dung_repo/raw/stars_03/galaxyproject_galaxy/galaxy
/home/hieuvd/dung_repo/raw/stars_03/galaxyproject_galaxy/galaxy/scripts/mypy_config_utils.py
14,15
1,47
main
15,32
15,32
import configparser import os from dataclasses import dataclass from typing import Optional @dataclass class MyPyEntry: section_name: str package_name: str target: str def main(): FILL_FUNC_BODYdef to_python_path(package_name: str) -> Optional[str]: path = os.path.join("lib", package_name.replace("....
import configparser import os from dataclasses import dataclass from typing import Optional @dataclass class MyPyEntry: section_name: str package_name: str target: str def main(): FILL_FUNC_BODYdef to_python_path(package_name: str) -> Optional[str]: path = os.path.join("lib", package_name.replace("....
config = configparser.ConfigParser() config.read("./mypy.ini") for section in config.sections(): if not section.startswith("mypy-"): continue section_name = section package_name = section[len("mypy-") :] if not (package_name.startswith("galaxy.") or package_name.s...
config = configparser.ConfigParser() config.read("./mypy.ini") for section in config.sections(): if not section.startswith("mypy-"): continue section_name = section package_name = section[len("mypy-") :] if not (package_name.startswith("galaxy.") or package_name.s...
55
212
208
420
import configparser import os from dataclasses import dataclass from typing import Optional @dataclass class MyPyEntry: section_name: str package_name: str target: str def main(): FILL_FUNC_BODYdef to_python_path(package_name: str) -> Optional[str]: path = os.path.join("lib", package_name.replace("....
import configparser import os from dataclasses import dataclass from typing import Optional @dataclass class MyPyEntry: section_name: str package_name: str target: str def main(): FILL_FUNC_BODYdef to_python_path(package_name: str) -> Optional[str]: path = os.path.join("lib", package_name.replace("....
46,617
/home/hieuvd/dung_repo/raw/stars_03/galaxyproject_galaxy/galaxy
/home/hieuvd/dung_repo/raw/stars_03/galaxyproject_galaxy/galaxy/scripts/plugin_staging.py
8,9
1,37
stage_static
9,30
9,30
import glob import os import shutil GXY_ROOT = os.path.abspath(os.path.join(os.path.dirname(os.path.realpath(__file__)), os.pardir)) def stage_static(f): FILL_FUNC_BODYif __name__ == "__main__": # This is not awesome, but it's temporary, and it supports two-tier plugin static. for f in glob.glob(os.path.join...
import glob import os import shutil GXY_ROOT = os.path.abspath(os.path.join(os.path.dirname(os.path.realpath(__file__)), os.pardir)) def stage_static(f): FILL_FUNC_BODYif __name__ == "__main__": # This is not awesome, but it's temporary, and it supports two-tier plugin static. for f in glob.glob(os.path.join...
src = os.path.join(GXY_ROOT, "config/plugins", f) dest = os.path.join(GXY_ROOT, "static/plugins", f) dest_parent = os.path.abspath(os.path.join(dest, os.pardir)) if os.path.lexists(dest): # We have to clear out the old staged or linked static to relink. if os.path.islink(dest): ...
src = os.path.join(GXY_ROOT, "config/plugins", f) dest = os.path.join(GXY_ROOT, "static/plugins", f) dest_parent = os.path.abspath(os.path.join(dest, os.pardir)) if os.path.lexists(dest): # We have to clear out the old staged or linked static to relink. if os.path.islink(dest): ...
55
211
257
468
import glob import os import shutil GXY_ROOT = os.path.abspath(os.path.join(os.path.dirname(os.path.realpath(__file__)), os.pardir)) def stage_static(f): FILL_FUNC_BODYif __name__ == "__main__": # This is not awesome, but it's temporary, and it supports two-tier plugin static. for f in glob.glob(os.path.join...
import glob import os import shutil GXY_ROOT = os.path.abspath(os.path.join(os.path.dirname(os.path.realpath(__file__)), os.pardir)) def stage_static(f): FILL_FUNC_BODYif __name__ == "__main__": # This is not awesome, but it's temporary, and it supports two-tier plugin static. for f in glob.glob(os.path.join...
46,618
/home/hieuvd/dung_repo/raw/stars_03/galaxyproject_galaxy/galaxy
/home/hieuvd/dung_repo/raw/stars_03/galaxyproject_galaxy/galaxy/scripts/release-diff.py
93,94
1,180
report_diff
94,126
94,126
#!/usr/bin/env python import argparse import glob import subprocess from pathlib import Path import yaml def flatten(d, path): """ Flatten a dictionary into ('some/path/to/key', value) >>> flatten({'a': {'b': 2}, 'q': 3}, []) [('a.b', 2), ('q', 3)] """ if isinstance(d, dict): for k,...
#!/usr/bin/env python import argparse import glob import subprocess from pathlib import Path import yaml def flatten(d, path): """ Flatten a dictionary into ('some/path/to/key', value) >>> flatten({'a': {'b': 2}, 'q': 3}, []) [('a.b', 2), ('q', 3)] """ if isinstance(d, dict): for k,...
# Print out report if added or changed or removed: print("Configuration Changes") print("=====================") print() if added: _report_dict("Added", "The following configuration options are new", added, lambda x: f"- {x}") if changed: _report_dict( ...
# Print out report if added or changed or removed: print("Configuration Changes") print("=====================") print() if added: _report_dict("Added", "The following configuration options are new", added, lambda x: f"- {x}") if changed: _report_dict( ...
93
1,309
319
1,628
#!/usr/bin/env python import argparse import glob import subprocess from pathlib import Path import yaml def flatten(d, path): """ Flatten a dictionary into ('some/path/to/key', value) >>> flatten({'a': {'b': 2}, 'q': 3}, []) [('a.b', 2), ('q', 3)] """ if isinstance(d, dict): for k,...
#!/usr/bin/env python import argparse import glob import subprocess from pathlib import Path import yaml def flatten(d, path): """ Flatten a dictionary into ('some/path/to/key', value) >>> flatten({'a': {'b': 2}, 'q': 3}, []) [('a.b', 2), ('q', 3)] """ if isinstance(d, dict): for k,...
46,619
/home/hieuvd/dung_repo/raw/stars_03/galaxyproject_galaxy/galaxy
/home/hieuvd/dung_repo/raw/stars_03/galaxyproject_galaxy/galaxy/scripts/release-diff.py
31,32
30,35
include
MockOrderedLoader
32,35
32,35
class MockOrderedLoader(yaml.SafeLoader): def include(self, node): FILL_FUNC_BODY
class MockOrderedLoader(yaml.SafeLoader): def include(self, node): FILL_FUNC_BODY
return {}
return {}
2
32
9
41
#!/usr/bin/env python import argparse import glob import subprocess from pathlib import Path import yaml def flatten(d, path): """ Flatten a dictionary into ('some/path/to/key', value) >>> flatten({'a': {'b': 2}, 'q': 3}, []) [('a.b', 2), ('q', 3)] """ if isinstance(d, dict): for k,...
#!/usr/bin/env python import argparse import glob import subprocess from pathlib import Path import yaml def flatten(d, path): """ Flatten a dictionary into ('some/path/to/key', value) >>> flatten({'a': {'b': 2}, 'q': 3}, []) [('a.b', 2), ('q', 3)] """ if isinstance(d, dict): for k,...
46,620
/home/hieuvd/dung_repo/raw/stars_03/galaxyproject_galaxy/galaxy
/home/hieuvd/dung_repo/raw/stars_03/galaxyproject_galaxy/galaxy/scripts/slideshow/build_slideshow.py
10,11
1,30
main
11,28
11,28
import os import string import sys SCRIPTS_DIRECTORY = os.path.dirname(__file__) TEMPLATE_PATH = os.path.join(SCRIPTS_DIRECTORY, "slideshow_template.html") TEMPLATE = string.Template(open(TEMPLATE_PATH).read()) def main(argv=None): FILL_FUNC_BODYif __name__ == "__main__": main()
import os import string import sys SCRIPTS_DIRECTORY = os.path.dirname(__file__) TEMPLATE_PATH = os.path.join(SCRIPTS_DIRECTORY, "slideshow_template.html") TEMPLATE = string.Template(open(TEMPLATE_PATH).read()) def main(argv=None): FILL_FUNC_BODYif __name__ == "__main__": main()
if argv is None: argv = sys.argv title = argv[1] markdown_source = argv[2] output = os.path.splitext(markdown_source)[0] + ".html" with open(markdown_source) as s: content = s.read() html = TEMPLATE.safe_substitute( **{ "title": title, "content": c...
if argv is None: argv = sys.argv title = argv[1] markdown_source = argv[2] output = os.path.splitext(markdown_source)[0] + ".html" with open(markdown_source) as s: content = s.read() html = TEMPLATE.safe_substitute( **{ "title": title, "content": c...
38
116
158
274
import os import string import sys SCRIPTS_DIRECTORY = os.path.dirname(__file__) TEMPLATE_PATH = os.path.join(SCRIPTS_DIRECTORY, "slideshow_template.html") TEMPLATE = string.Template(open(TEMPLATE_PATH).read()) def main(argv=None): FILL_FUNC_BODYif __name__ == "__main__": main()
import os import string import sys SCRIPTS_DIRECTORY = os.path.dirname(__file__) TEMPLATE_PATH = os.path.join(SCRIPTS_DIRECTORY, "slideshow_template.html") TEMPLATE = string.Template(open(TEMPLATE_PATH).read()) def main(argv=None): FILL_FUNC_BODYif __name__ == "__main__": main()
46,621
/home/hieuvd/dung_repo/raw/stars_03/galaxyproject_galaxy/galaxy
/home/hieuvd/dung_repo/raw/stars_03/galaxyproject_galaxy/galaxy/scripts/summarize_timings.py
13,14
1,44
main
15,42
14,42
"""Script to parse timings out of a Galaxy log and summarize.""" import re from argparse import ArgumentParser import numpy DESCRIPTION = "" TIMING_LINE_PATTERN = re.compile(r"\((\d+.\d+) ms\)") def main(argv=None): FILL_FUNC_BODYif __name__ == "__main__": main()
"""Script to parse timings out of a Galaxy log and summarize.""" import re from argparse import ArgumentParser import numpy DESCRIPTION = "" TIMING_LINE_PATTERN = re.compile(r"\((\d+.\d+) ms\)") def main(argv=None): """Entry point for script.""" FILL_FUNC_BODYif __name__ == "__main__": main()
arg_parser = ArgumentParser(description=DESCRIPTION) arg_parser.add_argument("--file", default="galaxy.log") arg_parser.add_argument("--print_lines", default=False, action="store_true") arg_parser.add_argument("--pattern", default=None) args = arg_parser.parse_args(argv) print_lines = args.prin...
"""Entry point for script.""" arg_parser = ArgumentParser(description=DESCRIPTION) arg_parser.add_argument("--file", default="galaxy.log") arg_parser.add_argument("--print_lines", default=False, action="store_true") arg_parser.add_argument("--pattern", default=None) args = arg_parser.parse_args...
78
114
351
465
"""Script to parse timings out of a Galaxy log and summarize.""" import re from argparse import ArgumentParser import numpy DESCRIPTION = "" TIMING_LINE_PATTERN = re.compile(r"\((\d+.\d+) ms\)") def main(argv=None): FILL_FUNC_BODYif __name__ == "__main__": main()
"""Script to parse timings out of a Galaxy log and summarize.""" import re from argparse import ArgumentParser import numpy DESCRIPTION = "" TIMING_LINE_PATTERN = re.compile(r"\((\d+.\d+) ms\)") def main(argv=None): """Entry point for script.""" FILL_FUNC_BODYif __name__ == "__main__": main()
46,622
/home/hieuvd/dung_repo/raw/stars_03/galaxyproject_galaxy/galaxy
/home/hieuvd/dung_repo/raw/stars_03/galaxyproject_galaxy/galaxy/scripts/tool_shed/api/common.py
4,5
1,124
delete
9,23
5,23
import requests def delete(api_key, url, data, return_formatted=True): FILL_FUNC_BODYdef display(url, api_key=None, return_formatted=True): """Sends an API GET request and acts as a generic formatter for the JSON response.""" r = get(url, api_key=api_key) if not return_formatted: return r elif...
import requests def delete(api_key, url, data, return_formatted=True): """ Sends an API DELETE request and acts as a generic formatter for the JSON response. The 'data' will become the JSON payload read by the Tool Shed. """ FILL_FUNC_BODYdef display(url, api_key=None, return_formatted=True): """...
headers = {} if api_key: headers["x-api-key"] = api_key response = requests.delete(url, headers=headers) response.raise_for_status() response = response.json() if return_formatted: print("Response") print("--------") print(response) else: return respon...
""" Sends an API DELETE request and acts as a generic formatter for the JSON response. The 'data' will become the JSON payload read by the Tool Shed. """ headers = {} if api_key: headers["x-api-key"] = api_key response = requests.delete(url, headers=headers) response.raise_for_s...
24
1,032
108
1,140
import requests def delete(api_key, url, data, return_formatted=True): FILL_FUNC_BODYdef display(url, api_key=None, return_formatted=True): """Sends an API GET request and acts as a generic formatter for the JSON response.""" r = get(url, api_key=api_key) if not return_formatted: return r elif...
import requests def delete(api_key, url, data, return_formatted=True): """ Sends an API DELETE request and acts as a generic formatter for the JSON response. The 'data' will become the JSON payload read by the Tool Shed. """ FILL_FUNC_BODYdef display(url, api_key=None, return_formatted=True): """...