mirror of
https://github.com/galaxyproject/galaxy.git
synced 2026-09-24 16:30:27 +08:00
Fix new UP031 errors raised by ruff 0.0.262
This commit is contained in:
@@ -173,8 +173,7 @@ class BlastXml(GenericXml):
|
||||
# Enough to check <BlastOutput_program> and <BlastOutput_version> match
|
||||
h.close()
|
||||
raise ValueError(
|
||||
"BLAST XML headers don't match for %s and %s - have:\n%s\n...\n\nAnd:\n%s\n...\n"
|
||||
% (split_files[0], f, old_header[:300], header[:300])
|
||||
f"BLAST XML headers don't match for {split_files[0]} and {f} - have:\n{old_header[:300]}\n...\n\nAnd:\n{header[:300]}\n...\n"
|
||||
)
|
||||
else:
|
||||
out.write(" <Iteration>\n")
|
||||
|
||||
@@ -237,8 +237,9 @@ class Registry:
|
||||
# Because of the way that the value of can_process_datatype was set above, we know that the value of
|
||||
# override is True.
|
||||
self.log.debug(
|
||||
"Overriding conflicting datatype with extension '%s', using datatype from %s."
|
||||
% (str(extension), str(config))
|
||||
"Overriding conflicting datatype with extension '%s', using datatype from %s.",
|
||||
extension,
|
||||
config,
|
||||
)
|
||||
if make_subclass:
|
||||
datatype_class = type(datatype_class_name, (datatype_class,), {})
|
||||
|
||||
@@ -277,8 +277,7 @@ class Sequence(data.Text):
|
||||
start_chunk = -1
|
||||
# extract, unzip, trim, recompress
|
||||
result.append(
|
||||
"(dd bs=1 skip=%s count=%s if=%s 2> /dev/null )| zcat | ( tail -n +%s 2> /dev/null) | head -%s | gzip -c >> %s"
|
||||
% (
|
||||
"(dd bs=1 skip={} count={} if={} 2> /dev/null )| zcat | ( tail -n +{} 2> /dev/null) | head -{} | gzip -c >> {}".format(
|
||||
start_copy,
|
||||
end_copy - start_copy,
|
||||
input_name,
|
||||
|
||||
@@ -71,8 +71,9 @@ class _SpalnDb(Data):
|
||||
opt_text = ""
|
||||
if composite_file.get("description"):
|
||||
rval.append(
|
||||
'<li><a href="%s" type="application/binary">%s (%s)</a>%s</li>'
|
||||
% (fn, fn, composite_file.get("description"), opt_text)
|
||||
'<li><a href="{}" type="application/binary">{} ({})</a>{}</li>'.format(
|
||||
fn, fn, composite_file.get("description"), opt_text
|
||||
)
|
||||
)
|
||||
else:
|
||||
rval.append(f'<li><a href="{fn}" type="application/binary">{fn}</a>{opt_text}</li>')
|
||||
@@ -86,8 +87,7 @@ class _SpalnDb(Data):
|
||||
efp = dataset.extra_files_path
|
||||
flist = os.listdir(efp)
|
||||
rval = [
|
||||
"<html><head><title>Files for Composite Dataset %s</title></head><body><p/>Composite %s contains:<p/><ul>"
|
||||
% (dataset.name, dataset.name)
|
||||
f"<html><head><title>Files for Composite Dataset {dataset.name}</title></head><body><p/>Composite {dataset.name} contains:<p/><ul>"
|
||||
]
|
||||
for fname in flist:
|
||||
sfname = os.path.split(fname)[-1]
|
||||
|
||||
@@ -5,6 +5,6 @@ importlib-metadata==4.2.0
|
||||
mccabe==0.7.0
|
||||
pycodestyle==2.9.1
|
||||
pyflakes==2.5.0
|
||||
ruff==0.0.261
|
||||
ruff==0.0.264
|
||||
typing_extensions==4.5.0
|
||||
zipp==3.15.0
|
||||
|
||||
@@ -1887,8 +1887,9 @@ class MinimalJobWrapper(HasResourceParameters):
|
||||
# and when the job is recovered, it won't be found.
|
||||
if os.path.exists(dataset_path.real_path) and os.stat(dataset_path.real_path).st_size > 0:
|
||||
log.warning(
|
||||
"finish(): %s not found, but %s is not empty, so it will be used instead"
|
||||
% (dataset_path.false_path, dataset_path.real_path)
|
||||
"finish(): %s not found, but %s is not empty, so it will be used instead",
|
||||
dataset_path.false_path,
|
||||
dataset_path.real_path,
|
||||
)
|
||||
else:
|
||||
# Prior to fail we need to set job.state
|
||||
@@ -2160,8 +2161,9 @@ class MinimalJobWrapper(HasResourceParameters):
|
||||
)
|
||||
return (
|
||||
JobState.runner_states.GLOBAL_WALLTIME_REACHED,
|
||||
"Job ran longer than the maximum allowed execution time (runtime: %s, limit: %s), please try different inputs or parameters"
|
||||
% (str(runtime).split(".")[0], self.app.job_config.limits.walltime),
|
||||
"Job ran longer than the maximum allowed execution time (runtime: {}, limit: {}), please try different inputs or parameters".format(
|
||||
str(runtime).split(".")[0], self.app.job_config.limits.walltime
|
||||
),
|
||||
)
|
||||
return None
|
||||
|
||||
|
||||
@@ -1342,8 +1342,7 @@ class GalaxyRBACAgent(RBACAgent):
|
||||
break
|
||||
else:
|
||||
raise Exception(
|
||||
"Invalid class (%s) specified for target_library_item (%s)"
|
||||
% (target_library_item.__class__, target_library_item.__class__.__name__)
|
||||
f"Invalid class ({target_library_item.__class__}) specified for target_library_item ({target_library_item.__class__.__name__})"
|
||||
)
|
||||
# Make sure user's private role is included
|
||||
private_role = self.model.security_agent.get_private_user_role(user)
|
||||
|
||||
@@ -960,8 +960,7 @@ class NestedObjectStore(BaseObjectStore):
|
||||
return store.__getattribute__(method)(obj, **kwargs)
|
||||
if default_is_exception:
|
||||
raise default(
|
||||
"objectstore, _call_method failed: %s on %s, kwargs: %s"
|
||||
% (method, self._repr_object_for_exception(obj), str(kwargs))
|
||||
f"objectstore, _call_method failed: {method} on {self._repr_object_for_exception(obj)}, kwargs: {kwargs}"
|
||||
)
|
||||
else:
|
||||
return default
|
||||
@@ -1138,8 +1137,10 @@ class DistributedObjectStore(NestedObjectStore):
|
||||
)
|
||||
else:
|
||||
log.debug(
|
||||
"Using preferred backend '%s' for creation of %s %s"
|
||||
% (object_store_id, obj.__class__.__name__, obj.id)
|
||||
"Using preferred backend '%s' for creation of %s %s",
|
||||
object_store_id,
|
||||
obj.__class__.__name__,
|
||||
obj.id,
|
||||
)
|
||||
return self.backends[object_store_id].create(obj, **kwargs)
|
||||
else:
|
||||
@@ -1151,8 +1152,7 @@ class DistributedObjectStore(NestedObjectStore):
|
||||
return self.backends[object_store_id].__getattribute__(method)(obj, **kwargs)
|
||||
if default_is_exception:
|
||||
raise default(
|
||||
"objectstore, _call_method failed: %s on %s, kwargs: %s"
|
||||
% (method, self._repr_object_for_exception(obj), str(kwargs))
|
||||
f"objectstore, _call_method failed: {method} on {self._repr_object_for_exception(obj)}, kwargs: {kwargs}"
|
||||
)
|
||||
else:
|
||||
return default
|
||||
@@ -1178,8 +1178,10 @@ class DistributedObjectStore(NestedObjectStore):
|
||||
return obj.object_store_id
|
||||
else:
|
||||
log.warning(
|
||||
"The backend object store ID (%s) for %s object with ID %s is invalid"
|
||||
% (obj.object_store_id, obj.__class__.__name__, obj.id)
|
||||
"The backend object store ID (%s) for %s object with ID %s is invalid",
|
||||
obj.object_store_id,
|
||||
obj.__class__.__name__,
|
||||
obj.id,
|
||||
)
|
||||
elif self.search_for_missing:
|
||||
# if this instance has been switched from a non-distributed to a
|
||||
|
||||
@@ -101,10 +101,7 @@ class InstallRepositoryManager:
|
||||
repository_revision_dict: RepositoryMetadataInstallInfoDict = items[1]
|
||||
repo_info_dict: ExtraRepoInfo = items[2]
|
||||
else:
|
||||
message = (
|
||||
"Unable to retrieve installation information from tool shed %s for revision %s of repository %s owned by %s"
|
||||
% (str(tool_shed_url), str(changeset_revision), str(name), str(owner))
|
||||
)
|
||||
message = f"Unable to retrieve installation information from tool shed {tool_shed_url} for revision {changeset_revision} of repository {name} owned by {owner}"
|
||||
log.warning(message)
|
||||
raise exceptions.InternalServerError(message)
|
||||
# Make sure the tool shed returned everything we need for installing the repository.
|
||||
|
||||
@@ -875,14 +875,12 @@ class InstalledRepositoryManager:
|
||||
if new_dependency_name and new_dependency_type and new_dependency_version:
|
||||
# Update all attributes of the tool_dependency record in the database.
|
||||
log.debug(
|
||||
"Updating version %s of tool dependency %s %s to have new version %s and type %s."
|
||||
% (
|
||||
str(tool_dependency.version),
|
||||
str(tool_dependency.type),
|
||||
str(tool_dependency.name),
|
||||
str(new_dependency_version),
|
||||
str(new_dependency_type),
|
||||
)
|
||||
"Updating version %s of tool dependency %s %s to have new version %s and type %s.",
|
||||
tool_dependency.version,
|
||||
tool_dependency.type,
|
||||
tool_dependency.name,
|
||||
new_dependency_version,
|
||||
new_dependency_type,
|
||||
)
|
||||
tool_dependency.type = new_dependency_type
|
||||
tool_dependency.version = new_dependency_version
|
||||
@@ -895,8 +893,10 @@ class InstalledRepositoryManager:
|
||||
# We have no new tool dependency definition based on a matching dependency name, so remove
|
||||
# the existing tool dependency record from the database.
|
||||
log.debug(
|
||||
"Deleting version %s of tool dependency %s %s from the database since it is no longer defined."
|
||||
% (str(tool_dependency.version), str(tool_dependency.type), str(tool_dependency.name))
|
||||
"Deleting version %s of tool dependency %s %s from the database since it is no longer defined.",
|
||||
tool_dependency.version,
|
||||
tool_dependency.type,
|
||||
tool_dependency.name,
|
||||
)
|
||||
context.delete(tool_dependency)
|
||||
context.flush()
|
||||
|
||||
+3
-2
@@ -156,8 +156,9 @@ class InstalledRepositoryMetadataManager(MetadataGenerator):
|
||||
unsuccessful_count += 1
|
||||
else:
|
||||
log.debug(
|
||||
"Successfully reset metadata on repository %s owned by %s"
|
||||
% (str(repository.name), str(repository.owner))
|
||||
"Successfully reset metadata on repository %s owned by %s",
|
||||
repository.name,
|
||||
repository.owner,
|
||||
)
|
||||
successful_count += 1
|
||||
except Exception:
|
||||
|
||||
+6
-7
@@ -234,15 +234,14 @@ class RepositoryDependencyInstallManager:
|
||||
install_model.ToolShedRepository.installation_status.INSTALLING_TOOL_DEPENDENCIES,
|
||||
install_model.ToolShedRepository.installation_status.LOADING_PROPRIETARY_DATATYPES,
|
||||
]:
|
||||
info_msg = (
|
||||
log.info(
|
||||
"Skipping installation of revision %s of repository '%s' because it was installed "
|
||||
% (changeset_revision, repository_db_record.name)
|
||||
"with the (possibly updated) revision %s and its current installation status is '%s'.",
|
||||
changeset_revision,
|
||||
repository_db_record.name,
|
||||
installed_changeset_revision,
|
||||
repository_db_record.status,
|
||||
)
|
||||
info_msg += (
|
||||
"with the (possibly updated) revision %s and its current installation status is '%s'."
|
||||
% (installed_changeset_revision, repository_db_record.status)
|
||||
)
|
||||
log.info(info_msg)
|
||||
can_update_db_record = False
|
||||
else:
|
||||
if repository_db_record.status in [
|
||||
|
||||
@@ -135,15 +135,17 @@ class DataManagerHandler:
|
||||
tool_dict = repository_tools_by_guid.get(tool_guid, None)
|
||||
if tool_dict is None:
|
||||
log.error(
|
||||
"Data manager tool guid '%s' could not be found for '%s'. Perhaps the tool is invalid?"
|
||||
% (tool_guid, data_manager_id)
|
||||
"Data manager tool guid '%s' could not be found for '%s'. Perhaps the tool is invalid?",
|
||||
tool_guid,
|
||||
data_manager_id,
|
||||
)
|
||||
continue
|
||||
tool = tool_dict.get("tool", None)
|
||||
if tool is None:
|
||||
log.error(
|
||||
"Data manager tool with guid '%s' could not be found for '%s'. Perhaps the tool is invalid?"
|
||||
% (tool_guid, data_manager_id)
|
||||
"Data manager tool with guid '%s' could not be found for '%s'. Perhaps the tool is invalid?",
|
||||
tool_guid,
|
||||
data_manager_id,
|
||||
)
|
||||
continue
|
||||
tool_config_filename = tool_dict.get("tool_config_filename", None)
|
||||
|
||||
@@ -907,10 +907,9 @@ class MetadataGenerator:
|
||||
# shed may have simply been inaccessible when metadata was being generated for the
|
||||
# installed tool shed repository.
|
||||
error_message = (
|
||||
"Ignoring invalid repository dependency definition for tool shed %s, name %s, owner %s, "
|
||||
% (toolshed, name, owner)
|
||||
f"Ignoring invalid repository dependency definition for tool shed {toolshed}, name {name}, owner {owner}, "
|
||||
f"changeset revision {changeset_revision}."
|
||||
)
|
||||
error_message += f"changeset revision {changeset_revision}."
|
||||
log.debug(error_message)
|
||||
is_valid = False
|
||||
return repository_dependency_tup, is_valid, error_message
|
||||
@@ -925,10 +924,9 @@ class MetadataGenerator:
|
||||
)
|
||||
except Exception:
|
||||
error_message = (
|
||||
"Ignoring repository dependency definition for tool shed %s, name %s, owner %s, "
|
||||
% (toolshed, name, owner)
|
||||
f"Ignoring repository dependency definition for tool shed {toolshed}, name {name}, owner {owner}, "
|
||||
f"changeset revision {changeset_revision} because the owner is invalid."
|
||||
)
|
||||
error_message += f"changeset revision {changeset_revision} because the owner is invalid."
|
||||
log.debug(error_message)
|
||||
is_valid = False
|
||||
return repository_dependency_tup, is_valid, error_message
|
||||
@@ -945,10 +943,9 @@ class MetadataGenerator:
|
||||
)
|
||||
except Exception:
|
||||
error_message = (
|
||||
"Ignoring repository dependency definition for tool shed %s, name %s, owner %s, "
|
||||
% (toolshed, name, owner)
|
||||
f"Ignoring repository dependency definition for tool shed {toolshed}, name {name}, owner {owner}, "
|
||||
f"changeset revision {changeset_revision} because the name is invalid. "
|
||||
)
|
||||
error_message += f"changeset revision {changeset_revision} because the name is invalid. "
|
||||
log.debug(error_message)
|
||||
is_valid = False
|
||||
return repository_dependency_tup, is_valid, error_message
|
||||
@@ -980,10 +977,7 @@ class MetadataGenerator:
|
||||
break
|
||||
if not found:
|
||||
error_message = (
|
||||
"Ignoring repository dependency definition for tool shed %s, name %s, owner %s, "
|
||||
% (toolshed, name, owner)
|
||||
)
|
||||
error_message += (
|
||||
f"Ignoring repository dependency definition for tool shed {toolshed}, name {name}, owner {owner}, "
|
||||
f"changeset revision {changeset_revision} because the changeset revision is invalid. "
|
||||
)
|
||||
log.debug(error_message)
|
||||
@@ -993,10 +987,7 @@ class MetadataGenerator:
|
||||
# Repository dependencies are currently supported within a single tool shed.
|
||||
error_message = (
|
||||
"Repository dependencies are currently supported only within the same tool shed. Ignoring "
|
||||
)
|
||||
error_message += (
|
||||
"repository dependency definition for tool shed %s, name %s, owner %s, changeset revision %s. "
|
||||
% (toolshed, name, owner, changeset_revision)
|
||||
f"repository dependency definition for tool shed {toolshed}, name {name}, owner {owner}, changeset revision {changeset_revision}. "
|
||||
)
|
||||
log.debug(error_message)
|
||||
is_valid = False
|
||||
|
||||
@@ -653,8 +653,9 @@ def get_tool_shed_status_for(tool_shed_registry: Registry, repository: ToolShedR
|
||||
# This should handle backward compatility to the Galaxy 12/20/12 release. We used to only handle updates for an installed revision
|
||||
# using a boolean value.
|
||||
log.debug(
|
||||
"Error attempting to get tool shed status for installed repository %s: %s\nAttempting older 'check_for_updates' method.\n"
|
||||
% (str(repository.name), str(e))
|
||||
"Error attempting to get tool shed status for installed repository %s: %s\nAttempting older 'check_for_updates' method.\n",
|
||||
repository.name,
|
||||
e,
|
||||
)
|
||||
pathspec = ["repository", "check_for_updates"]
|
||||
params["from_update_manager"] = True
|
||||
|
||||
@@ -160,14 +160,14 @@ class CommandLineException(Exception):
|
||||
self.stdout = stdout
|
||||
self.stderr = stderr
|
||||
self.message = (
|
||||
"Failed to execute command-line %s, stderr was:\n"
|
||||
"Failed to execute command-line {}, stderr was:\n"
|
||||
"-------->>begin stderr<<--------\n"
|
||||
"%s\n"
|
||||
"{}\n"
|
||||
"-------->>end stderr<<--------\n"
|
||||
"-------->>begin stdout<<--------\n"
|
||||
"%s\n"
|
||||
"{}\n"
|
||||
"-------->>end stdout<<--------\n"
|
||||
) % (command, stderr, stdout)
|
||||
).format(command, stderr, stdout)
|
||||
|
||||
def __str__(self):
|
||||
return self.message
|
||||
|
||||
@@ -1608,23 +1608,19 @@ class Tool(Dictifiable):
|
||||
possible_cases.remove(case.value)
|
||||
except Exception:
|
||||
log.debug(
|
||||
"Tool with id '%s': a when tag has been defined for '%s (%s) --> %s', but does not appear to be selectable."
|
||||
% (
|
||||
self.id,
|
||||
group_c.name,
|
||||
group_c.test_param.name,
|
||||
case.value,
|
||||
)
|
||||
)
|
||||
for unspecified_case in possible_cases:
|
||||
log.warning(
|
||||
"Tool with id '%s': a when tag has not been defined for '%s (%s) --> %s', assuming empty inputs."
|
||||
% (
|
||||
"Tool with id '%s': a when tag has been defined for '%s (%s) --> %s', but does not appear to be selectable.",
|
||||
self.id,
|
||||
group_c.name,
|
||||
group_c.test_param.name,
|
||||
unspecified_case,
|
||||
case.value,
|
||||
)
|
||||
for unspecified_case in possible_cases:
|
||||
log.warning(
|
||||
"Tool with id '%s': a when tag has not been defined for '%s (%s) --> %s', assuming empty inputs.",
|
||||
self.id,
|
||||
group_c.name,
|
||||
group_c.test_param.name,
|
||||
unspecified_case,
|
||||
)
|
||||
case = ConditionalWhen()
|
||||
case.value = unspecified_case
|
||||
|
||||
@@ -13,7 +13,7 @@ log = logging.getLogger(__name__)
|
||||
|
||||
|
||||
class GithubPlugin(BaseGitPlugin):
|
||||
"""Send error report to Github."""
|
||||
"""Send error report to GitHub."""
|
||||
|
||||
plugin_type = "github"
|
||||
|
||||
@@ -23,7 +23,7 @@ class GithubPlugin(BaseGitPlugin):
|
||||
self.verbose = string_as_bool(kwargs.get("verbose", False))
|
||||
self.user_submission = string_as_bool(kwargs.get("user_submission", False))
|
||||
|
||||
# Github settings
|
||||
# GitHub settings
|
||||
self.github_base_url = kwargs.get("github_base_url", "https://github.com")
|
||||
self.github_api_url = kwargs.get("github_api_url", "https://api.github.com")
|
||||
self.git_default_repo_owner = kwargs.get("github_default_repo_owner", False)
|
||||
@@ -46,7 +46,7 @@ class GithubPlugin(BaseGitPlugin):
|
||||
self.label_cache["default"] = {}
|
||||
self._fill_label_cache(repo, "default")
|
||||
except ImportError:
|
||||
log.error("Please install pygithub to submit bug reports to github")
|
||||
log.error("Please install pygithub to submit bug reports to GitHub")
|
||||
self.github = None
|
||||
|
||||
def submit_report(self, dataset, job, tool, **kwargs):
|
||||
@@ -99,9 +99,8 @@ class GithubPlugin(BaseGitPlugin):
|
||||
else:
|
||||
self._append_issue(issue_cache_key, error_title, error_message)
|
||||
return (
|
||||
'Submitted error report to Github. Your issue number is <a href="%s/%s/issues/%s" '
|
||||
'target="_blank">#%s</a>.'
|
||||
% (
|
||||
'Submitted error report to GitHub. Your issue number is <a href="{}/{}/issues/{}" '
|
||||
'target="_blank">#{}</a>.'.format(
|
||||
self.github_base_url,
|
||||
github_projecturl,
|
||||
self.issue_cache[issue_cache_key][error_title].number,
|
||||
|
||||
@@ -185,9 +185,8 @@ class GitLabPlugin(BaseGitPlugin):
|
||||
)
|
||||
|
||||
return (
|
||||
'Submitted error report to GitLab. Your issue number is <a href="%s/%s/issues/%s" '
|
||||
'target="_blank">#%s</a>.'
|
||||
% (
|
||||
'Submitted error report to GitLab. Your issue number is <a href="{}/{}/issues/{}" '
|
||||
'target="_blank">#{}</a>.'.format(
|
||||
self.gitlab_base_url,
|
||||
gitlab_projecturl,
|
||||
self.issue_cache[issue_cache_key][error_title],
|
||||
|
||||
@@ -155,14 +155,14 @@ class CommandLineException(Exception):
|
||||
self.stderr = stderr
|
||||
self.returncode = returncode
|
||||
self.message = (
|
||||
"Failed to execute command-line %s, stderr was:\n"
|
||||
"Failed to execute command-line {}, stderr was:\n"
|
||||
"-------->>begin stderr<<--------\n"
|
||||
"%s\n"
|
||||
"{}\n"
|
||||
"-------->>end stderr<<--------\n"
|
||||
"-------->>begin stdout<<--------\n"
|
||||
"%s\n"
|
||||
"{}\n"
|
||||
"-------->>end stdout<<--------\n"
|
||||
) % (command, stderr, stdout)
|
||||
).format(command, stderr, stdout)
|
||||
|
||||
def __str__(self):
|
||||
"""Return a verbose error message indicating the command problem."""
|
||||
|
||||
@@ -176,8 +176,7 @@ def safe_walk(path, allowlist=None):
|
||||
|
||||
if allowlist and i % WALK_MAX_DIRS == 0:
|
||||
raise RuntimeError(
|
||||
"Breaking out of walk of %r after %s iterations (most likely infinite symlink recursion) at: %r"
|
||||
% (path, WALK_MAX_DIRS, dirpath)
|
||||
f"Breaking out of walk of {path!r} after {WALK_MAX_DIRS} iterations (most likely infinite symlink recursion) at: {dirpath!r}"
|
||||
)
|
||||
_prefix = partial(join, dirpath)
|
||||
|
||||
|
||||
@@ -105,12 +105,10 @@ class AdminToolshed(AdminGalaxy):
|
||||
repository = get_installed_tool_shed_repository(trans.app, repository_id)
|
||||
tool_shed_url = common_util.get_tool_shed_url_from_tool_shed_registry(trans.app, str(repository.tool_shed))
|
||||
if tool_shed_url is None or repository_name is None or repository_owner is None or changeset_revision is None:
|
||||
message = "Unable to retrieve updated repository information from the Tool Shed because one or more of the following "
|
||||
message += (
|
||||
"required parameters is None: tool_shed_url: %s, repository_name: %s, repository_owner: %s, changeset_revision: %s "
|
||||
% (str(tool_shed_url), str(repository_name), str(repository_owner), str(changeset_revision))
|
||||
raise Exception(
|
||||
"Unable to retrieve updated repository information from the Tool Shed because one or more of the following "
|
||||
f"required parameters is None: tool_shed_url: {tool_shed_url}, repository_name: {repository_name}, repository_owner: {repository_owner}, changeset_revision: {changeset_revision} "
|
||||
)
|
||||
raise Exception(message)
|
||||
params = dict(name=str(repository_name), owner=str(repository_owner), changeset_revision=changeset_revision)
|
||||
pathspec = ["repository", "get_updated_repository_information"]
|
||||
raw_text = util.url_get(
|
||||
|
||||
@@ -1092,8 +1092,7 @@ class DatasetInterface(BaseUIController, UsesAnnotations, UsesItemRatings, UsesE
|
||||
if current_history in target_histories:
|
||||
refresh_frames = ["history"]
|
||||
hist_names_str = ", ".join(
|
||||
'<a href="%s" target="_top">%s</a>'
|
||||
% (
|
||||
'<a href="{}" target="_top">{}</a>'.format(
|
||||
url_for(
|
||||
controller="history", action="switch_to_history", hist_id=trans.security.encode_id(hist.id)
|
||||
),
|
||||
|
||||
@@ -476,8 +476,9 @@ class VisualizationController(
|
||||
|
||||
# Redirect to load galaxy frames.
|
||||
return trans.show_ok_message(
|
||||
message="""Visualization "%s" has been imported. <br>You can <a href="%s">start using this visualization</a> or %s."""
|
||||
% (visualization.title, web.url_for("/visualizations/list"), referer_message),
|
||||
message="""Visualization "{}" has been imported. <br>You can <a href="{}">start using this visualization</a> or {}.""".format(
|
||||
visualization.title, web.url_for("/visualizations/list"), referer_message
|
||||
),
|
||||
use_panels=True,
|
||||
)
|
||||
|
||||
|
||||
@@ -301,8 +301,9 @@ class WorkflowController(BaseUIController, SharableMixin, UsesStoredWorkflowMixi
|
||||
|
||||
# Redirect to load galaxy frames.
|
||||
return trans.show_ok_message(
|
||||
message="""Workflow "%s" has been imported. <br>You can <a href="%s">start using this workflow</a> or %s."""
|
||||
% (stored.name, web.url_for("/workflows/list"), referer_message)
|
||||
message="""Workflow "{}" has been imported. <br>You can <a href="{}">start using this workflow</a> or {}.""".format(
|
||||
stored.name, web.url_for("/workflows/list"), referer_message
|
||||
)
|
||||
)
|
||||
|
||||
@web.expose
|
||||
|
||||
@@ -263,21 +263,28 @@ class RelationBuilder:
|
||||
# For backward compatibility to the 12/20/12 Galaxy release.
|
||||
if len(components_list) in (4, 5):
|
||||
rd_only_if_compiling_contained_td = "False"
|
||||
message = (
|
||||
log.debug(
|
||||
"The revision %s defined for repository %s owned by %s is invalid, so repository "
|
||||
% (str(rd_changeset_revision), str(rd_name), str(rd_owner))
|
||||
"dependencies defined for repository %s will be ignored.",
|
||||
rd_changeset_revision,
|
||||
rd_name,
|
||||
rd_owner,
|
||||
repository_name,
|
||||
)
|
||||
message += f"dependencies defined for repository {repository_name} will be ignored."
|
||||
log.debug(message)
|
||||
else:
|
||||
repository_components_tuple = container_util.get_components_from_key(key)
|
||||
components_list = tool_shed.util.repository_util.extract_components_from_tuple(
|
||||
repository_components_tuple
|
||||
)
|
||||
toolshed, repository_name, repository_owner, repository_changeset_revision = components_list[0:4]
|
||||
message = f"The revision {rd_changeset_revision} defined for repository {rd_name} owned by {rd_owner} is invalid, "
|
||||
message += f"so repository dependencies defined for repository {repository_name} will be ignored."
|
||||
log.debug(message)
|
||||
log.debug(
|
||||
"The revision %s defined for repository %s owned by %s is invalid, "
|
||||
"so repository dependencies defined for repository %s will be ignored.",
|
||||
rd_changeset_revision,
|
||||
rd_name,
|
||||
rd_owner,
|
||||
repository_name,
|
||||
)
|
||||
return updated_key_rd_dicts
|
||||
|
||||
def handle_circular_repository_dependency(self, repository_key, repository_dependency):
|
||||
|
||||
@@ -859,14 +859,11 @@ class RepositoriesWithInvalidToolsGrid(RepositoryGrid):
|
||||
invalid_tools = metadata.get("invalid_tools", [])
|
||||
if invalid_tools:
|
||||
for invalid_tool_config in invalid_tools:
|
||||
href_str = (
|
||||
'<a href="load_invalid_tool?repository_id=%s&tool_config=%s&changeset_revision=%s">%s</a>'
|
||||
% (
|
||||
trans.security.encode_id(repository.id),
|
||||
invalid_tool_config,
|
||||
repository_metadata.changeset_revision,
|
||||
invalid_tool_config,
|
||||
)
|
||||
href_str = '<a href="load_invalid_tool?repository_id={}&tool_config={}&changeset_revision={}">{}</a>'.format(
|
||||
trans.security.encode_id(repository.id),
|
||||
invalid_tool_config,
|
||||
repository_metadata.changeset_revision,
|
||||
invalid_tool_config,
|
||||
)
|
||||
val += href_str
|
||||
val += "<br/>"
|
||||
@@ -1421,10 +1418,7 @@ class ValidRepositoryGrid(RepositoryGrid):
|
||||
rval = "<ul>"
|
||||
if repository.categories:
|
||||
for rca in repository.categories:
|
||||
rval += (
|
||||
'<li><a href="browse_repositories?operation=valid_repositories_by_category&id=%s">%s</a></li>'
|
||||
% (trans.security.encode_id(rca.category.id), rca.category.name)
|
||||
)
|
||||
rval += f'<li><a href="browse_repositories?operation=valid_repositories_by_category&id={trans.security.encode_id(rca.category.id)}">{rca.category.name}</a></li>'
|
||||
else:
|
||||
rval += "<li>not set</li>"
|
||||
rval += "</ul>"
|
||||
|
||||
@@ -975,8 +975,9 @@ class RepositoryMetadataManager(metadata_generator.MetadataGenerator):
|
||||
unsuccessful_count += 1
|
||||
else:
|
||||
log.debug(
|
||||
"Successfully reset metadata on repository %s owned by %s"
|
||||
% (str(repository.name), str(repository.user.username))
|
||||
"Successfully reset metadata on repository %s owned by %s",
|
||||
repository.name,
|
||||
repository.user.username,
|
||||
)
|
||||
successful_count += 1
|
||||
except Exception:
|
||||
|
||||
@@ -223,8 +223,9 @@ def get_repository_dependency_tups_from_repository_metadata(app, repository_meta
|
||||
dependency_tups.append(repository_dependency_tup)
|
||||
else:
|
||||
log.debug(
|
||||
"Cannot locate repository %s owned by %s for inclusion in repository dependency tups."
|
||||
% (name, owner)
|
||||
"Cannot locate repository %s owned by %s for inclusion in repository dependency tups.",
|
||||
name,
|
||||
owner,
|
||||
)
|
||||
return dependency_tups
|
||||
|
||||
|
||||
@@ -262,8 +262,9 @@ class RepositoriesController(BaseAPIController):
|
||||
return repository_dict, repository_metadata_dict, repo_info_dict
|
||||
else:
|
||||
log.debug(
|
||||
"Unable to locate repository_metadata record for repository id %s and changeset_revision %s"
|
||||
% (str(repository.id), str(changeset_revision))
|
||||
"Unable to locate repository_metadata record for repository id %s and changeset_revision %s",
|
||||
repository.id,
|
||||
changeset_revision,
|
||||
)
|
||||
return repository_dict, {}, {}
|
||||
else:
|
||||
@@ -617,8 +618,9 @@ class RepositoriesController(BaseAPIController):
|
||||
encoded_id = trans.security.encode_id(repository.id)
|
||||
if encoded_id in encoded_ids_to_skip:
|
||||
log.debug(
|
||||
"Skipping repository with id %s because it is in encoded_ids_to_skip %s"
|
||||
% (str(repository.id), str(encoded_ids_to_skip))
|
||||
"Skipping repository with id %s because it is in encoded_ids_to_skip %s",
|
||||
repository.id,
|
||||
encoded_ids_to_skip,
|
||||
)
|
||||
elif repository.type == rt_util.TOOL_DEPENDENCY_DEFINITION and repository.id not in handled_repository_ids:
|
||||
results = handle_repository(trans, rmm, repository, results)
|
||||
@@ -627,8 +629,9 @@ class RepositoriesController(BaseAPIController):
|
||||
encoded_id = trans.security.encode_id(repository.id)
|
||||
if encoded_id in encoded_ids_to_skip:
|
||||
log.debug(
|
||||
"Skipping repository with id %s because it is in encoded_ids_to_skip %s"
|
||||
% (str(repository.id), str(encoded_ids_to_skip))
|
||||
"Skipping repository with id %s because it is in encoded_ids_to_skip %s",
|
||||
repository.id,
|
||||
encoded_ids_to_skip,
|
||||
)
|
||||
elif repository.type != rt_util.TOOL_DEPENDENCY_DEFINITION and repository.id not in handled_repository_ids:
|
||||
results = handle_repository(trans, rmm, repository, results)
|
||||
@@ -811,8 +814,9 @@ class RepositoriesController(BaseAPIController):
|
||||
return repository_metadata_dict
|
||||
else:
|
||||
log.debug(
|
||||
"Unable to locate repository_metadata record for repository id %s and changeset_revision %s"
|
||||
% (str(id), str(changeset))
|
||||
"Unable to locate repository_metadata record for repository id %s and changeset_revision %s",
|
||||
id,
|
||||
changeset,
|
||||
)
|
||||
return {}
|
||||
|
||||
|
||||
@@ -199,15 +199,18 @@ class RepositoryRevisionsController(BaseAPIController):
|
||||
# log information when setting attributes associated with the Tool Shed's install and test framework.
|
||||
if key in ["includes_tools", "missing_test_components"]:
|
||||
log.debug(
|
||||
"Setting repository_metadata column %s to value %s for changeset_revision %s via the Tool Shed API."
|
||||
% (str(key), str(new_value), str(repository_metadata.changeset_revision))
|
||||
"Setting repository_metadata column %s to value %s for changeset_revision %s via the Tool Shed API.",
|
||||
key,
|
||||
new_value,
|
||||
repository_metadata.changeset_revision,
|
||||
)
|
||||
setattr(repository_metadata, key, new_value)
|
||||
flush_needed = True
|
||||
if flush_needed:
|
||||
log.debug(
|
||||
"Updating repository_metadata record with id %s and changeset_revision %s."
|
||||
% (str(decoded_repository_metadata_id), str(repository_metadata.changeset_revision))
|
||||
"Updating repository_metadata record with id %s and changeset_revision %s.",
|
||||
decoded_repository_metadata_id,
|
||||
repository_metadata.changeset_revision,
|
||||
)
|
||||
trans.sa_session.add(repository_metadata)
|
||||
trans.sa_session.flush()
|
||||
|
||||
@@ -994,14 +994,13 @@ class RepositoryController(BaseUIController, ratings_util.ItemRatings):
|
||||
self.install_matched_repository_grid.operations = operations
|
||||
return self.install_matched_repository_grid(trans, **kwd)
|
||||
else:
|
||||
kwd["message"] = (
|
||||
"tool id: <b>%s</b><br/>tool name: <b>%s</b><br/>tool version: <b>%s</b><br/>exact matches only: <b>%s</b>"
|
||||
% (
|
||||
basic_util.stringify(tool_ids),
|
||||
escape(basic_util.stringify(tool_names)),
|
||||
escape(basic_util.stringify(tool_versions)),
|
||||
str(exact_matches_checked),
|
||||
)
|
||||
kwd[
|
||||
"message"
|
||||
] = "tool id: <b>{}</b><br/>tool name: <b>{}</b><br/>tool version: <b>{}</b><br/>exact matches only: <b>{}</b>".format(
|
||||
basic_util.stringify(tool_ids),
|
||||
escape(basic_util.stringify(tool_names)),
|
||||
escape(basic_util.stringify(tool_versions)),
|
||||
exact_matches_checked,
|
||||
)
|
||||
self.matched_repository_grid.title = "Repositories with matching tools"
|
||||
return self.matched_repository_grid(trans, **kwd)
|
||||
@@ -2292,8 +2291,9 @@ class RepositoryController(BaseUIController, ratings_util.ItemRatings):
|
||||
return trans.response.send_redirect(web.url_for(controller="repository", action="index", user_id=user_id))
|
||||
else:
|
||||
return trans.show_error_message(
|
||||
"The tool shed <b>%s</b> contains no repositories owned by <b>%s</b>."
|
||||
% (web.url_for("/", qualified=True).rstrip("/"), str(owner))
|
||||
"The tool shed <b>{}</b> contains no repositories owned by <b>{}</b>.".format(
|
||||
web.url_for("/", qualified=True).rstrip("/"), owner
|
||||
)
|
||||
)
|
||||
|
||||
@web.expose
|
||||
@@ -2316,7 +2316,9 @@ class RepositoryController(BaseUIController, ratings_util.ItemRatings):
|
||||
user = None
|
||||
if user:
|
||||
user_id = trans.security.encode_id(user.id)
|
||||
message = f"This list of repositories owned by <b>{str(owner)}</b>, does not include one named <b>{str(name)}</b>."
|
||||
message = (
|
||||
f"This list of repositories owned by <b>{owner}</b>, does not include one named <b>{name}</b>."
|
||||
)
|
||||
return trans.response.send_redirect(
|
||||
web.url_for(
|
||||
controller="repository", action="index", user_id=user_id, message=message, status="error"
|
||||
@@ -2324,8 +2326,9 @@ class RepositoryController(BaseUIController, ratings_util.ItemRatings):
|
||||
)
|
||||
else:
|
||||
return trans.show_error_message(
|
||||
"The tool shed <b>%s</b> contains no repositories named <b>%s</b> with owner <b>%s</b>."
|
||||
% (web.url_for("/", qualified=True).rstrip("/"), str(name), str(owner))
|
||||
"The tool shed <b>{}</b> contains no repositories named <b>{}</b> with owner <b>{}</b>.".format(
|
||||
web.url_for("/", qualified=True).rstrip("/"), name, owner
|
||||
)
|
||||
)
|
||||
|
||||
@web.expose
|
||||
@@ -2360,10 +2363,7 @@ class RepositoryController(BaseUIController, ratings_util.ItemRatings):
|
||||
)
|
||||
)
|
||||
else:
|
||||
message = (
|
||||
"The change log for the repository named <b>%s</b> owned by <b>%s</b> does not include revision <b>%s</b>."
|
||||
% (escape(str(name)), escape(str(owner)), escape(str(changeset_revision)))
|
||||
)
|
||||
message = f"The change log for the repository named <b>{escape(str(name))}</b> owned by <b>{escape(str(owner))}</b> does not include revision <b>{escape(str(changeset_revision))}</b>."
|
||||
return trans.response.send_redirect(
|
||||
web.url_for(
|
||||
controller="repository",
|
||||
|
||||
@@ -14,8 +14,9 @@ def require_login(verb="perform this action", use_panels=False):
|
||||
return func(self, trans, *args, **kwargs)
|
||||
else:
|
||||
return trans.show_error_message(
|
||||
'You must be <a target="galaxy_main" href="%s">logged in</a> to %s.'
|
||||
% (url_for(controller="user", action="login"), verb),
|
||||
'You must be <a target="galaxy_main" href="{}">logged in</a> to {}.'.format(
|
||||
url_for(controller="user", action="login"), verb
|
||||
),
|
||||
use_panels=use_panels,
|
||||
)
|
||||
|
||||
|
||||
@@ -438,8 +438,7 @@ class Repository(Base, Dictifiable):
|
||||
if str(role.name) == admin_role_name:
|
||||
return role
|
||||
raise Exception(
|
||||
"Repository %s owned by %s is not associated with a required administrative role."
|
||||
% (str(self.name), str(self.user.username))
|
||||
f"Repository {self.name} owned by {self.user.username} is not associated with a required administrative role."
|
||||
)
|
||||
|
||||
def allow_push(self):
|
||||
|
||||
Reference in New Issue
Block a user